features.h 1.7 KB

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