features.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. {
  17. public:
  18. /** \brief A configuration that allows all features and assumes all strings 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 specification.
  25. * - Comments are forbidden.
  26. * - Root object must be either an array or an object value.
  27. * - Assumes Value strings are encoded in UTF-8
  28. */
  29. static Features strictMode();
  30. /** \brief Initialize the configuration like JsonConfig::allFeatures;
  31. */
  32. Features();
  33. /// \c true if comments are allowed. Default: \c true.
  34. bool allowComments_;
  35. /// \c true if root must be either an array or an object value. Default: \c false.
  36. bool strictRoot_;
  37. };
  38. } // namespace Json
  39. #endif // CPPTL_JSON_FEATURES_H_INCLUDED