6#ifndef NIM_CPP_WRAPPER_UTIL_JSON_READER_H_INCLUDED
7#define NIM_CPP_WRAPPER_UTIL_JSON_READER_H_INCLUDED
9#if !defined(JSON_IS_AMALGAMATION)
21#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
23#pragma warning(disable : 4251)
75 bool parse(
const std::string& document,
Value& root,
bool collectComments =
true);
93 bool parse(
const char* beginDoc,
const char* endDoc,
Value& root,
bool collectComments =
true);
97 bool parse(
IStream& is,
Value& root,
bool collectComments =
true);
107 String getFormatedErrorMessages()
const;
116 String getFormattedErrorMessages()
const;
125 std::vector<StructuredError> getStructuredErrors()
const;
134 bool pushError(
const Value& value,
const String& message);
144 bool pushError(
const Value& value,
const String& message,
const Value& extra);
155 tokenEndOfStream = 0,
187 bool readToken(
Token& token);
189 bool match(
const Char* pattern,
int patternLength);
191 bool readCStyleComment();
192 bool readCppStyleComment();
196 bool readObject(
Token& token);
197 bool readArray(
Token& token);
198 bool decodeNumber(
Token& token);
199 bool decodeNumber(
Token& token,
Value& decoded);
200 bool decodeString(
Token& token);
202 bool decodeDouble(
Token& token);
203 bool decodeDouble(
Token& token,
Value& decoded);
205 bool decodeUnicodeEscapeSequence(
Token& token,
Location& current,
Location end,
unsigned int& unicode);
207 bool recoverFromError(
TokenType skipUntilToken);
210 Value& currentValue();
212 void getLocationLineAndColumn(
Location location,
int& line,
int& column)
const;
215 void skipCommentTokens(
Token& token);
231 bool collectComments_{};
255 virtual bool parse(
char const* beginDoc,
char const* endDoc,
Value* root,
String* errs) = 0;
389#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
virtual CharReader * newCharReader() const =0
Allocate a CharReader via operator new().
virtual ~Factory()=default
Build a CharReader implementation.
Definition reader.h:279
~CharReaderBuilder() override
nim_cpp_wrapper_util::Json::Value settings_
Definition reader.h:322
virtual ~CharReader()=default
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, String *errs)=0
Read a Value from a JSON document. The document must be a UTF-8 encoded string containing the documen...
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
Definition json_features.h:22
Token token_
Definition reader.h:180
Location extra_
Definition reader.h:182
String message_
Definition reader.h:181
Location start_
Definition reader.h:174
Location end_
Definition reader.h:175
TokenType type_
Definition reader.h:173
Unserialize a JSON document into a Value.
Definition reader.h:37
TokenType
Definition reader.h:154
@ tokenFalse
Definition reader.h:163
@ tokenNull
Definition reader.h:164
@ tokenObjectEnd
Definition reader.h:157
@ tokenMemberSeparator
Definition reader.h:166
@ tokenString
Definition reader.h:160
@ tokenNumber
Definition reader.h:161
@ tokenComment
Definition reader.h:167
@ tokenTrue
Definition reader.h:162
@ tokenArrayEnd
Definition reader.h:159
@ tokenArraySeparator
Definition reader.h:165
@ tokenObjectBegin
Definition reader.h:156
@ tokenArrayBegin
Definition reader.h:158
String commentsBefore_
Definition reader.h:229
String document_
Definition reader.h:223
std::stack< Value * > Nodes
Definition reader.h:220
const Char * Location
Definition reader.h:40
char Char
Definition reader.h:39
Nodes nodes_
Definition reader.h:221
std::deque< ErrorInfo > Errors
Definition reader.h:185
Errors errors_
Definition reader.h:222
Features features_
Definition reader.h:230
Represents a JSON value.
Definition value.h:196
#define JSON_API
Definition config.h:50
CommentPlacement
Definition value.h:120
bool JSON_API parseFromStream(CharReader::Factory const &, IStream &, Value *root, String *errs)
Definition json_reader.cpp:1905
JSON_API IStream & operator>>(IStream &, Value &)
Read from 'sin' into 'root'.
Definition json_reader.cpp:1916
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
Definition config.h:110
std::istream IStream
Definition config.h:113
JSON (JavaScript Object Notation).
Definition allocator.h:14
An error tagged with where in the JSON text it was encountered.
Definition reader.h:47
String message
Definition reader.h:50
ptrdiff_t offset_limit
Definition reader.h:49
ptrdiff_t offset_start
Definition reader.h:48