|
libdonut 2.3.6
Application framework for cross-platform game development in C++20
|
Classes | |
| class | Array |
| JSON array type whose API mimics that of std::vector<Value>. More... | |
| struct | DeserializationOptions |
| Options for JSON deserialization. More... | |
| struct | Deserializer |
| Base template to specialize in order to implement JSON deserialization for a specific type. More... | |
| struct | Error |
| Exception type for errors originating from the JSON API. More... | |
| class | Lexer |
| Lexical analyzer for scanning and tokenizing input in the JSON5 format. More... | |
| class | Object |
| JSON object type whose API mimics that of std::multimap<String, Value>. More... | |
| class | Parser |
| Syntactic analyzer for parsing input in the JSON5 format obtained from a json::Lexer. More... | |
| struct | Reader |
| Stateful wrapper object of an input stream for JSON deserialization. More... | |
| struct | SerializationOptions |
| Options for JSON serialization. More... | |
| struct | Serializer |
| Base template to specialize in order to implement JSON serialization for a specific type. More... | |
| struct | SourceLocation |
| Line and column numbers of a location in a JSON source string. More... | |
| struct | Token |
| Token data scanned from JSON. More... | |
| class | Value |
| JSON value type. More... | |
| struct | Writer |
| Stateful wrapper object of an output stream for JSON serialization. More... | |
Typedefs | |
| using | Null = Monostate |
| JSON null type. | |
| using | Boolean = bool |
| JSON boolean type. | |
| using | String = std::string |
| JSON string type. | |
| using | Number = double |
| JSON number type. | |
| using | StringParser = Parser< const char8_t * > |
| Parser for reading contiguous UTF-8-encoded JSON strings. | |
| using | StreamParser = Parser< std::istreambuf_iterator< char > > |
| Parser for reading UTF-8-encoded JSON input stream buffers. | |
Enumerations | |
| enum class | TokenType : std::uint8_t { END_OF_FILE , IDENTIFIER_NULL , IDENTIFIER_FALSE , IDENTIFIER_TRUE , IDENTIFIER_NAME , PUNCTUATOR_COMMA , PUNCTUATOR_COLON , PUNCTUATOR_OPEN_SQUARE_BRACKET , PUNCTUATOR_CLOSE_SQUARE_BRACKET , PUNCTUATOR_OPEN_CURLY_BRACE , PUNCTUATOR_CLOSE_CURLY_BRACE , STRING , NUMBER_BINARY , NUMBER_OCTAL , NUMBER_DECIMAL , NUMBER_HEXADECIMAL , NUMBER_POSITIVE_INFINITY , NUMBER_NEGATIVE_INFINITY , NUMBER_POSITIVE_NAN , NUMBER_NEGATIVE_NAN } |
| Type of a scanned JSON5 token. More... | |
Functions | |
| constexpr bool | isWhitespaceCharacter (char32_t codePoint) noexcept |
| Check if a Unicode code point is considered to be whitespace in JSON5. | |
| constexpr bool | isPunctuationCharacter (char32_t codePoint) noexcept |
| Check if a Unicode code point is considered to be punctuation in JSON5. | |
| constexpr bool | isLineTerminatorCharacter (char32_t codePoint) noexcept |
| Check if a Unicode code point marks the beginning of a line terminator sequence in JSON5. | |
| template<typename T > | |
| void | serialize (std::ostream &stream, const T &value, const SerializationOptions &options={}) |
| Serialize a value of any JSON-serializable type to an output stream. | |
| template<typename T > | |
| void | deserialize (std::istream &stream, T &value, const DeserializationOptions &options={}) |
| Deserialize a value of any JSON-serializable type from an input stream. | |
| std::ostream & | operator<< (std::ostream &stream, const Value &value) |
| Write a JSON value to an output stream using the default serialization options. | |
| std::istream & | operator>> (std::istream &stream, Value &value) |
| Read a JSON value from an input stream using the default deserialization options. | |
| template<typename Callback > | |
| auto | onNull (Callback callback) |
| Build a Parser::ValueVisitor that handles Null values with a given callback function. | |
| template<typename Callback > | |
| auto | onBoolean (Callback callback) |
| Build a Parser::ValueVisitor that handles Boolean values with a given callback function. | |
| template<typename Callback > | |
| auto | onString (Callback callback) |
| Build a Parser::ValueVisitor that handles String values with a given callback function. | |
| template<typename Callback > | |
| auto | onNumber (Callback callback) |
| Build a Parser::ValueVisitor that handles Number values with a given callback function. | |
| template<typename Callback > | |
| auto | onObject (Callback callback) |
| Build a Parser::ValueVisitor that handles objects with a given callback function. | |
| template<typename Callback > | |
| auto | onArray (Callback callback) |
| Build a Parser::ValueVisitor that handles arrays with a given callback function. | |
| template<typename Callback > | |
| auto | onProperty (Callback callback) |
| Build a Parser::PropertyVisitor that handles object properties with a given callback function. | |
| void | swap (Object &a, Object &b) noexcept |
| template<typename Predicate > | |
| Object::size_type | erase_if (Object &container, Predicate predicate) |
| void | swap (Array &a, Array &b) noexcept |
| template<typename U > | |
| Array::size_type | erase (Array &container, const U &value) |
| template<typename Predicate > | |
| Array::size_type | erase_if (Array &container, Predicate predicate) |
| typedef Monostate donut::json::Null |
JSON null type.
| typedef bool donut::json::Boolean |
JSON boolean type.
| using donut::json::String = typedef std::string |
JSON string type.
| typedef double donut::json::Number |
JSON number type.
| using donut::json::StringParser = typedef Parser<const char8_t*> |
Parser for reading contiguous UTF-8-encoded JSON strings.
| using donut::json::StreamParser = typedef Parser<std::istreambuf_iterator<char> > |
Parser for reading UTF-8-encoded JSON input stream buffers.
|
strong |
Type of a scanned JSON5 token.
|
constexprnoexcept |
Check if a Unicode code point is considered to be whitespace in JSON5.
| codePoint | code point value to check. |
|
constexprnoexcept |
Check if a Unicode code point is considered to be punctuation in JSON5.
| codePoint | code point value to check. |
|
constexprnoexcept |
Check if a Unicode code point marks the beginning of a line terminator sequence in JSON5.
| codePoint | code point value to check. |
|
inline |
Serialize a value of any JSON-serializable type to an output stream.
Write any JSON-serializable value to an output stream using its corresponding implementation of Serializer.
| stream | stream to write the output to. |
| value | value to serialize. |
| options | serialization options, see SerializationOptions. |
| Error | on failure to serialize the value. |
| std::ios_base::failure | if thrown by the output stream. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by a user-defined implementation of Serializer, if one is used in the serialization of the given value type. |
| stream | stream to write into. |
| value | value to write. |
| options | output options, see SerializationOptions. |
| any | exception thrown by the underlying output stream. |
| any | exception thrown by the Serializer implementation of T. |
|
inline |
Deserialize a value of any JSON-serializable type from an input stream.
Read a JSON value from an input stream into any value that is deserializable from JSON using its corresponding implementation of Deserializer.
| stream | stream to read the input from. |
| value | value to deserialize to. |
| options | deserialization options, see DeserializationOptions. |
| Error | on failure to parse the value from the stream. |
| std::ios_base::failure | if thrown by the input stream. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by a user-defined implementation of Deserializer, if one is used in the deserialization of the given value type. |
| stream | stream to read from. |
| value | reference to the output value to write the parsed result to. |
| options | input options, see DeserializationOptions. |
| any | exception thrown by the underlying input stream. |
| any | exception thrown by the Deserializer implementation of T. |
|
inline |
Write a JSON value to an output stream using the default serialization options.
| stream | stream to write the output to. |
| value | the JSON value to serialize. |
| Error | on failure to serialize the value. |
| std::ios_base::failure | if thrown by the output stream. |
| std::bad_alloc | on allocation failure. |
|
inline |
Read a JSON value from an input stream using the default deserialization options.
If the function fails to parse a JSON value from the stream, std::ios_base::failbit is set on the stream, which may or may not cause an exception to be thrown.
| stream | stream to read the input from. |
| value | the JSON value to deserialize to. |
| std::ios_base::failure | if thrown by the input stream. |
| std::bad_alloc | on allocation failure. |
|
inline |
Build a Parser::ValueVisitor that handles Null values with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitNull() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::ValueVisitor that handles Boolean values with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitBoolean() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::ValueVisitor that handles String values with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitString() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::ValueVisitor that handles Number values with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitNumber() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::ValueVisitor that handles objects with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitObject() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::ValueVisitor that handles arrays with a given callback function.
| callback | function object that is callable with the same signature as ValueVisitor::visitArray() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
Build a Parser::PropertyVisitor that handles object properties with a given callback function.
| callback | function object that is callable with the same signature as PropertyVisitor::visitProperty() and has the same semantics. |
| any | exception thrown by the move constructor of the callback type. |
|
inline |
|
inline |
|
inline |