From ef758859f54c37e90deb419fa4e58a9609ea1999 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 27 May 2018 15:32:12 +0200 Subject: Move syntax name/extension utilities to public API --- include/serd/serd.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/serd/serd.h') 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 #include #include +#include #if defined(_WIN32) && !defined(SERD_STATIC) && defined(SERD_INTERNAL) # define SERD_API __declspec(dllexport) @@ -391,6 +392,41 @@ typedef size_t (*SerdWriteFunc)(const void* SERD_NONNULL buf, size_t nmemb, void* SERD_NONNULL stream); +/** + @} + @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 -- cgit v1.2.1