JSON reader context. More...
#include <readerContext.hpp>
Public Member Functions | |
| ReaderContext ()=delete | |
| ReaderContext (const ReaderContext &context)=delete | |
| ReaderContext (ReaderContext &&context)=delete | |
| ReaderContext (std::istream &is, const anch::json::MappingOptions &options) | |
| virtual | ~ReaderContext () noexcept |
| char | discard () |
| void | parseUnknown () |
| bool | next (char ¤t) |
| void | back () |
| void | enterLevel () |
| void | leaveLevel () noexcept |
Public Attributes | |
| std::istream & | input |
| anch::json::MappingOptions | options |
| std::string | pbuf |
| uint32_t | offset |
| std::size_t | bufferSize |
| char * | buffer |
| std::size_t | read |
| std::size_t | depth |
Protected Member Functions | |
| virtual std::streamsize | refillBuffer () |
| void | checkPayloadSize () const |
JSON reader context.
Context is used to store mapping options and deserialization buffers
|
delete |
Forbids ReaderContext default constructor
|
delete |
Forbids ReaderContext copy constructor
| context | the context not to copy |
|
delete |
Forbids ReaderContext move constructor
| context | the context not to move |
| anch::json::ReaderContext::ReaderContext | ( | std::istream & | is, |
| const anch::json::MappingOptions & | options ) |
ReaderContext constructor
| is | the input stream to read |
| options | the mapping options to use |
| anch::json::MappingError | input is bigger than max_payload option |
|
virtualnoexcept |
ReaderContext destructor
Delete buffers
| void anch::json::ReaderContext::back | ( | ) |
Go to previous character.
|
protected |
Check that the number of read characters does not exceed max_payload option (when not 0 )
| anch::json::MappingError | input is bigger than max_payload option |
| char anch::json::ReaderContext::discard | ( | ) |
Discard character until found undiscardable character or fail according to options
| anch::json::MappingError | potential overflow ... |
Enter object or array: increment nesting depth.
Use DepthGuard to leave level automatically.
| anch::json::MappingError | depth is greater than max_depth option (when not 0 ) |
|
noexcept |
Leave object or array: decrement nesting depth.
| bool anch::json::ReaderContext::next | ( | char & | current | ) |
Get next character in buffer.
If buffer has reached its end, it will refill buffer with the input stream.
| current | the character to write in |
true if buffer end has been reached| anch::json::MappingError | no more character available |
Parse unknown value or fail according to options
| anch::json::MappingError | unknown fields are not allowed or parsing error |
|
protectedvirtual |
Refill buffer from input stream
| anch::json::MappingError | input is bigger than max_payload option |
Parser buffer
| std::size_t anch::json::ReaderContext::bufferSize |
Parser buffer size (default to 1024)
| std::size_t anch::json::ReaderContext::depth |
Current nesting depth of objects and arrays
| std::istream& anch::json::ReaderContext::input |
The input stream to parse
| uint32_t anch::json::ReaderContext::offset |
The current offset
Mapping options
| std::string anch::json::ReaderContext::pbuf |
Primitive value buffer
| std::size_t anch::json::ReaderContext::read |
Global number of read characters