|
xrpld
|
Unserialize a JSON document into a Value. More...
#include <json_reader.h>

Classes | |
| class | Token |
| class | ErrorInfo |
Public Types | |
| using | Char = char |
| using | Location = Char const* |
Public Member Functions | |
| Reader ()=default | |
| Constructs a Reader allowing all features for parsing. | |
| bool | parse (std::string const &document, Value &root) |
| Read a Value from a JSON document. | |
| bool | parse (char const *beginDoc, char const *endDoc, Value &root) |
| Read a Value from a JSON document. | |
| bool | parse (std::istream &is, Value &root) |
| Parse from input stream. | |
| template<class BufferSequence> | |
| bool | parse (Value &root, BufferSequence const &bs) |
| Read a Value from a JSON buffer sequence. | |
| std::string | getFormattedErrorMessages () const |
| Returns a user friendly string that list errors in the parsed document. | |
Static Public Attributes | |
| static constexpr unsigned | kNestLimit {25} |
Private Types | |
| enum class | TokenType { EndOfStream = 0 , ObjectBegin , ObjectEnd , ArrayBegin , ArrayEnd , String , Integer , Double , True , False , Null , ArraySeparator , MemberSeparator , Comment , Error } |
| using | Errors = std::deque<ErrorInfo> |
| using | Nodes = std::stack<Value*> |
Private Member Functions | |
| bool | expectToken (TokenType type, Token &token, char const *message) |
| bool | readToken (Token &token) |
| void | skipSpaces () |
| bool | match (Location pattern, int patternLength) |
| bool | readComment () |
| bool | readCStyleComment () |
| bool | readCppStyleComment () |
| bool | readString () |
| Reader::TokenType | readNumber () |
| bool | readValue (unsigned depth) |
| bool | readObject (Token &token, unsigned depth) |
| bool | readArray (Token &token, unsigned depth) |
| bool | decodeNumber (Token &token) |
| bool | decodeString (Token &token) |
| bool | decodeString (Token &token, std::string &decoded) |
| bool | decodeDouble (Token &token) |
| bool | decodeUnicodeCodePoint (Token &token, Location ¤t, Location end, unsigned int &unicode) |
| bool | decodeUnicodeEscapeSequence (Token &token, Location ¤t, Location end, unsigned int &unicode) |
| bool | addError (std::string const &message, Token &token, Location extra=nullptr) |
| bool | recoverFromError (TokenType skipUntilToken) |
| bool | addErrorAndRecover (std::string const &message, Token &token, TokenType skipUntilToken) |
| void | skipUntilSpace () |
| Value & | currentValue () |
| Char | getNextChar () |
| void | getLocationLineAndColumn (Location location, int &line, int &column) const |
| std::string | getLocationLineAndColumn (Location location) const |
| void | skipCommentTokens (Token &token) |
Private Attributes | |
| Nodes | nodes_ |
| Errors | errors_ |
| std::string | document_ |
| Location | begin_ {} |
| Location | end_ {} |
| Location | current_ {} |
| Location | lastValueEnd_ {} |
| Value * | lastValue_ {} |
Unserialize a JSON document into a Value.
Definition at line 19 of file json_reader.h.
| using json::Reader::Char = char |
Definition at line 22 of file json_reader.h.
| using json::Reader::Location = Char const* |
Definition at line 23 of file json_reader.h.
|
private |
Definition at line 121 of file json_reader.h.
|
private |
Definition at line 182 of file json_reader.h.
|
strongprivate |
| Enumerator | |
|---|---|
| EndOfStream | |
| ObjectBegin | |
| ObjectEnd | |
| ArrayBegin | |
| ArrayEnd | |
| String | |
| Integer | |
| Double | |
| True | |
| False | |
| Null | |
| ArraySeparator | |
| MemberSeparator | |
| Comment | |
| Error | |
Definition at line 83 of file json_reader.h.
|
default |
Constructs a Reader allowing all features for parsing.
| bool json::Reader::parse | ( | std::string const & | document, |
| Value & | root ) |
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. |
true if the document was successfully parsed, false if an error occurred. Definition at line 63 of file json_reader.cpp.
| bool json::Reader::parse | ( | char const * | beginDoc, |
| char const * | endDoc, | ||
| Value & | root ) |
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. |
true if the document was successfully parsed, false if an error occurred. Definition at line 87 of file json_reader.cpp.
| bool json::Reader::parse | ( | std::istream & | is, |
| Value & | root ) |
Parse from input stream.
Definition at line 72 of file json_reader.cpp.
| bool json::Reader::parse | ( | Value & | root, |
| BufferSequence const & | bs ) |
Read a Value from a JSON buffer sequence.
| root | [out] Contains the root value of the document if it was successfully parsed. |
| - | encoded buffer sequence. |
true if the buffer was successfully parsed, false if an error occurred. Definition at line 195 of file json_reader.h.
|
nodiscard |
Returns a user friendly string that list errors in the parsed document.
Definition at line 899 of file json_reader.cpp.
Definition at line 178 of file json_reader.cpp.
|
private |
Definition at line 189 of file json_reader.cpp.
|
private |
Definition at line 278 of file json_reader.cpp.
|
private |
Definition at line 296 of file json_reader.cpp.
|
private |
Definition at line 314 of file json_reader.cpp.
|
private |
Definition at line 328 of file json_reader.cpp.
|
private |
Definition at line 342 of file json_reader.cpp.
|
private |
Definition at line 387 of file json_reader.cpp.
|
private |
Definition at line 356 of file json_reader.cpp.
|
private |
Definition at line 119 of file json_reader.cpp.
|
private |
Definition at line 409 of file json_reader.cpp.
|
private |
Definition at line 479 of file json_reader.cpp.
|
private |
Definition at line 529 of file json_reader.cpp.
|
private |
Definition at line 633 of file json_reader.cpp.
|
private |
Definition at line 645 of file json_reader.cpp.
|
private |
Definition at line 608 of file json_reader.cpp.
|
private |
Definition at line 724 of file json_reader.cpp.
|
private |
Definition at line 763 of file json_reader.cpp.
|
private |
Definition at line 808 of file json_reader.cpp.
|
private |
Definition at line 819 of file json_reader.cpp.
|
private |
Definition at line 838 of file json_reader.cpp.
|
private |
|
private |
Definition at line 845 of file json_reader.cpp.
|
private |
Definition at line 851 of file json_reader.cpp.
|
private |
Definition at line 860 of file json_reader.cpp.
|
private |
Definition at line 891 of file json_reader.cpp.
|
private |
Definition at line 169 of file json_reader.cpp.
|
staticconstexpr |
Definition at line 80 of file json_reader.h.
|
private |
Definition at line 183 of file json_reader.h.
|
private |
Definition at line 184 of file json_reader.h.
|
private |
Definition at line 185 of file json_reader.h.
|
private |
Definition at line 186 of file json_reader.h.
|
private |
Definition at line 187 of file json_reader.h.
|
private |
Definition at line 188 of file json_reader.h.
|
private |
Definition at line 189 of file json_reader.h.
|
private |
Definition at line 190 of file json_reader.h.