6#ifndef JSON_READER_H_INCLUDED
7#define JSON_READER_H_INCLUDED
9#if !defined(JSON_IS_AMALGAMATION)
21#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
23#pragma warning(disable : 4251)
76 bool parse(
const std::string& document,
Value& root,
77 bool collectComments =
true);
95 bool parse(
const char* beginDoc,
const char* endDoc,
Value& root,
96 bool collectComments =
true);
100 bool parse(
IStream& is,
Value& root,
bool collectComments =
true);
111 String getFormatedErrorMessages() const;
120 String getFormattedErrorMessages() const;
138 bool pushError(const
Value& value, const
String& message);
148 bool pushError(const
Value& value, const
String& message, const
Value& extra);
159 tokenEndOfStream = 0,
170 tokenMemberSeparator,
189 using Errors = std::deque<ErrorInfo>;
191 bool readToken(Token& token);
193 bool match(
const Char* 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,
String& decoded);
206 bool decodeDouble(Token& token);
207 bool decodeDouble(Token& token, Value& decoded);
208 bool decodeUnicodeCodePoint(Token& token, Location& current, Location end,
209 unsigned int& unicode);
210 bool decodeUnicodeEscapeSequence(Token& token, Location& current,
211 Location end,
unsigned int& unicode);
212 bool addError(
const String& message, Token& token, Location extra =
nullptr);
213 bool recoverFromError(TokenType skipUntilToken);
214 bool addErrorAndRecover(
const String& message, Token& token,
215 TokenType skipUntilToken);
216 void skipUntilSpace();
217 Value& currentValue();
219 void getLocationLineAndColumn(Location location,
int& line,
221 String getLocationLineAndColumn(Location location)
const;
223 void skipCommentTokens(Token& token);
225 static bool containsNewLine(Location begin, Location end);
226 static String normalizeEOL(Location begin, Location end);
228 using Nodes = std::stack<Value*>;
235 Location lastValueEnd_{};
239 bool collectComments_{};
263 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
401#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
virtual ~Factory()=default
virtual CharReader * newCharReader() const =0
Allocate a CharReader via operator new().
Build a CharReader implementation.
Json::Value settings_
Configuration of this builder.
~CharReaderBuilder() override
Interface for reading JSON from a char array.
virtual ~CharReader()=default
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, String *errs)=0
Read a Value from a JSON document.
Configuration passed to reader and writer.
Unserialize a JSON document into a Value.
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion.
#define JSONCPP_DEPRECATED(message)
JSON (JavaScript Object Notation).
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
IStream & operator>>(IStream &, Value &)
Read from 'sin' into 'root'.
bool parseFromStream(CharReader::Factory const &, IStream &, Value *root, String *errs)
Consume entire stream and use its begin/end.
An error tagged with where in the JSON text it was encountered.