Unserialize a JSON document into a Value. More...
#include <reader.h>
Classes | |
class | ErrorInfo |
class | Token |
Public Types | |
typedef char | Char |
typedef const Char * | Location |
Public Member Functions | |
std::string | getFormatedErrorMessages () const |
Returns a user friendly string that list errors in the parsed document. More... | |
bool | parse (const std::string &document, Value &root, bool collectComments=true) |
Read a Value from a JSON document. More... | |
bool | parse (const char *beginDoc, const char *endDoc, Value &root, bool collectComments=true) |
Read a Value from a JSON document. More... | |
bool | parse (std::istream &is, Value &root, bool collectComments=true) |
Parse from input stream. More... | |
Reader () | |
Constructs a Reader allowing all features for parsing. More... | |
Reader (const Features &features) | |
Constructs a Reader allowing the specified feature set for parsing. More... | |
Private Types | |
typedef std::deque< ErrorInfo > | Errors |
typedef std::stack< Value * > | Nodes |
enum | TokenType { tokenEndOfStream = 0, tokenObjectBegin, tokenObjectEnd, tokenArrayBegin, tokenArrayEnd, tokenString, tokenNumber, tokenTrue, tokenFalse, tokenNull, tokenArraySeparator, tokenMemberSeparator, tokenComment, tokenError } |
Private Member Functions | |
void | addComment (Location begin, Location end, CommentPlacement placement) |
bool | addError (const std::string &message, Token &token, Location extra=nullptr) |
bool | addErrorAndRecover (const std::string &message, Token &token, TokenType skipUntilToken) |
Value & | currentValue () |
bool | decodeDouble (Token &token) |
bool | decodeNumber (Token &token) |
bool | decodeString (Token &token) |
bool | decodeString (Token &token, std::string &decoded) |
bool | decodeUnicodeCodePoint (Token &token, Location ¤t, Location end, unsigned int &unicode) |
bool | decodeUnicodeEscapeSequence (Token &token, Location ¤t, Location end, unsigned int &unicode) |
bool | expectToken (TokenType type, Token &token, const char *message) |
void | getLocationLineAndColumn (Location location, int &line, int &column) const |
std::string | getLocationLineAndColumn (Location location) const |
Char | getNextChar () |
bool | match (Location pattern, int patternLength) |
bool | readArray (Token &token) |
bool | readComment () |
bool | readCppStyleComment () |
bool | readCStyleComment () |
void | readNumber () |
bool | readObject (Token &token) |
bool | readString () |
bool | readToken (Token &token) |
bool | readValue () |
bool | recoverFromError (TokenType skipUntilToken) |
void | skipCommentTokens (Token &token) |
void | skipSpaces () |
void | skipUntilSpace () |
Private Attributes | |
Location | begin_ |
bool | collectComments_ |
std::string | commentsBefore_ |
Location | current_ |
std::string | document_ |
Location | end_ |
Errors | errors_ |
Features | features_ |
Value * | lastValue_ |
Location | lastValueEnd_ |
Nodes | nodes_ |
typedef char Json::Reader::Char |
|
private |
typedef const Char* Json::Reader::Location |
|
private |
|
private |
Definition at line 67 of file reader.h.
Json::Reader::Reader | ( | ) |
Constructs a Reader allowing all features for parsing.
Json::Reader::Reader | ( | const Features & | features | ) |
Constructs a Reader allowing the specified feature set for parsing.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
std::string Json::Reader::getFormatedErrorMessages | ( | ) | const |
Returns a user friendly string that list errors in the parsed document.
Referenced by evf::EvFDaqDirector::grabNextJsonFile(), and evf::EvFDaqDirector::grabNextJsonFileAndUnlock().
|
private |
|
private |
|
private |
|
private |
bool Json::Reader::parse | ( | const std::string & | document, |
Value & | root, | ||
bool | collectComments = true |
||
) |
Read a Value from a JSON document.
document | UTF-8 encoded string containing the document to read. |
root | [out] Contains the root value of the document if it was successfully parsed. |
collectComments | true to collect comment and allow writing them back during serialization, false to discard comments. This parameter is ignored if Features::allowComments_ is false . |
true
if the document was successfully parsed, false
if an error occurred. Referenced by jsoncollector::JSONSerializer::deserialize(), evf::EvFDaqDirector::getNFilesFromEoLS(), evf::EvFDaqDirector::grabNextJsonFile(), evf::EvFDaqDirector::grabNextJsonFileAndUnlock(), and evf::EvFDaqDirector::readLastLSEntry().
bool Json::Reader::parse | ( | const char * | beginDoc, |
const char * | endDoc, | ||
Value & | root, | ||
bool | collectComments = true |
||
) |
Read a Value from a JSON document.
document | UTF-8 encoded string containing the document to read. |
root | [out] Contains the root value of the document if it was successfully parsed. |
collectComments | true to collect comment and allow writing them back during serialization, false to discard comments. This parameter is ignored if Features::allowComments_ is false . |
true
if the document was successfully parsed, false
if an error occurred. bool Json::Reader::parse | ( | std::istream & | is, |
Value & | root, | ||
bool | collectComments = true |
||
) |
Parse from input stream.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |