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) noexcept | |
| virtual | ~ReaderContext () noexcept |
| char | discard () |
| void | parseUnknown () |
| bool | next (char ¤t) |
| void | back () |
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 |
Protected Member Functions | |
| virtual std::streamsize | refillBuffer () |
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 |
|
noexcept |
ReaderContext constructor
| is | the input stream to read |
| options | the mapping options to use |
|
virtualnoexcept |
ReaderContext destructor
Delete buffers
| void anch::json::ReaderContext::back | ( | ) |
Go to previous character.
| char anch::json::ReaderContext::discard | ( | ) |
Discard character until found undiscardable character or fail according to options
| anch::json::MappingError | potential overflow ... |
| 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
Parser buffer
| std::size_t anch::json::ReaderContext::bufferSize |
Parser buffer size (default to 1024)
| 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