features.h 1.7 KB

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