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