diff options
author | David Robillard <d@drobilla.net> | 2016-03-16 16:54:49 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | 19b9f627ba195cab7c7ebea9daca9ead6e4f5d9a (patch) | |
tree | 39da1a30375903d8446250498b5f386fce515e2a /include | |
parent | 82f8f804773b10c42b17a30872a59ed76b062794 (diff) | |
download | serd-19b9f627ba195cab7c7ebea9daca9ead6e4f5d9a.tar.gz serd-19b9f627ba195cab7c7ebea9daca9ead6e4f5d9a.tar.bz2 serd-19b9f627ba195cab7c7ebea9daca9ead6e4f5d9a.zip |
Rename SerdChunk to SerdStringView
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/serd.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index 80d6b230..3dacf6a9 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -76,11 +76,16 @@ typedef enum { /// Bitwise OR of SerdNodeFlag values typedef uint32_t SerdNodeFlags; -/// An unterminated string fragment +/** + An immutable slice of a string. + + This type is used for many string parameters, to allow referring to slices + of strings in-place and to avoid redundant string measurement. +*/ typedef struct { - const char* SERD_NULLABLE buf; ///< Start of chunk - size_t len; ///< Length of chunk in bytes -} SerdChunk; + const char* SERD_NULLABLE buf; ///< Start of string + size_t len; ///< Length of string in bytes +} SerdStringView; /// A mutable buffer in memory typedef struct { @@ -217,12 +222,12 @@ typedef size_t (*SerdSink)(const void* SERD_NONNULL buf, in-place without allocating memory. */ typedef struct { - SerdChunk scheme; ///< Scheme - SerdChunk authority; ///< Authority - SerdChunk path_base; ///< Path prefix if relative - SerdChunk path; ///< Path suffix - SerdChunk query; ///< Query - SerdChunk fragment; ///< Fragment + SerdStringView scheme; ///< Scheme + SerdStringView authority; ///< Authority + SerdStringView path_base; ///< Path prefix if relative + SerdStringView path; ///< Path suffix + SerdStringView query; ///< Query + SerdStringView fragment; ///< Fragment } SerdURI; static const SerdURI SERD_URI_NULL = @@ -618,7 +623,7 @@ SERD_API bool serd_env_qualify(const SerdEnv* SERD_NULLABLE env, const SerdNode* SERD_NONNULL uri, SerdNode* SERD_NONNULL prefix, - SerdChunk* SERD_NONNULL suffix); + SerdStringView* SERD_NONNULL suffix); /** Expand `curie`. @@ -629,8 +634,8 @@ serd_env_qualify(const SerdEnv* SERD_NULLABLE env, SERD_API SerdStatus serd_env_expand(const SerdEnv* SERD_NULLABLE env, const SerdNode* SERD_NONNULL curie, - SerdChunk* SERD_NONNULL uri_prefix, - SerdChunk* SERD_NONNULL uri_suffix); + SerdStringView* SERD_NONNULL uri_prefix, + SerdStringView* SERD_NONNULL uri_suffix); /** Expand `node`, which must be a CURIE or URI, to a full URI. @@ -868,7 +873,7 @@ serd_buffer_sink(const void* SERD_NONNULL buf, void* SERD_NONNULL stream); /** - Finish a serialisation to a chunk with serd_buffer_sink(). + Finish writing to a buffer with serd_buffer_sink(). The returned string is the result of the serialisation, which is null terminated (by this function) and owned by the caller. |