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

JSON reader based on events. More...

#include <reader.hpp>

+ Inheritance diagram for anch::json::Reader:
+ Collaboration diagram for anch::json::Reader:

Public Member Functions

 Reader ()=delete
 
 Reader (const Reader &reader)=delete
 
 Reader (Reader &&reader)=delete
 
 Reader (std::istream &is, const anch::json::MappingOptions &mappingOptions)
 
virtual ~Reader ()
 
void parse () noexcept
 
- Public Member Functions inherited from anch::events::Observable< anch::json::JSONItem >
 Observable ()
 
virtual ~Observable ()
 
bool addObserver (anch::events::Observer< anch::json::JSONItem > &observer)
 
void removeObserver (anch::events::Observer< anch::json::JSONItem > &observer)
 
void notifyObservers (const anch::json::JSONItem &event, const std::map< std::string, std::string > &headers={})
 
void notifyObservers (const anch::events::Event< anch::json::JSONItem > &event)
 
- Public Member Functions inherited from anch::events::Observable< std::streamsize >
 Observable ()
 
virtual ~Observable ()
 
bool addObserver (anch::events::Observer< std::streamsize > &observer)
 
void removeObserver (anch::events::Observer< std::streamsize > &observer)
 
void notifyObservers (const std::streamsize &event, const std::map< std::string, std::string > &headers={})
 
void notifyObservers (const anch::events::Event< std::streamsize > &event)
 
- Public Member Functions inherited from anch::events::Observable< anch::json::MappingError >
 Observable ()
 
virtual ~Observable ()
 
bool addObserver (anch::events::Observer< anch::json::MappingError > &observer)
 
void removeObserver (anch::events::Observer< anch::json::MappingError > &observer)
 
void notifyObservers (const anch::json::MappingError &event, const std::map< std::string, std::string > &headers={})
 
void notifyObservers (const anch::events::Event< anch::json::MappingError > &event)
 

Protected Member Functions

virtual std::streamsize refillBuffer ()
 

Detailed Description

JSON reader based on events.

Context is used to store mapping options and deserialization buffers.
On found JSON elements, observers will be notified with anch::json::JSONItem .
On parsing error, observers will be notified with anch::json::MappingError .

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ Reader() [1/4]

anch::json::Reader::Reader ( )
delete

Forbids Reader default constructor

◆ Reader() [2/4]

anch::json::Reader::Reader ( const Reader & reader)
delete

Forbids Reader copy constructor

Parameters
readerthe reader not to copy
+ Here is the call graph for this function:

◆ Reader() [3/4]

anch::json::Reader::Reader ( Reader && reader)
delete

Forbids Reader move constructor

Parameters
readerthe reader not to move
+ Here is the call graph for this function:

◆ Reader() [4/4]

anch::json::Reader::Reader ( std::istream & is,
const anch::json::MappingOptions & mappingOptions )

Reader constructor

Parameters
isthe input stream to read
optionsthe mapping options to use
Exceptions
anch::json::MappingErrorfail to read input stream

◆ ~Reader()

virtual anch::json::Reader::~Reader ( )
virtual

Reader destructor
Delete buffers

Member Function Documentation

◆ parse()

void anch::json::Reader::parse ( )
noexcept

Parse input stream
Parsing error while be propagate through anch::json::MappingError 's observers

◆ refillBuffer()

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

Refill buffer from input stream.
Notify observers with number of read characters.

Returns
the number of read characters

Reimplemented from anch::json::ReaderContext.

+ Here is the call graph for this function:

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