json test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers features.h Source File

features.h

00001 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
00002 // Distributed under MIT license, or public domain if desired and
00003 // recognized in your jurisdiction.
00004 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
00005 
00006 #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
00007 #define CPPTL_JSON_FEATURES_H_INCLUDED
00008 
00009 #if !defined(JSON_IS_AMALGAMATION)
00010 #include "forwards.h"
00011 #endif // if !defined(JSON_IS_AMALGAMATION)
00012 
00013 #pragma pack(push, 8)
00014 
00015 namespace Json {
00016 
00017 /** \brief Configuration passed to reader and writer.
00018  * This configuration object can be used to force the Reader or Writer
00019  * to behave in a standard conforming way.
00020  */
00021 class JSON_API Features {
00022 public:
00023   /** \brief A configuration that allows all features and assumes all strings
00024    * are UTF-8.
00025    * - C & C++ comments are allowed
00026    * - Root object can be any JSON value
00027    * - Assumes Value strings are encoded in UTF-8
00028    */
00029   static Features all();
00030 
00031   /** \brief A configuration that is strictly compatible with the JSON
00032    * specification.
00033    * - Comments are forbidden.
00034    * - Root object must be either an array or an object value.
00035    * - Assumes Value strings are encoded in UTF-8
00036    */
00037   static Features strictMode();
00038 
00039   /** \brief Initialize the configuration like JsonConfig::allFeatures;
00040    */
00041   Features();
00042 
00043   /// \c true if comments are allowed. Default: \c true.
00044   bool allowComments_;
00045 
00046   /// \c true if root must be either an array or an object value. Default: \c
00047   /// false.
00048   bool strictRoot_;
00049 
00050   /// \c true if dropped null placeholders are allowed. Default: \c false.
00051   bool allowDroppedNullPlaceholders_;
00052 
00053   /// \c true if numeric object key are allowed. Default: \c false.
00054   bool allowNumericKeys_;
00055 };
00056 
00057 } // namespace Json
00058 
00059 #pragma pack(pop)
00060 
00061 #endif // CPPTL_JSON_FEATURES_H_INCLUDED