diff options
author | David Robillard <d@drobilla.net> | 2019-04-28 17:54:00 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:04 +0200 |
commit | a091b1332b7b741fbc8dd12ca20ead202f6fb021 (patch) | |
tree | e9bd20002a4d1d3210df81cd0c596250b214f65b /serd/serd.h | |
parent | e481791e907a551495f8929756b8ca5e24cac277 (diff) | |
download | serd-a091b1332b7b741fbc8dd12ca20ead202f6fb021.tar.gz serd-a091b1332b7b741fbc8dd12ca20ead202f6fb021.tar.bz2 serd-a091b1332b7b741fbc8dd12ca20ead202f6fb021.zip |
Replace serd_reader_set_strict() with SerdReaderFlags
This makes reader options extensible and should hopefully prevent the need for
grafting on more similar functions in the future.
Diffstat (limited to 'serd/serd.h')
-rw-r--r-- | serd/serd.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/serd/serd.h b/serd/serd.h index ce0213a7..30564943 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -254,6 +254,14 @@ typedef struct { SerdStringView fragment; ///< Fragment } SerdURI; +/// Reader options +typedef enum { + SERD_READ_LAX = 1 << 0 ///< Tolerate invalid input where possible +} SerdReaderFlag; + +/// Bitwise OR of SerdReaderFlag values +typedef uint32_t SerdReaderFlags; + /** Writer style options @@ -265,7 +273,7 @@ typedef struct { typedef enum { SERD_WRITE_ASCII = 1 << 0, ///< Escape all non-ASCII characters SERD_WRITE_TERSE = 1 << 1, ///< Write terser output without newlines - SERD_WRITE_STRICT = 1 << 2, ///< Abort with error on lossy output + SERD_WRITE_LAX = 1 << 2 ///< Tolerate lossy output } SerdWriterFlag; /// Bitwise OR of SerdWriterFlag values @@ -1144,21 +1152,11 @@ SERD_API SerdReader* serd_reader_new(SerdWorld* world, SerdSyntax syntax, + SerdReaderFlags flags, const SerdSink* sink, size_t stack_size); /** - Enable or disable strict parsing - - The reader is non-strict (lax) by default, which will tolerate URIs with - invalid characters. Setting strict will fail when parsing such files. An - error is printed for invalid input in either case. -*/ -SERD_API -void -serd_reader_set_strict(SerdReader* reader, bool strict); - -/** Set a prefix to be added to all blank node identifiers This is useful when multiple files are to be parsed into the same output |