blob: f8158cfdb3be6e100533d7ad4556f7581843ed27 [file] [log] [blame]
Devin Jeanpierre59e4d352017-07-21 03:44:36 -07001// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +00002// Distributed under MIT license, or public domain if desired and
3// recognized in your jurisdiction.
4// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
Christopher Dunn6d135cb2007-06-13 15:51:04 +00006#ifndef CPPTL_JSON_READER_H_INCLUDED
Aaron Jacobs9fa4e842014-07-01 08:48:54 +10007#define CPPTL_JSON_READER_H_INCLUDED
Christopher Dunn6d135cb2007-06-13 15:51:04 +00008
Baptiste Lepilleureadc4782011-05-02 21:09:30 +00009#if !defined(JSON_IS_AMALGAMATION)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100010#include "features.h"
11#include "value.h"
Baptiste Lepilleureadc4782011-05-02 21:09:30 +000012#endif // if !defined(JSON_IS_AMALGAMATION)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100013#include <deque>
14#include <iosfwd>
Billy Donahueb5e1fe82018-05-20 16:55:27 -040015#include <istream>
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100016#include <stack>
17#include <string>
Christopher Dunn6d135cb2007-06-13 15:51:04 +000018
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100019// Disable warning C4251: <data member>: <type> needs to have dll-interface to
20// be used by...
Baptiste Lepilleureafd7022013-05-08 20:21:11 +000021#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100022#pragma warning(push)
23#pragma warning(disable : 4251)
Baptiste Lepilleureafd7022013-05-08 20:21:11 +000024#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
25
Sergiy80d6e666f2016-12-03 22:29:14 +020026#pragma pack(push, 8)
27
dota17b27c83f2019-07-18 04:35:33 +080028#if defined(_MSC_VER)
29#pragma warning(disable : 4996)
30#endif
31
Christopher Dunn6d135cb2007-06-13 15:51:04 +000032namespace Json {
33
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100034/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
Billy Donahue483eba82019-07-14 18:41:48 -040035 * Value.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100036 *
Christopher Dunn8df98f62015-02-09 11:15:39 -060037 * \deprecated Use CharReader and CharReaderBuilder.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100038 */
dota17b27c83f2019-07-18 04:35:33 +080039class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_API Reader {
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100040public:
41 typedef char Char;
Aaron Jacobs11086dd2014-09-15 10:15:29 +100042 typedef const Char* Location;
Christopher Dunn6d135cb2007-06-13 15:51:04 +000043
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100044 /** \brief An error tagged with where in the JSON text it was encountered.
45 *
46 * The offsets give the [start, limit) range of bytes within the text. Note
47 * that this is bytes, not codepoints.
Christopher Dunn6d135cb2007-06-13 15:51:04 +000048 */
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100049 struct StructuredError {
Christopher Dunnd4513fc2016-02-06 09:25:20 -060050 ptrdiff_t offset_start;
51 ptrdiff_t offset_limit;
Billy Donahue1c2ed7a2019-01-17 16:35:29 -050052 String message;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100053 };
54
Billy Donahue483eba82019-07-14 18:41:48 -040055 /** \brief Constructs a Reader allowing all features for parsing.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100056 */
57 Reader();
58
Billy Donahue483eba82019-07-14 18:41:48 -040059 /** \brief Constructs a Reader allowing the specified feature set for parsing.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100060 */
Aaron Jacobs11086dd2014-09-15 10:15:29 +100061 Reader(const Features& features);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100062
63 /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
64 * document.
Billy Donahue483eba82019-07-14 18:41:48 -040065 *
66 * \param document UTF-8 encoded string containing the document
67 * to read.
68 * \param[out] root Contains the root value of the document if it
69 * was successfully parsed.
70 * \param collectComments \c true to collect comment and allow writing
71 * them back during serialization, \c false to
72 * discard comments. This parameter is ignored
73 * if Features::allowComments_ is \c false.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100074 * \return \c true if the document was successfully parsed, \c false if an
75 * error occurred.
76 */
77 bool
Aaron Jacobs11086dd2014-09-15 10:15:29 +100078 parse(const std::string& document, Value& root, bool collectComments = true);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100079
80 /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
Billy Donahue483eba82019-07-14 18:41:48 -040081 * document.
82 *
83 * \param beginDoc Pointer on the beginning of the UTF-8 encoded
84 * string of the document to read.
85 * \param endDoc Pointer on the end of the UTF-8 encoded string
86 * of the document to read. Must be >= beginDoc.
87 * \param[out] root Contains the root value of the document if it
88 * was successfully parsed.
89 * \param collectComments \c true to collect comment and allow writing
90 * them back during serialization, \c false to
91 * discard comments. This parameter is ignored
92 * if Features::allowComments_ is \c false.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100093 * \return \c true if the document was successfully parsed, \c false if an
Billy Donahue483eba82019-07-14 18:41:48 -040094 * error occurred.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100095 */
Aaron Jacobs11086dd2014-09-15 10:15:29 +100096 bool parse(const char* beginDoc,
97 const char* endDoc,
98 Value& root,
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100099 bool collectComments = true);
100
101 /// \brief Parse from input stream.
102 /// \see Json::operator>>(std::istream&, Json::Value&).
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500103 bool parse(IStream& is, Value& root, bool collectComments = true);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000104
105 /** \brief Returns a user friendly string that list errors in the parsed
106 * document.
Billy Donahue483eba82019-07-14 18:41:48 -0400107 *
108 * \return Formatted error message with the list of errors with their
109 * location in the parsed document. An empty string is returned if no error
110 * occurred during parsing.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000111 * \deprecated Use getFormattedErrorMessages() instead (typo fix).
112 */
dota17b27c83f2019-07-18 04:35:33 +0800113 [[deprecated("Use getFormattedErrorMessages() instead.")]]
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500114 String getFormatedErrorMessages() const;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000115
116 /** \brief Returns a user friendly string that list errors in the parsed
117 * document.
Billy Donahue483eba82019-07-14 18:41:48 -0400118 *
119 * \return Formatted error message with the list of errors with their
120 * location in the parsed document. An empty string is returned if no error
121 * occurred during parsing.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000122 */
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500123 String getFormattedErrorMessages() const;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000124
125 /** \brief Returns a vector of structured erros encounted while parsing.
Billy Donahue483eba82019-07-14 18:41:48 -0400126 *
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000127 * \return A (possibly empty) vector of StructuredError objects. Currently
Billy Donahue483eba82019-07-14 18:41:48 -0400128 * only one error can be returned, but the caller should tolerate multiple
129 * errors. This can occur if the parser recovers from a non-fatal parse
130 * error and then encounters additional errors.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000131 */
132 std::vector<StructuredError> getStructuredErrors() const;
133
Mara Kimb84a39c2014-10-23 02:03:43 -0500134 /** \brief Add a semantic error message.
Billy Donahue483eba82019-07-14 18:41:48 -0400135 *
136 * \param value JSON Value location associated with the error
Mara Kimb84a39c2014-10-23 02:03:43 -0500137 * \param message The error message.
Billy Donahue483eba82019-07-14 18:41:48 -0400138 * \return \c true if the error was successfully added, \c false if the Value
139 * offset exceeds the document size.
Mara Kimb84a39c2014-10-23 02:03:43 -0500140 */
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500141 bool pushError(const Value& value, const String& message);
Mara Kimb84a39c2014-10-23 02:03:43 -0500142
143 /** \brief Add a semantic error message with extra context.
Billy Donahue483eba82019-07-14 18:41:48 -0400144 *
145 * \param value JSON Value location associated with the error
Mara Kimb84a39c2014-10-23 02:03:43 -0500146 * \param message The error message.
Billy Donahue483eba82019-07-14 18:41:48 -0400147 * \param extra Additional JSON Value location to contextualize the error
Mara Kimb84a39c2014-10-23 02:03:43 -0500148 * \return \c true if the error was successfully added, \c false if either
149 * Value offset exceeds the document size.
150 */
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500151 bool pushError(const Value& value, const String& message, const Value& extra);
Mara Kimb84a39c2014-10-23 02:03:43 -0500152
153 /** \brief Return whether there are any errors.
Billy Donahue483eba82019-07-14 18:41:48 -0400154 *
155 * \return \c true if there are no errors to report \c false if errors have
156 * occurred.
Mara Kimb84a39c2014-10-23 02:03:43 -0500157 */
158 bool good() const;
159
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000160private:
161 enum TokenType {
162 tokenEndOfStream = 0,
163 tokenObjectBegin,
164 tokenObjectEnd,
165 tokenArrayBegin,
166 tokenArrayEnd,
167 tokenString,
168 tokenNumber,
169 tokenTrue,
170 tokenFalse,
171 tokenNull,
172 tokenArraySeparator,
173 tokenMemberSeparator,
174 tokenComment,
175 tokenError
176 };
177
178 class Token {
179 public:
180 TokenType type_;
181 Location start_;
182 Location end_;
183 };
184
185 class ErrorInfo {
186 public:
187 Token token_;
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500188 String message_;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000189 Location extra_;
190 };
191
192 typedef std::deque<ErrorInfo> Errors;
193
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000194 bool readToken(Token& token);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000195 void skipSpaces();
196 bool match(Location pattern, int patternLength);
197 bool readComment();
198 bool readCStyleComment();
199 bool readCppStyleComment();
200 bool readString();
201 void readNumber();
202 bool readValue();
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000203 bool readObject(Token& token);
204 bool readArray(Token& token);
205 bool decodeNumber(Token& token);
206 bool decodeNumber(Token& token, Value& decoded);
207 bool decodeString(Token& token);
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500208 bool decodeString(Token& token, String& decoded);
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000209 bool decodeDouble(Token& token);
210 bool decodeDouble(Token& token, Value& decoded);
211 bool decodeUnicodeCodePoint(Token& token,
212 Location& current,
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000213 Location end,
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000214 unsigned int& unicode);
215 bool decodeUnicodeEscapeSequence(Token& token,
216 Location& current,
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000217 Location end,
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000218 unsigned int& unicode);
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500219 bool addError(const String& message, Token& token, Location extra = nullptr);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000220 bool recoverFromError(TokenType skipUntilToken);
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500221 bool addErrorAndRecover(const String& message,
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000222 Token& token,
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000223 TokenType skipUntilToken);
224 void skipUntilSpace();
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000225 Value& currentValue();
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000226 Char getNextChar();
227 void
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000228 getLocationLineAndColumn(Location location, int& line, int& column) const;
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500229 String getLocationLineAndColumn(Location location) const;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000230 void addComment(Location begin, Location end, CommentPlacement placement);
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000231 void skipCommentTokens(Token& token);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000232
damiramef16a352017-08-02 22:44:42 -0700233 static bool containsNewLine(Location begin, Location end);
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500234 static String normalizeEOL(Location begin, Location end);
damiramef16a352017-08-02 22:44:42 -0700235
Aaron Jacobs11086dd2014-09-15 10:15:29 +1000236 typedef std::stack<Value*> Nodes;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000237 Nodes nodes_;
238 Errors errors_;
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500239 String document_;
Hans Johnsone817e4f2019-01-14 17:09:22 -0600240 Location begin_{};
241 Location end_{};
242 Location current_{};
243 Location lastValueEnd_{};
244 Value* lastValue_{};
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500245 String commentsBefore_;
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000246 Features features_;
Hans Johnsone817e4f2019-01-14 17:09:22 -0600247 bool collectComments_{};
Billy Donahueb5e1fe82018-05-20 16:55:27 -0400248}; // Reader
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600249
250/** Interface for reading JSON from a char array.
251 */
252class JSON_API CharReader {
253public:
Hans Johnsone3e05c72019-01-14 17:09:26 -0600254 virtual ~CharReader() = default;
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600255 /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
Billy Donahue483eba82019-07-14 18:41:48 -0400256 * document. The document must be a UTF-8 encoded string containing the
257 * document to read.
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600258 *
Billy Donahue483eba82019-07-14 18:41:48 -0400259 * \param beginDoc Pointer on the beginning of the UTF-8 encoded string
260 * of the document to read.
261 * \param endDoc Pointer on the end of the UTF-8 encoded string of the
262 * document to read. Must be >= beginDoc.
263 * \param[out] root Contains the root value of the document if it was
264 * successfully parsed.
265 * \param[out] errs Formatted error messages (if not NULL) a user
266 * friendly string that lists errors in the parsed
267 * document.
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600268 * \return \c true if the document was successfully parsed, \c false if an
Billy Donahue483eba82019-07-14 18:41:48 -0400269 * error occurred.
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600270 */
Billy Donahueb5e1fe82018-05-20 16:55:27 -0400271 virtual bool parse(char const* beginDoc,
272 char const* endDoc,
273 Value* root,
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500274 String* errs) = 0;
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600275
Ben Boeckel80def662015-09-28 15:45:11 -0400276 class JSON_API Factory {
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600277 public:
Hans Johnsone3e05c72019-01-14 17:09:26 -0600278 virtual ~Factory() = default;
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600279 /** \brief Allocate a CharReader via operator new().
280 * \throw std::exception if something goes wrong (e.g. invalid settings)
281 */
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600282 virtual CharReader* newCharReader() const = 0;
Billy Donahueb5e1fe82018-05-20 16:55:27 -0400283 }; // Factory
284}; // CharReader
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600285
Christopher Dunn66a8ba22015-02-09 01:29:43 -0600286/** \brief Build a CharReader implementation.
Billy Donahue483eba82019-07-14 18:41:48 -0400287 *
288 * Usage:
289 * \code
290 * using namespace Json;
291 * CharReaderBuilder builder;
292 * builder["collectComments"] = false;
293 * Value value;
294 * String errs;
295 * bool ok = parseFromStream(builder, std::cin, &value, &errs);
296 * \endcode
297 */
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600298class JSON_API CharReaderBuilder : public CharReader::Factory {
Christopher Dunn66a8ba22015-02-09 01:29:43 -0600299public:
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600300 // Note: We use a Json::Value so that we can add data-members to this class
301 // without a major version bump.
302 /** Configuration of this builder.
Billy Donahue483eba82019-07-14 18:41:48 -0400303 * These are case-sensitive.
304 * Available settings (case-sensitive):
305 * - `"collectComments": false or true`
306 * - true to collect comment and allow writing them back during
307 * serialization, false to discard comments. This parameter is ignored
308 * if allowComments is false.
309 * - `"allowComments": false or true`
310 * - true if comments are allowed.
311 * - `"strictRoot": false or true`
312 * - true if root must be either an array or an object value
313 * - `"allowDroppedNullPlaceholders": false or true`
314 * - true if dropped null placeholders are allowed. (See
315 * StreamWriterBuilder.)
316 * - `"allowNumericKeys": false or true`
317 * - true if numeric object keys are allowed.
318 * - `"allowSingleQuotes": false or true`
319 * - true if '' are allowed for strings (both keys and values)
320 * - `"stackLimit": integer`
321 * - Exceeding stackLimit (recursive depth of `readValue()`) will cause an
322 * exception.
323 * - This is a security issue (seg-faults caused by deeply nested JSON), so
324 * the default is low.
325 * - `"failIfExtra": false or true`
326 * - If true, `parse()` returns false when extra non-whitespace trails the
327 * JSON value in the input string.
328 * - `"rejectDupKeys": false or true`
329 * - If true, `parse()` returns false when a key is duplicated within an
330 * object.
331 * - `"allowSpecialFloats": false or true`
332 * - If true, special float values (NaNs and infinities) are allowed and
333 * their values are lossfree restorable.
334 *
335 * You can examine 'settings_` yourself to see the defaults. You can also
336 * write and read them just like any JSON Value.
337 * \sa setDefaults()
338 */
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600339 Json::Value settings_;
Christopher Dunn66a8ba22015-02-09 01:29:43 -0600340
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600341 CharReaderBuilder();
Hans Johnson2853b1c2019-01-11 13:58:53 -0600342 ~CharReaderBuilder() override;
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600343
Hans Johnson2853b1c2019-01-11 13:58:53 -0600344 CharReader* newCharReader() const override;
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600345
Christopher Dunnf757c182015-02-09 18:24:56 -0600346 /** \return true if 'settings' are legal and consistent;
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600347 * otherwise, indicate bad settings via 'invalid'.
348 */
349 bool validate(Json::Value* invalid) const;
Christopher Dunnc312dd52015-03-04 14:56:37 -0600350
351 /** A simple way to update a specific setting.
352 */
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500353 Value& operator[](const String& key);
Christopher Dunnc312dd52015-03-04 14:56:37 -0600354
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600355 /** Called by ctor, but you can use this to reset settings_.
356 * \pre 'settings' != NULL (but Json::null is fine)
Christopher Dunn3cf91752015-02-09 18:16:24 -0600357 * \remark Defaults:
Christopher Dunn56650e82015-04-20 13:10:31 -0700358 * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
Christopher Dunna9e1ab32015-02-09 17:22:28 -0600359 */
360 static void setDefaults(Json::Value* settings);
Christopher Dunn3cf91752015-02-09 18:16:24 -0600361 /** Same as old Features::strictMode().
362 * \pre 'settings' != NULL (but Json::null is fine)
363 * \remark Defaults:
Christopher Dunn56650e82015-04-20 13:10:31 -0700364 * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
Christopher Dunn3cf91752015-02-09 18:16:24 -0600365 */
366 static void strictMode(Json::Value* settings);
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000367};
368
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600369/** Consume entire stream and use its begin/end.
Billy Donahueb5e1fe82018-05-20 16:55:27 -0400370 * Someday we might have a real StreamReader, but for now this
371 * is convenient.
372 */
373bool JSON_API parseFromStream(CharReader::Factory const&,
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500374 IStream&,
Billy Donahueb5e1fe82018-05-20 16:55:27 -0400375 Value* root,
Jordan Bayles645250b2019-07-10 18:56:30 -0700376 String* errs);
Christopher Dunn2c1197c2015-01-29 14:29:40 -0600377
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000378/** \brief Read from 'sin' into 'root'.
Billy Donahue483eba82019-07-14 18:41:48 -0400379 *
380 * Always keep comments from the input JSON.
381 *
382 * This can be used to read a file into a particular sub-object.
383 * For example:
384 * \code
385 * Json::Value root;
386 * cin >> root["dir"]["file"];
387 * cout << root;
388 * \endcode
389 * Result:
390 * \verbatim
391 * {
392 * "dir": {
393 * "file": {
394 * // The input stream JSON would be nested here.
395 * }
396 * }
397 * }
398 * \endverbatim
399 * \throw std::exception on parse error.
400 * \see Json::operator<<()
401 */
Billy Donahue1c2ed7a2019-01-17 16:35:29 -0500402JSON_API IStream& operator>>(IStream&, Value&);
Christopher Dunn6d135cb2007-06-13 15:51:04 +0000403
404} // namespace Json
405
Sergiy80d6e666f2016-12-03 22:29:14 +0200406#pragma pack(pop)
407
Baptiste Lepilleureafd7022013-05-08 20:21:11 +0000408#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000409#pragma warning(pop)
Baptiste Lepilleureafd7022013-05-08 20:21:11 +0000410#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
411
Christopher Dunn6d135cb2007-06-13 15:51:04 +0000412#endif // CPPTL_JSON_READER_H_INCLUDED