Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [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 |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 8 | |
| 9 | #if !defined(JSON_IS_AMALGAMATION) |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 10 | #include "forwards.h" |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 11 | #endif // if !defined(JSON_IS_AMALGAMATION) |
| 12 | |
| 13 | namespace Json { |
| 14 | |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 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 | public: |
| 21 | /** \brief A configuration that allows all features and assumes all strings |
| 22 | * 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(); |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 28 | |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 29 | /** \brief A configuration that is strictly compatible with the JSON |
| 30 | * specification. |
| 31 | * - Comments are forbidden. |
| 32 | * - Root object must be either an array or an object value. |
| 33 | * - Assumes Value strings are encoded in UTF-8 |
| 34 | */ |
| 35 | static Features strictMode(); |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 36 | |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 37 | /** \brief Initialize the configuration like JsonConfig::allFeatures; |
| 38 | */ |
| 39 | Features(); |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 40 | |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 41 | /// \c true if comments are allowed. Default: \c true. |
| 42 | bool allowComments_; |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 43 | |
Derek Sollenberger | 2eb3b4d | 2016-01-11 14:41:40 -0500 | [diff] [blame] | 44 | /// \c true if root must be either an array or an object value. Default: \c |
| 45 | /// false. |
| 46 | bool strictRoot_; |
| 47 | |
| 48 | /// \c true if dropped null placeholders are allowed. Default: \c false. |
| 49 | bool allowDroppedNullPlaceholders_; |
| 50 | |
| 51 | /// \c true if numeric object key are allowed. Default: \c false. |
| 52 | bool allowNumericKeys_; |
| 53 | }; |
Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 54 | |
| 55 | } // namespace Json |
| 56 | |
| 57 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED |