features.h 1.8 KB

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