features.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
  2. # define CPPTL_JSON_FEATURES_H_INCLUDED
  3. # include "forwards.h"
  4. namespace Json {
  5. /** \brief Configuration passed to reader and writer.
  6. * This configuration object can be used to force the Reader or Writer
  7. * to behave in a standard conforming way.
  8. */
  9. class JSON_API Features
  10. {
  11. public:
  12. /** \brief A configuration that allows all features and assumes all strings are UTF-8.
  13. * - C & C++ comments are allowed
  14. * - Root object can be any JSON value
  15. * - Assumes Value strings are encoded in UTF-8
  16. */
  17. static Features all();
  18. /** \brief A configuration that is strictly compatible with the JSON specification.
  19. * - Comments are forbidden.
  20. * - Root object must be either an array or an object value.
  21. * - Assumes Value strings are encoded in UTF-8
  22. */
  23. static Features strictMode();
  24. /** \brief Initialize the configuration like JsonConfig::allFeatures;
  25. */
  26. Features();
  27. /// \c true if comments are allowed. Default: \c true.
  28. bool allowComments_;
  29. /// \c true if root must be either an array or an object value. Default: \c false.
  30. bool strictRoot_;
  31. };
  32. } // namespace Json
  33. #endif // CPPTL_JSON_FEATURES_H_INCLUDED