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