summaryrefslogtreecommitdiff
path: root/libgweather/gweather-version.h.in
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2014-02-18 22:31:01 +0000
committerJavier Jardón <javier.jardon@codethink.co.uk>2014-02-19 14:33:50 +0000
commit7fd8ce84126d66e0c05a8c6ad83e281b70790fd0 (patch)
tree3bd3f9cea882fa62f02a831d75b5feee41801c8e /libgweather/gweather-version.h.in
parent73dedc4fa1c052e1235386cbfaf9d18d87800f03 (diff)
downloadlibgweather-7fd8ce84126d66e0c05a8c6ad83e281b70790fd0.tar.gz
Add version information API
Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=724676
Diffstat (limited to 'libgweather/gweather-version.h.in')
-rw-r--r--libgweather/gweather-version.h.in110
1 files changed, 110 insertions, 0 deletions
diff --git a/libgweather/gweather-version.h.in b/libgweather/gweather-version.h.in
new file mode 100644
index 0000000..bb3ae69
--- /dev/null
+++ b/libgweather/gweather-version.h.in
@@ -0,0 +1,110 @@
+/* gweather-version.h - libgweather versioning information
+ *
+ * This file is part of libgweather
+ * Copyright (C) 2014 Javier Jardón <jjardon@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Based on json-version from json-glib
+ * Authored by Emmanuele Bassi <ebassi@gnome.org>
+ * Adapted for libgweather by Javier Jardón <jjardon@gnome.org>
+ */
+
+#ifndef __GWEATHER_VERSION_H__
+#define __GWEATHER_VERSION_H__
+
+/**
+ * SECTION:gweatherversion
+ * @short_description: libgweather version checking
+ *
+ * LibGweather provides macros to check the version of the library
+ * at compile-time
+ */
+
+/**
+ * GWEATHER_MAJOR_VERSION:
+ *
+ * LibGweather major version component (e.g. 1 if %GWEATHER_VERSION is 1.2.3)
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_MAJOR_VERSION (@LIBGWEATHER_MAJOR_VERSION@)
+
+/**
+ * GWEATHER_MINOR_VERSION:
+ *
+ * LibGweather minor version component (e.g. 2 if %GWEATHER_VERSION is 1.2.3)
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_MINOR_VERSION (@LIBGWEATHER_MINOR_VERSION@)
+
+/**
+ * GWEATHER_MICRO_VERSION:
+ *
+ * LibGweather micro version component (e.g. 3 if %GWEATHER_VERSION is 1.2.3)
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_MICRO_VERSION (@LIBGWEATHER_MICRO_VERSION@)
+
+/**
+ * GWEATHER_VERSION
+ *
+ * LibGweather version.
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_VERSION (@LIBGWEATHER_VERSION@)
+
+/**
+ * GWEATHER_VERSION_S:
+ *
+ * LibGweather version, encoded as a string, useful for printing and
+ * concatenation.
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_VERSION_S "@LIBGWEATHER_VERSION@"
+
+/**
+ * GWEATHER_VERSION_HEX:
+ *
+ * LibGweather version, encoded as an hexadecimal number, useful for
+ * integer comparisons.
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_VERSION_HEX (GWEATHER_MAJOR_VERSION << 24 | \
+ GWEATHER_MINOR_VERSION << 16 | \
+ GWEATHER_MICRO_VERSION << 8)
+
+/**
+ * GWEATHER_CHECK_VERSION:
+ * @major: required major version
+ * @minor: required minor version
+ * @micro: required micro version
+ *
+ * Compile-time version checking. Evaluates to %TRUE if the version
+ * of LibGweather is greater than the required one.
+ *
+ * Since: 3.12
+ */
+#define GWEATHER_CHECK_VERSION(major,minor,micro) \
+ (GWEATHER_MAJOR_VERSION > (major) || \
+ (GWEATHER_MAJOR_VERSION == (major) && GWEATHER_MINOR_VERSION > (minor)) || \
+ (GWEATHER_MAJOR_VERSION == (major) && GWEATHER_MINOR_VERSION == (minor) && \
+ GWEATHER_MICRO_VERSION >= (micro)))
+
+#endif /* __GWEATHER_VERSION_H__ */