Baptiste Lepilleur | 7469f1d | 2010-04-20 21:35:19 +0000 | [diff] [blame] | 1 | // Copyright 2007-2010 Baptiste Lepilleur |
| 2 | // 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 | |
| 6 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED |
| 7 | # define CPPTL_JSON_FEATURES_H_INCLUDED |
| 8 | |
Baptiste Lepilleur | eadc478 | 2011-05-02 21:09:30 +0000 | [diff] [blame] | 9 | #if !defined(JSON_IS_AMALGAMATION) |
Baptiste Lepilleur | 7469f1d | 2010-04-20 21:35:19 +0000 | [diff] [blame] | 10 | # include "forwards.h" |
Baptiste Lepilleur | eadc478 | 2011-05-02 21:09:30 +0000 | [diff] [blame] | 11 | #endif // if !defined(JSON_IS_AMALGAMATION) |
Baptiste Lepilleur | 7469f1d | 2010-04-20 21:35:19 +0000 | [diff] [blame] | 12 | |
| 13 | namespace Json { |
| 14 | |
| 15 | /** \brief Configuration passed to reader and writer. |
| 16 | * This configuration object can be used to force the Reader or Writer |
| 17 | * to behave in a standard conforming way. |
| 18 | */ |
| 19 | class JSON_API Features |
| 20 | { |
| 21 | public: |
| 22 | /** \brief A configuration that allows all features and assumes all strings are UTF-8. |
| 23 | * - C & C++ comments are allowed |
| 24 | * - Root object can be any JSON value |
| 25 | * - Assumes Value strings are encoded in UTF-8 |
| 26 | */ |
| 27 | static Features all(); |
| 28 | |
| 29 | /** \brief A configuration that is strictly compatible with the JSON specification. |
| 30 | * - Comments are forbidden. |
| 31 | * - Root object must be either an array or an object value. |
| 32 | * - Assumes Value strings are encoded in UTF-8 |
| 33 | */ |
| 34 | static Features strictMode(); |
| 35 | |
| 36 | /** \brief Initialize the configuration like JsonConfig::allFeatures; |
| 37 | */ |
| 38 | Features(); |
| 39 | |
| 40 | /// \c true if comments are allowed. Default: \c true. |
| 41 | bool allowComments_; |
| 42 | |
| 43 | /// \c true if root must be either an array or an object value. Default: \c false. |
| 44 | bool strictRoot_; |
Aaron Jacobs | 642befc | 2014-04-23 23:28:23 +0000 | [diff] [blame^] | 45 | |
| 46 | /// \c true if dropped null placeholders are allowed. Default: \c false. |
| 47 | bool allowDroppedNullPlaceholders_; |
| 48 | |
| 49 | /// \c true if numeric object key are allowed. Default: \c false. |
| 50 | bool allowNumericKeys_; |
Baptiste Lepilleur | 7469f1d | 2010-04-20 21:35:19 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // namespace Json |
| 54 | |
| 55 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED |