JSON reader based on events. More...
#include <reader.hpp>
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 |
![]() | |
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) |
![]() | |
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) |
![]() | |
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 () |
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 .
|
delete |
Forbids Reader
default constructor
|
delete |
Forbids Reader
copy constructor
reader | the reader not to copy |
|
delete |
Forbids Reader
move constructor
reader | the reader not to move |
anch::json::Reader::Reader | ( | std::istream & | is, |
const anch::json::MappingOptions & | mappingOptions ) |
Reader
constructor
is | the input stream to read |
options | the mapping options to use |
anch::json::MappingError | fail to read input stream |
|
virtual |
Reader
destructor
Delete buffers
|
noexcept |
Parse input stream
Parsing error while be propagate through anch::json::MappingError 's observers
|
protectedvirtual |
Refill buffer from input stream.
Notify observers with number of read characters.
Reimplemented from anch::json::ReaderContext.