// 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
// Disable warning C4251: <data member>: <type> needs to have dll-interface to // be used by... #ifdefined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(push) #pragma warning(disable : 4251) #endif// if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragmapack(push, 8)
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a *Value. * *\deprecatedUseCharReaderandCharReaderBuilder.
*/
class JSON_API Reader { public: usingChar = char; using Location = constChar*;
/** \brief An error tagged with where in the JSON text it was encountered. * *Theoffsetsgivethe[start,limit)rangeofbyteswithinthetext.Note *thatthisisbytes,notcodepoints.
*/ struct StructuredError {
ptrdiff_t offset_start;
ptrdiff_t offset_limit;
String message;
};
/** \brief Constructs a Reader allowing all features for parsing. *\deprecatedUseCharReaderandCharReaderBuilder.
*/
Reader();
/** \brief Constructs a Reader allowing the specified feature set for parsing. *\deprecatedUseCharReaderandCharReaderBuilder.
*/
Reader(const Features& features);
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> *document. * *\paramdocumentUTF-8encodedstringcontainingthedocument *toread. *\param[out]rootContainstherootvalueofthedocumentifit *wassuccessfullyparsed. *\paramcollectComments\ctruetocollectcommentandallowwriting *thembackduringserialization,\cfalseto *discardcomments.Thisparameterisignored *ifFeatures::allowComments_is\cfalse. *\return\ctrueifthedocumentwassuccessfullyparsed,\cfalseifan *erroroccurred.
*/ bool parse(const std::string& document, Value& root, bool collectComments = true);
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> *document. * *\parambeginDocPointeronthebeginningoftheUTF-8encoded *stringofthedocumenttoread. *\paramendDocPointerontheendoftheUTF-8encodedstring *ofthedocumenttoread.Mustbe>=beginDoc. *\param[out]rootContainstherootvalueofthedocumentifit *wassuccessfullyparsed. *\paramcollectComments\ctruetocollectcommentandallowwriting *thembackduringserialization,\cfalseto *discardcomments.Thisparameterisignored *ifFeatures::allowComments_is\cfalse. *\return\ctrueifthedocumentwassuccessfullyparsed,\cfalseifan *erroroccurred.
*/ bool parse(constchar* beginDoc, constchar* endDoc, Value& root, bool collectComments = true);
/// \brief Parse from input stream. /// \see Json::operator>>(std::istream&, Json::Value&). bool parse(IStream& is, Value& root, bool collectComments = true);
/** \brief Returns a user friendly string that list errors in the parsed *document. * *\returnFormattederrormessagewiththelistoferrorswiththeir *locationintheparseddocument.Anemptystringisreturnedifnoerror *occurredduringparsing. *\deprecatedUsegetFormattedErrorMessages()instead(typofix).
*/
JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
String getFormatedErrorMessages() const;
/** \brief Returns a user friendly string that list errors in the parsed *document. * *\returnFormattederrormessagewiththelistoferrorswiththeir *locationintheparseddocument.Anemptystringisreturnedifnoerror *occurredduringparsing.
*/
String getFormattedErrorMessages() const;
/** \brief Returns a vector of structured errors encountered while parsing. * *\returnA(possiblyempty)vectorofStructuredErrorobjects.Currently *onlyoneerrorcanbereturned,butthecallershouldtoleratemultiple *errors.Thiscanoccuriftheparserrecoversfromanon-fatalparse *errorandthenencountersadditionalerrors.
*/
std::vector<StructuredError> getStructuredErrors() const;
/** \brief Build a CharReader implementation. * *Usage: *\code *usingnamespaceJson; *CharReaderBuilderbuilder; *builder["collectComments"]=false; *Valuevalue; *Stringerrs; *boolok=parseFromStream(builder,std::cin,&value,&errs); *\endcode
*/ class JSON_API CharReaderBuilder : public CharReader::Factory { public: // Note: We use a Json::Value so that we can add data-members to this class // without a major version bump. /** Configuration of this builder. *Thesearecase-sensitive. *Availablesettings(case-sensitive): *-`"collectComments":falseortrue` *-truetocollectcommentandallowwritingthembackduring *serialization,falsetodiscardcomments.Thisparameterisignored *ifallowCommentsisfalse. *-`"allowComments":falseortrue` *-trueifcommentsareallowed. *-`"allowTrailingCommas":falseortrue` *-trueiftrailingcommasinobjectsandarraysareallowed. *-`"strictRoot":falseortrue` *-trueifrootmustbeeitheranarrayoranobjectvalue *-`"allowDroppedNullPlaceholders":falseortrue` *-trueifdroppednullplaceholdersareallowed.(See *StreamWriterBuilder.) *-`"allowNumericKeys":falseortrue` *-trueifnumericobjectkeysareallowed. *-`"allowSingleQuotes":falseortrue` *-trueif''areallowedforstrings(bothkeysandvalues) *-`"stackLimit":integer` *-ExceedingstackLimit(recursivedepthof`readValue()`)willcausean *exception. *-Thisisasecurityissue(seg-faultscausedbydeeplynestedJSON),so *thedefaultislow. *-`"failIfExtra":falseortrue` *-Iftrue,`parse()`returnsfalsewhenextranon-whitespacetrailsthe *JSONvalueintheinputstring. *-`"rejectDupKeys":falseortrue` *-Iftrue,`parse()`returnsfalsewhenakeyisduplicatedwithinan *object. *-`"allowSpecialFloats":falseortrue` *-Iftrue,specialfloatvalues(NaNsandinfinities)areallowedand *theirvaluesarelossfreerestorable. *-`"skipBom":falseortrue` *-Iftrue,iftheinputstartswiththeUnicodebyteordermark(BOM), *itisskipped. * *Youcanexamine'settings_`yourselftoseethedefaults.Youcanalso *writeandreadthemjustlikeanyJSONValue. *\sasetDefaults()
*/
Json::Value settings_;
/** \return true if 'settings' are legal and consistent; *otherwise,indicatebadsettingsvia'invalid'.
*/ bool validate(Json::Value* invalid) const;
/** A simple way to update a specific setting.
*/
Value& operator[](const String& key);
/** Called by ctor, but you can use this to reset settings_. *\pre'settings'!=NULL(butJson::nullisfine) *\remarkDefaults: *\snippetsrc/lib_json/json_reader.cppCharReaderBuilderDefaults
*/ staticvoid setDefaults(Json::Value* settings); /** Same as old Features::strictMode(). *\pre'settings'!=NULL(butJson::nullisfine) *\remarkDefaults: *\snippetsrc/lib_json/json_reader.cppCharReaderBuilderStrictMode
*/ staticvoid strictMode(Json::Value* settings);
};
/** Consume entire stream and use its begin/end. *SomedaywemighthavearealStreamReader,butfornowthis *isconvenient.
*/ bool JSON_API parseFromStream(CharReader::Factory const&, IStream&, Value* root,
String* errs);
/** \brief Read from 'sin' into 'root'. * *AlwayskeepcommentsfromtheinputJSON. * *Thiscanbeusedtoreadafileintoaparticularsub-object. *Forexample: *\code *Json::Valueroot; *cin>>root["dir"]["file"]; *cout<<root; *\endcode *Result: *\verbatim *{ *"dir":{ *"file":{ *// The input stream JSON would be nested here. *} *} *} *\endverbatim *\throwstd::exceptiononparseerror. *\seeJson::operator<<()
*/
JSON_API IStream& operator>>(IStream&, Value&);
} // namespace Json
#pragmapack(pop)
#ifdefined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(pop) #endif// if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.