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

JSON mapper context. More...

#include <readerContext.hpp>

+ Inheritance diagram for anch::json::ReaderContext:
+ Collaboration diagram for anch::json::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 mapper context.

Context is used to store mapping options and deserialization buffers

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ ReaderContext() [1/4]

anch::json::ReaderContext::ReaderContext ( )
delete

Forbids ReaderContext default constructor

◆ ReaderContext() [2/4]

anch::json::ReaderContext::ReaderContext ( const ReaderContext & context)
delete

Forbids ReaderContext copy constructor

Parameters
contextthe context not to copy
+ Here is the call graph for this function:

◆ ReaderContext() [3/4]

anch::json::ReaderContext::ReaderContext ( ReaderContext && context)
delete

Forbids ReaderContext move constructor

Parameters
contextthe context not to move
+ Here is the call graph for this function:

◆ 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()

void anch::json::ReaderContext::back ( )

Go to previous character.

+ Here is the call graph for this function:

◆ discard()

char anch::json::ReaderContext::discard ( )

Discard character until found undiscardable character or fail according to options

Returns
the next undiscardable character
Exceptions
anch::json::MappingErrorpotential overflow ...
+ Here is the call graph for this function:

◆ 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
+ Here is the call graph for this function:

◆ parseUnknown()

void anch::json::ReaderContext::parseUnknown ( )

Parse unknown value or fail according to options

Exceptions
anch::json::MappingErrorunknown fields are not allowed or parsing error
+ Here is the call graph for this function:

◆ refillBuffer()

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

Refill buffer from input stream

Returns
the number of read characters

Reimplemented in anch::json::Reader.

+ Here is the call graph for this function:

Member Data Documentation

◆ buffer

char* anch::json::ReaderContext::buffer

Parser buffer

◆ bufferSize

std::size_t anch::json::ReaderContext::bufferSize

Parser buffer size (default to 1024)

◆ input

std::istream& anch::json::ReaderContext::input

The input stream to parse

◆ offset

uint32_t anch::json::ReaderContext::offset

The current offset

◆ options

anch::json::MappingOptions anch::json::ReaderContext::options

Mapping options

◆ pbuf

std::string anch::json::ReaderContext::pbuf

Primitive value buffer

◆ read

std::size_t anch::json::ReaderContext::read

Global number of read characters


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