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)
75 parse(
const std::string& document,
Value& root,
bool collectComments =
true);
95 bool parse(
const char* beginDoc,
98 bool collectComments =
true);
102 bool parse(std::istream& is,
Value& root,
bool collectComments =
true);
114 std::
string getFormatedErrorMessages() const;
124 std::
string getFormattedErrorMessages() const;
141 bool pushError(const
Value& value, const std::
string& message);
150 bool pushError(const
Value& value, const std::
string& message, const
Value& extra);
160 tokenEndOfStream = 0,
171 tokenMemberSeparator,
186 std::string message_;
190 typedef std::deque<ErrorInfo> Errors;
192 bool readToken(Token& token);
194 bool match(Location pattern,
int patternLength);
196 bool readCStyleComment();
197 bool readCppStyleComment();
201 bool readObject(Token& token);
202 bool readArray(Token& token);
203 bool decodeNumber(Token& token);
204 bool decodeNumber(Token& token, Value& decoded);
205 bool decodeString(Token& token);
206 bool decodeString(Token& token, std::string& decoded);
207 bool decodeDouble(Token& token);
208 bool decodeDouble(Token& token, Value& decoded);
209 bool decodeUnicodeCodePoint(Token& token,
212 unsigned int& unicode);
213 bool decodeUnicodeEscapeSequence(Token& token,
216 unsigned int& unicode);
217 bool addError(
const std::string& message, Token& token, Location extra = 0);
218 bool recoverFromError(TokenType skipUntilToken);
219 bool addErrorAndRecover(
const std::string& message,
221 TokenType skipUntilToken);
222 void skipUntilSpace();
223 Value& currentValue();
226 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
227 std::string getLocationLineAndColumn(Location location)
const;
229 void skipCommentTokens(Token& token);
231 typedef std::stack<Value*> Nodes;
234 std::string document_;
238 Location lastValueEnd_;
240 std::string commentsBefore_;
242 bool collectComments_;
268 char const* beginDoc,
char const* endDoc,
269 Value* root, std::string* errs) = 0;
277 virtual CharReader* newCharReader()
const = 0;
347 Value& operator[](std::string key);
370 Value* root, std::string* errs);
400 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
402 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
404 #endif // CPPTL_JSON_READER_H_INCLUDED