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