1 /* json-version.h - JSON-GLib versioning information
3 * This file is part of JSON-GLib
4 * Copyright (C) 2007 OpenedHand Ltd.
5 * Copyright (C) 2009 Intel Corp.
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.
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.
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/>.
21 * Emmanuele Bassi <ebassi@linux.intel.com>
24 #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
25 #error "Only <json-glib/json-glib.h> can be included directly."
28 #ifndef __JSON_VERSION_H__
29 #define __JSON_VERSION_H__
32 * SECTION:json-version
33 * @short_description: JSON-GLib version checking
35 * JSON-GLib provides macros to check the version of the library
42 * Json major version component (e.g. 1 if %JSON_VERSION is 1.2.3)
44 #define JSON_MAJOR_VERSION (@JSON_MAJOR_VERSION@)
49 * Json minor version component (e.g. 2 if %JSON_VERSION is 1.2.3)
51 #define JSON_MINOR_VERSION (@JSON_MINOR_VERSION@)
56 * Json micro version component (e.g. 3 if %JSON_VERSION is 1.2.3)
58 #define JSON_MICRO_VERSION (@JSON_MICRO_VERSION@)
65 #define JSON_VERSION (@JSON_VERSION@)
70 * Json version, encoded as a string, useful for printing and
73 #define JSON_VERSION_S "@JSON_VERSION@"
78 * Json version, encoded as an hexadecimal number, useful for
79 * integer comparisons.
81 #define JSON_VERSION_HEX (JSON_MAJOR_VERSION << 24 | \
82 JSON_MINOR_VERSION << 16 | \
83 JSON_MICRO_VERSION << 8)
87 * @major: required major version
88 * @minor: required minor version
89 * @micro: required micro version
91 * Compile-time version checking. Evaluates to %TRUE if the version
92 * of Json is greater than the required one.
94 #define JSON_CHECK_VERSION(major,minor,micro) \
95 (JSON_MAJOR_VERSION > (major) || \
96 (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \
97 (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \
98 JSON_MICRO_VERSION >= (micro)))
100 #endif /* __JSON_VERSION_H__ */