diff options
author | David Robillard <d@drobilla.net> | 2018-05-27 15:32:12 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | ef758859f54c37e90deb419fa4e58a9609ea1999 (patch) | |
tree | 5eba61d59c1802fa971ee9931919a41132a42512 /include/serd | |
parent | e0fba44b0f64b4491f0e013a69565f6ad2cff80b (diff) | |
download | serd-ef758859f54c37e90deb419fa4e58a9609ea1999.tar.gz serd-ef758859f54c37e90deb419fa4e58a9609ea1999.tar.bz2 serd-ef758859f54c37e90deb419fa4e58a9609ea1999.zip |
Move syntax name/extension utilities to public API
Diffstat (limited to 'include/serd')
-rw-r--r-- | include/serd/serd.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index 63d094ef..375a8c5d 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -23,6 +23,7 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> +#include <string.h> #if defined(_WIN32) && !defined(SERD_STATIC) && defined(SERD_INTERNAL) # define SERD_API __declspec(dllexport) @@ -393,6 +394,41 @@ typedef size_t (*SerdWriteFunc)(const void* SERD_NONNULL buf, /** @} + @defgroup serd_syntax Syntax Utilities + @{ +*/ + +/** + Get a syntax by name. + + Case-insensitive, supports "Turtle", "NTriples", "NQuads", and "TriG". Zero + is returned if the name is not recognized. +*/ +SERD_PURE_API +SerdSyntax +serd_syntax_by_name(const char* SERD_NONNULL name); + +/** + Guess a syntax from a filename. + + This uses the file extension to guess the syntax of a file. Zero is + returned if the extension is not recognized. +*/ +SERD_PURE_API +SerdSyntax +serd_guess_syntax(const char* SERD_NONNULL filename); + +/** + Return whether a syntax can represent multiple graphs. + + @return True for SERD_NQUADS and SERD_TRIG, false otherwise. +*/ +SERD_CONST_API +bool +serd_syntax_has_graphs(SerdSyntax syntax); + +/** + @} @defgroup serd_uri URI @{ */ |