diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/syntax.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/serd/syntax.h b/include/serd/syntax.h index 21847438..c3a33ff5 100644 --- a/include/serd/syntax.h +++ b/include/serd/syntax.h @@ -6,6 +6,8 @@ #include "serd/attributes.h" +#include <stdbool.h> + SERD_BEGIN_DECLS /** @@ -14,15 +16,41 @@ SERD_BEGIN_DECLS @{ */ -/// RDF syntax type +/// Syntax supported by serd typedef enum { - SERD_TURTLE = 1, ///< Terse triples http://www.w3.org/TR/turtle - SERD_NTRIPLES = 2, ///< Line-based triples http://www.w3.org/TR/n-triples/ - SERD_NQUADS = 3, ///< Line-based quads http://www.w3.org/TR/n-quads/ - SERD_TRIG = 4, ///< Terse quads http://www.w3.org/TR/trig/ + SERD_TURTLE = 1U, ///< Terse triples http://www.w3.org/TR/turtle + SERD_NTRIPLES = 2U, ///< Line-based triples http://www.w3.org/TR/n-triples/ + SERD_NQUADS = 3U, ///< Line-based quads http://www.w3.org/TR/n-quads/ + SERD_TRIG = 4U, ///< Terse quads http://www.w3.org/TR/trig/ } SerdSyntax; /** + 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 in one document. + + @return True for #SERD_NQUADS and #SERD_TRIG, false otherwise. +*/ +SERD_CONST_API bool +serd_syntax_has_graphs(SerdSyntax syntax); + +/** @} */ |