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);
99 bool parse(
const char* beginDoc,
const char* endDoc,
Value& root,
100 bool collectComments =
true);
104 bool parse(
IStream& is,
Value& root,
bool collectComments =
true);
115 String getFormatedErrorMessages() const;
124 String getFormattedErrorMessages() const;
142 bool pushError(const
Value& value, const
String& message);
152 bool pushError(const
Value& value, const
String& message, const
Value& extra);
163 tokenEndOfStream = 0,
174 tokenMemberSeparator,
193 using Errors = std::deque<ErrorInfo>;
195 bool readToken(Token& token);
196 bool readTokenSkippingComments(Token& token);
198 bool match(
const Char* 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, Location& current, Location end,
214 unsigned int& unicode);
215 bool decodeUnicodeEscapeSequence(Token& token, Location& current,
216 Location end,
unsigned int& unicode);
217 bool addError(
const String& message, Token& token, Location extra =
nullptr);
218 bool recoverFromError(TokenType skipUntilToken);
219 bool addErrorAndRecover(
const String& message, Token& token,
220 TokenType skipUntilToken);
221 void skipUntilSpace();
222 Value& currentValue();
224 void getLocationLineAndColumn(Location location,
int& line,
226 String getLocationLineAndColumn(Location location)
const;
229 static bool containsNewLine(Location begin, Location end);
230 static String normalizeEOL(Location begin, Location end);
232 using Nodes = std::stack<Value*>;
239 Location lastValueEnd_{};
243 bool collectComments_{};
273 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
279 std::vector<StructuredError> getStructuredErrors()
const;
287 virtual CharReader* newCharReader()
const = 0;
293 virtual ~
Impl() =
default;
294 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
296 virtual std::vector<StructuredError> getStructuredErrors()
const = 0;
302 std::unique_ptr<Impl> _impl;
436 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
438 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
440 #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.