// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors // Distributed under MIT license, or public domain if desired and // recognized in your jurisdiction. // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE #ifndef JSON_READER_H_INCLUDED #define JSON_READER_H_INCLUDED #if !defined(JSON_IS_AMALGAMATION) #include "json_features.h" #include "value.h" #endif // if !defined(JSON_IS_AMALGAMATION) #include <deque> #include <iosfwd> #include <istream> #include <stack> #include <string> // Disable warning C4251: <data member>: <type> needs to have dll-interface to // be used by... #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(push) #pragma warning(disable : 4251) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma pack(push, 8) namespace Json { /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a * Value. * * \deprecated Use CharReader and CharReaderBuilder. */ class JSON_API Reader { … }; // Reader /** Interface for reading JSON from a char array. */ class JSON_API CharReader { … }; // CharReader /** \brief Build a CharReader implementation. * * Usage: * \code * using namespace Json; * CharReaderBuilder builder; * builder["collectComments"] = false; * Value value; * String errs; * bool ok = parseFromStream(builder, std::cin, &value, &errs); * \endcode */ class JSON_API CharReaderBuilder : public CharReader::Factory { … }; /** Consume entire stream and use its begin/end. * Someday we might have a real StreamReader, but for now this * is convenient. */ bool JSON_API parseFromStream(CharReader::Factory const&, IStream&, Value* root, String* errs); /** \brief Read from 'sin' into 'root'. * * Always keep comments from the input JSON. * * This can be used to read a file into a particular sub-object. * For example: * \code * Json::Value root; * cin >> root["dir"]["file"]; * cout << root; * \endcode * Result: * \verbatim * { * "dir": { * "file": { * // The input stream JSON would be nested here. * } * } * } * \endverbatim * \throw std::exception on parse error. * \see Json::operator<<() */ JSON_API IStream& operator>>(IStream&, Value&); } // namespace Json #pragma pack(pop) #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(pop) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // JSON_READER_H_INCLUDED