json-version.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* json-version.h - JSON-GLib versioning information
  2. *
  3. * This file is part of JSON-GLib
  4. * Copyright (C) 2007 OpenedHand Ltd.
  5. * Copyright (C) 2009 Intel Corp.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author:
  21. * Emmanuele Bassi <ebassi@linux.intel.com>
  22. */
  23. #ifndef __JSON_VERSION_H__
  24. #define __JSON_VERSION_H__
  25. #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
  26. #error "Only <json-glib/json-glib.h> can be included directly."
  27. #endif
  28. /**
  29. * SECTION:json-version
  30. * @short_description: JSON-GLib version checking
  31. *
  32. * JSON-GLib provides macros to check the version of the library
  33. * at compile-time
  34. */
  35. /**
  36. * JSON_MAJOR_VERSION:
  37. *
  38. * Json major version component (e.g. 1 if %JSON_VERSION is 1.2.3)
  39. */
  40. #define JSON_MAJOR_VERSION (1)
  41. /**
  42. * JSON_MINOR_VERSION:
  43. *
  44. * Json minor version component (e.g. 2 if %JSON_VERSION is 1.2.3)
  45. */
  46. #define JSON_MINOR_VERSION (6)
  47. /**
  48. * JSON_MICRO_VERSION:
  49. *
  50. * Json micro version component (e.g. 3 if %JSON_VERSION is 1.2.3)
  51. */
  52. #define JSON_MICRO_VERSION (2)
  53. /**
  54. * JSON_VERSION
  55. *
  56. * Json version.
  57. */
  58. #define JSON_VERSION (1.6.2)
  59. /**
  60. * JSON_VERSION_S:
  61. *
  62. * JSON-GLib version, encoded as a string, useful for printing and
  63. * concatenation.
  64. */
  65. #define JSON_VERSION_S "1.6.2"
  66. #define JSON_ENCODE_VERSION(major,minor,micro) \
  67. ((major) << 24 | (minor) << 16 | (micro) << 8)
  68. /**
  69. * JSON_VERSION_HEX:
  70. *
  71. * JSON-GLib version, encoded as an hexadecimal number, useful for
  72. * integer comparisons.
  73. */
  74. #define JSON_VERSION_HEX \
  75. (JSON_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION, JSON_MICRO_VERSION))
  76. /**
  77. * JSON_CHECK_VERSION:
  78. * @major: required major version
  79. * @minor: required minor version
  80. * @micro: required micro version
  81. *
  82. * Compile-time version checking. Evaluates to %TRUE if the version
  83. * of Json is greater than the required one.
  84. */
  85. #define JSON_CHECK_VERSION(major,minor,micro) \
  86. (JSON_MAJOR_VERSION > (major) || \
  87. (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \
  88. (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \
  89. JSON_MICRO_VERSION >= (micro)))
  90. #endif /* __JSON_VERSION_H__ */