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)
79 parse(const std::
string& document,
Value& root,
bool collectComments = true);
99 bool parse(const
char* beginDoc,
102 bool collectComments = true);
106 bool parse(
IStream& is,
Value& root,
bool collectComments = true);
118 String getFormatedErrorMessages() const;
128 String getFormattedErrorMessages() const;
145 bool pushError(const
Value& value, const
String& message);
154 bool pushError(const
Value& value, const
String& message, const
Value& extra);
164 tokenEndOfStream = 0,
175 tokenMemberSeparator,
194 typedef std::deque<ErrorInfo> Errors;
196 bool readToken(Token& token);
198 bool match(Location pattern,
int patternLength);
200 bool readCStyleComment();
201 bool readCppStyleComment();
205 bool readObject(Token& token);
206 bool readArray(Token& token);
207 bool decodeNumber(Token& token);
208 bool decodeNumber(Token& token, Value& decoded);
209 bool decodeString(Token& token);
210 bool decodeString(Token& token,
String& decoded);
211 bool decodeDouble(Token& token);
212 bool decodeDouble(Token& token, Value& decoded);
213 bool decodeUnicodeCodePoint(Token& token,
216 unsigned int& unicode);
217 bool decodeUnicodeEscapeSequence(Token& token,
220 unsigned int& unicode);
221 bool addError(
const String& message, Token& token, Location extra =
nullptr);
222 bool recoverFromError(TokenType skipUntilToken);
223 bool addErrorAndRecover(
const String& message,
225 TokenType skipUntilToken);
226 void skipUntilSpace();
227 Value& currentValue();
230 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
231 String getLocationLineAndColumn(Location location)
const;
233 void skipCommentTokens(Token& token);
235 static bool containsNewLine(Location begin, Location end);
236 static String normalizeEOL(Location begin, Location end);
238 typedef std::stack<Value*> Nodes;
245 Location lastValueEnd_{};
249 bool collectComments_{};
275 virtual bool parse(
char const* beginDoc,
286 virtual CharReader* newCharReader()
const = 0;
413 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
415 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
417 #endif // CPPTL_JSON_READER_H_INCLUDED