AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
ReaderContext Class Reference

JSON reader context. More...

#include <readerContext.hpp>

Inheritance diagram for ReaderContext:
Collaboration diagram for ReaderContext:

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 &current)
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 ()

Detailed Description

JSON reader context.

Context is used to store mapping options and deserialization buffers

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ ReaderContext() [1/4]

Forbids ReaderContext default constructor

◆ ReaderContext() [2/4]

Forbids ReaderContext copy constructor

Parameters
contextthe context not to copy

◆ ReaderContext() [3/4]

Forbids ReaderContext move constructor

Parameters
contextthe context not to move

◆ ReaderContext() [4/4]

anch::json::ReaderContext::ReaderContext ( std::istream & is,
const anch::json::MappingOptions & options )
noexcept

ReaderContext constructor

Parameters
isthe input stream to read
optionsthe mapping options to use

◆ ~ReaderContext()

virtual anch::json::ReaderContext::~ReaderContext ( )
virtualnoexcept

ReaderContext destructor
Delete buffers

Member Function Documentation

◆ back()

Go to previous character.

◆ discard()

Discard character until found undiscardable character or fail according to options

Returns
the next undiscardable character
Exceptions
anch::json::MappingErrorpotential overflow ...

◆ next()

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.

Parameters
currentthe character to write in
Returns
true if buffer end has been reached
Exceptions
anch::json::MappingErrorno more character available

◆ parseUnknown()

Parse unknown value or fail according to options

Exceptions
anch::json::MappingErrorunknown fields are not allowed or parsing error

◆ refillBuffer()

virtual std::streamsize anch::json::ReaderContext::refillBuffer ( )
protectedvirtual

Refill buffer from input stream

Returns
the number of read characters

Member Data Documentation

◆ buffer

Parser buffer

◆ bufferSize

Parser buffer size (default to 1024)

◆ input

The input stream to parse

◆ offset

The current offset

◆ options

◆ pbuf

Primitive value buffer

◆ read

Global number of read characters


The documentation for this class was generated from the following file: