abi_macros.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // __ _____ _____ _____
  2. // __| | __| | | | JSON for Modern C++
  3. // | | |__ | | | | | | version 3.11.3
  4. // |_____|_____|_____|_|___| https://github.com/nlohmann/json
  5. //
  6. // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
  7. // SPDX-License-Identifier: MIT
  8. #pragma once
  9. // This file contains all macro definitions affecting or depending on the ABI
  10. #ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
  11. #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
  12. #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3
  13. #warning "Already included a different version of the library!"
  14. #endif
  15. #endif
  16. #endif
  17. #define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum)
  18. #define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum)
  19. #define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum)
  20. #ifndef JSON_DIAGNOSTICS
  21. #define JSON_DIAGNOSTICS 0
  22. #endif
  23. #ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
  24. #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
  25. #endif
  26. #if JSON_DIAGNOSTICS
  27. #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
  28. #else
  29. #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
  30. #endif
  31. #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
  32. #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
  33. #else
  34. #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
  35. #endif
  36. #ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
  37. #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
  38. #endif
  39. // Construct the namespace ABI tags component
  40. #define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
  41. #define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
  42. NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
  43. #define NLOHMANN_JSON_ABI_TAGS \
  44. NLOHMANN_JSON_ABI_TAGS_CONCAT( \
  45. NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
  46. NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
  47. // Construct the namespace version component
  48. #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
  49. _v ## major ## _ ## minor ## _ ## patch
  50. #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
  51. NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
  52. #if NLOHMANN_JSON_NAMESPACE_NO_VERSION
  53. #define NLOHMANN_JSON_NAMESPACE_VERSION
  54. #else
  55. #define NLOHMANN_JSON_NAMESPACE_VERSION \
  56. NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
  57. NLOHMANN_JSON_VERSION_MINOR, \
  58. NLOHMANN_JSON_VERSION_PATCH)
  59. #endif
  60. // Combine namespace components
  61. #define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
  62. #define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
  63. NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
  64. #ifndef NLOHMANN_JSON_NAMESPACE
  65. #define NLOHMANN_JSON_NAMESPACE \
  66. nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
  67. NLOHMANN_JSON_ABI_TAGS, \
  68. NLOHMANN_JSON_NAMESPACE_VERSION)
  69. #endif
  70. #ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
  71. #define NLOHMANN_JSON_NAMESPACE_BEGIN \
  72. namespace nlohmann \
  73. { \
  74. inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
  75. NLOHMANN_JSON_ABI_TAGS, \
  76. NLOHMANN_JSON_NAMESPACE_VERSION) \
  77. {
  78. #endif
  79. #ifndef NLOHMANN_JSON_NAMESPACE_END
  80. #define NLOHMANN_JSON_NAMESPACE_END \
  81. } /* namespace (inline namespace) NOLINT(readability/namespace) */ \
  82. } // namespace nlohmann
  83. #endif