6 #ifndef CPPTL_JSON_READER_H_INCLUDED
7 #define CPPTL_JSON_READER_H_INCLUDED
9 #if !defined(JSON_IS_AMALGAMATION)
12 #endif // if !defined(JSON_IS_AMALGAMATION)
21 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
23 #pragma warning(disable : 4251)
24 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
63 parse(
const std::string& document,
Value& root,
bool collectComments =
true);
83 bool parse(
const char* beginDoc,
86 bool collectComments =
true);
90 bool parse(std::istream& is,
Value& root,
bool collectComments =
true);
102 std::
string getFormatedErrorMessages() const;
112 std::
string getFormattedErrorMessages() const;
116 tokenEndOfStream = 0,
127 tokenMemberSeparator,
142 std::string message_;
146 typedef std::deque<ErrorInfo> Errors;
148 bool readToken(Token& token);
150 bool match(Location pattern,
int patternLength);
152 bool readCStyleComment();
153 bool readCppStyleComment();
157 bool readObject(Token& token);
158 bool readArray(Token& token);
159 bool decodeNumber(Token& token);
160 bool decodeNumber(Token& token, Value& decoded);
161 bool decodeString(Token& token);
162 bool decodeString(Token& token, std::string& decoded);
163 bool decodeDouble(Token& token);
164 bool decodeDouble(Token& token, Value& decoded);
165 bool decodeUnicodeCodePoint(Token& token,
168 unsigned int& unicode);
169 bool decodeUnicodeEscapeSequence(Token& token,
172 unsigned int& unicode);
173 bool addError(
const std::string& message, Token& token, Location extra = 0);
174 bool recoverFromError(TokenType skipUntilToken);
175 bool addErrorAndRecover(
const std::string& message,
177 TokenType skipUntilToken);
178 void skipUntilSpace();
179 Value& currentValue();
182 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
183 std::string getLocationLineAndColumn(Location location)
const;
185 void skipCommentTokens(Token& token);
187 typedef std::stack<Value*> Nodes;
190 std::string document_;
194 Location lastValueEnd_;
196 std::string commentsBefore_;
198 bool collectComments_;
224 char const* beginDoc,
char const* endDoc,
225 Value* root, std::string* errs) = 0;
233 virtual CharReader* newCharReader()
const = 0;
300 Value& operator[](std::string key);
323 Value* root, std::string* errs);
353 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
355 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
357 #endif // CPPTL_JSON_READER_H_INCLUDED
#define JSONCPP_DEPRECATED(message)
#define JSON_API
If defined, indicates that the source file is amalgated to prevent private header inclusion...
bool parseFromStream(CharReader::Factory const &, std::istream &, Value *root, std::string *errs)
Consume entire stream and use its begin/end.
Json::Value settings_
Configuration of this builder.
std::istream & operator>>(std::istream &, Value &)
Read from 'sin' into 'root'.
Interface for reading JSON from a char array.
Unserialize a JSON document into a Value.
Build a CharReader implementation.
Configuration passed to reader and writer.