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)
20 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
22 #pragma warning(disable : 4251)
23 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
73 parse(
const std::string& document,
Value& root,
bool collectComments =
true);
93 bool parse(
const char* beginDoc,
96 bool collectComments =
true);
100 bool parse(std::istream& is,
Value& root,
bool collectComments =
true);
112 std::
string getFormatedErrorMessages() const;
122 std::
string getFormattedErrorMessages() const;
139 bool pushError(const
Value& value, const std::
string& message);
148 bool pushError(const
Value& value, const std::
string& message, const
Value& extra);
158 tokenEndOfStream = 0,
169 tokenMemberSeparator,
184 std::string message_;
188 typedef std::deque<ErrorInfo> Errors;
190 bool expectToken(TokenType type, Token& token,
const char* message);
191 bool readToken(Token& token);
193 bool match(Location pattern,
int patternLength);
195 bool readCStyleComment();
196 bool readCppStyleComment();
200 bool readObject(Token& token);
201 bool readArray(Token& token);
202 bool decodeNumber(Token& token);
203 bool decodeNumber(Token& token, Value& decoded);
204 bool decodeString(Token& token);
205 bool decodeString(Token& token, std::string& decoded);
206 bool decodeDouble(Token& token);
207 bool decodeDouble(Token& token, Value& decoded);
208 bool decodeUnicodeCodePoint(Token& token,
211 unsigned int& unicode);
212 bool decodeUnicodeEscapeSequence(Token& token,
215 unsigned int& unicode);
216 bool addError(
const std::string& message, Token& token, Location extra = 0);
217 bool recoverFromError(TokenType skipUntilToken);
218 bool addErrorAndRecover(
const std::string& message,
220 TokenType skipUntilToken);
221 void skipUntilSpace();
222 Value& currentValue();
225 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
226 std::string getLocationLineAndColumn(Location location)
const;
228 void skipCommentTokens(Token& token);
230 typedef std::stack<Value*> Nodes;
233 std::string document_;
237 Location lastValueEnd_;
239 std::string commentsBefore_;
241 bool collectComments_;
272 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
274 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
276 #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...
std::istream & operator>>(std::istream &, Value &)
Read from 'sin' into 'root'.
An error tagged with where in the JSON text it was encountered.
Unserialize a JSON document into a Value.
Configuration passed to reader and writer.