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 24#ifndef __JSON_VERSION_H__ 25#define __JSON_VERSION_H__ 26 27#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) 28#error "Only <json-glib/json-glib.h> can be included directly." 29#endif 30 31/** 32 * SECTION:json-version 33 * @short_description: JSON-GLib version checking 34 * 35 * JSON-GLib provides macros to check the version of the library 36 * at compile-time 37 */ 38 39/** 40 * JSON_MAJOR_VERSION: 41 * 42 * Json major version component (e.g. 1 if %JSON_VERSION is 1.2.3) 43 */ 44#define JSON_MAJOR_VERSION (@JSON_MAJOR_VERSION@) 45 46/** 47 * JSON_MINOR_VERSION: 48 * 49 * Json minor version component (e.g. 2 if %JSON_VERSION is 1.2.3) 50 */ 51#define JSON_MINOR_VERSION (@JSON_MINOR_VERSION@) 52 53/** 54 * JSON_MICRO_VERSION: 55 * 56 * Json micro version component (e.g. 3 if %JSON_VERSION is 1.2.3) 57 */ 58#define JSON_MICRO_VERSION (@JSON_MICRO_VERSION@) 59 60/** 61 * JSON_VERSION 62 * 63 * Json version. 64 */ 65#define JSON_VERSION (@JSON_VERSION@) 66 67/** 68 * JSON_VERSION_S: 69 * 70 * JSON-GLib version, encoded as a string, useful for printing and 71 * concatenation. 72 */ 73#define JSON_VERSION_S "@JSON_VERSION@" 74 75#define JSON_ENCODE_VERSION(major,minor,micro) \ 76 ((major) << 24 | (minor) << 16 | (micro) << 8) 77 78/** 79 * JSON_VERSION_HEX: 80 * 81 * JSON-GLib version, encoded as an hexadecimal number, useful for 82 * integer comparisons. 83 */ 84#define JSON_VERSION_HEX \ 85 (JSON_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION, JSON_MICRO_VERSION)) 86 87/** 88 * JSON_CHECK_VERSION: 89 * @major: required major version 90 * @minor: required minor version 91 * @micro: required micro version 92 * 93 * Compile-time version checking. Evaluates to %TRUE if the version 94 * of Json is greater than the required one. 95 */ 96#define JSON_CHECK_VERSION(major,minor,micro) \ 97 (JSON_MAJOR_VERSION > (major) || \ 98 (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \ 99 (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \ 100 JSON_MICRO_VERSION >= (micro))) 101 102#endif /* __JSON_VERSION_H__ */ 103