6 #ifndef JSON_READER_H_INCLUDED
7 #define 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)
77 bool parse(
const std::string& document,
Value& root,
78 bool collectComments =
true);
96 bool parse(
const char* beginDoc,
const char* endDoc,
Value& root,
97 bool collectComments =
true);
101 bool parse(
IStream& is,
Value& root,
bool collectComments =
true);
112 String getFormatedErrorMessages() const;
121 String getFormattedErrorMessages() const;
139 bool pushError(const
Value& value, const
String& message);
149 bool pushError(const
Value& value, const
String& message, const
Value& extra);
160 tokenEndOfStream = 0,
171 tokenMemberSeparator,
190 using Errors = std::deque<ErrorInfo>;
192 bool readToken(Token& token);
193 bool readTokenSkippingComments(Token& token);
195 bool match(
const Char* pattern,
int patternLength);
197 bool readCStyleComment();
198 bool readCppStyleComment();
202 bool readObject(Token& token);
203 bool readArray(Token& token);
204 bool decodeNumber(Token& token);
205 bool decodeNumber(Token& token, Value& decoded);
206 bool decodeString(Token& token);
207 bool decodeString(Token& token,
String& decoded);
208 bool decodeDouble(Token& token);
209 bool decodeDouble(Token& token, Value& decoded);
210 bool decodeUnicodeCodePoint(Token& token, Location& current, Location end,
211 unsigned int& unicode);
212 bool decodeUnicodeEscapeSequence(Token& token, Location& current,
213 Location end,
unsigned int& unicode);
214 bool addError(
const String& message, Token& token, Location extra =
nullptr);
215 bool recoverFromError(TokenType skipUntilToken);
216 bool addErrorAndRecover(
const String& message, Token& token,
217 TokenType skipUntilToken);
218 void skipUntilSpace();
219 Value& currentValue();
221 void getLocationLineAndColumn(Location location,
int& line,
223 String getLocationLineAndColumn(Location location)
const;
226 static bool containsNewLine(Location begin, Location end);
227 static String normalizeEOL(Location begin, Location end);
229 using Nodes = std::stack<Value*>;
236 Location lastValueEnd_{};
240 bool collectComments_{};
270 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
276 std::vector<StructuredError> getStructuredErrors()
const;
284 virtual CharReader* newCharReader()
const = 0;
290 virtual ~
Impl() =
default;
291 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
293 virtual std::vector<StructuredError> getStructuredErrors()
const = 0;
299 std::unique_ptr<Impl> _impl;
433 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
435 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
437 #endif // JSON_READER_H_INCLUDED
#define JSONCPP_DEPRECATED(message)
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion...
Json::Value settings_
Configuration of this builder.
CharReader(std::unique_ptr< Impl > impl)
std::basic_string< char, std::char_traits< char >, Allocator< char >> String
An error tagged with where in the JSON text it was encountered.
IStream & operator>>(IStream &, Value &)
Read from 'sin' into 'root'.
JSON (JavaScript Object Notation).
Interface for reading JSON from a char array.
Unserialize a JSON document into a Value.
bool parseFromStream(CharReader::Factory const &, IStream &, Value *root, String *errs)
Consume entire stream and use its begin/end.
Build a CharReader implementation.
Configuration passed to reader and writer.