blob: de45248fb3141aad1ceaa2cae4374cf476e39a6b [file] [log] [blame]
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +00001// 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
Aaron Jacobs9fa4e842014-07-01 08:48:54 +10007#define CPPTL_JSON_FEATURES_H_INCLUDED
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +00008
Baptiste Lepilleureadc4782011-05-02 21:09:30 +00009#if !defined(JSON_IS_AMALGAMATION)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100010#include "forwards.h"
Baptiste Lepilleureadc4782011-05-02 21:09:30 +000011#endif // if !defined(JSON_IS_AMALGAMATION)
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000012
Sergiy80d6e666f2016-12-03 22:29:14 +020013#pragma pack(push, 8)
14
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000015namespace Json {
16
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100017/** \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 */
21class JSON_API Features {
22public:
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();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000030
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100031 /** \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();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000038
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100039 /** \brief Initialize the configuration like JsonConfig::allFeatures;
40 */
41 Features();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000042
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100043 /// \c true if comments are allowed. Default: \c true.
44 bool allowComments_;
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000045
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100046 /// \c true if root must be either an array or an object value. Default: \c
47 /// false.
48 bool strictRoot_;
Aaron Jacobs642befc2014-04-23 23:28:23 +000049
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100050 /// \c true if dropped null placeholders are allowed. Default: \c false.
51 bool allowDroppedNullPlaceholders_;
Aaron Jacobs642befc2014-04-23 23:28:23 +000052
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100053 /// \c true if numeric object key are allowed. Default: \c false.
54 bool allowNumericKeys_;
55};
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000056
57} // namespace Json
58
Sergiy80d6e666f2016-12-03 22:29:14 +020059#pragma pack(pop)
60
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000061#endif // CPPTL_JSON_FEATURES_H_INCLUDED