blob: 1bb7bb6148682777e2504cfb4bcf7816ffeabf99 [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
13namespace Json {
14
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100015/** \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 */
19class JSON_API Features {
20public:
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();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000028
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100029 /** \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();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000036
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100037 /** \brief Initialize the configuration like JsonConfig::allFeatures;
38 */
39 Features();
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000040
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100041 /// \c true if comments are allowed. Default: \c true.
42 bool allowComments_;
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000043
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100044 /// \c true if root must be either an array or an object value. Default: \c
45 /// false.
46 bool strictRoot_;
Aaron Jacobs642befc2014-04-23 23:28:23 +000047
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100048 /// \c true if dropped null placeholders are allowed. Default: \c false.
49 bool allowDroppedNullPlaceholders_;
Aaron Jacobs642befc2014-04-23 23:28:23 +000050
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100051 /// \c true if numeric object key are allowed. Default: \c false.
52 bool allowNumericKeys_;
53};
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +000054
55} // namespace Json
56
57#endif // CPPTL_JSON_FEATURES_H_INCLUDED