Add version information related functions

This commit is contained in:
2014-07-05 22:57:34 +02:00
parent 8a5d700d93
commit 75a9318629
7 changed files with 127 additions and 1 deletions

View File

@@ -21,7 +21,9 @@ INST_H_SRC_FILES = \
$(NULL)
INST_H_BUILT_FILES = \
gswe-enumtypes.h
gswe-enumtypes.h \
gswe-version.h \
$(NULL)
PRIV_H_SRC_FILES = \
swe-glib-private.h \
@@ -55,6 +57,7 @@ libswe_glib_2_0_la_SOURCES = \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \
gswe-version.c \
$(NULL)
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall

78
src/gswe-version.c Normal file
View File

@@ -0,0 +1,78 @@
/* gswe-version.c: SWE-GLib version information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include "gswe-version.h"
/**
* SECTION:gswe-version
* @short_description: SWE-GLib version information
* @title: Version information
* @stability: Stable
* @include: swe-glib/swe-glib.h
*
* Version information of the SWE-GLib library.
*/
/**
* GSWE_MAJOR_VERSION:
*
* The major version number of the SWE-GLib library.
*/
/**
* GSWE_MINOR_VERSION:
*
* The minor version number of the SWE-GLib library.
*/
/**
* GSWE_MICRO_VERSION:
*
* The micro version number of the SWE-GLib library.
*/
/**
* GSWE_CHECK_VERSION:
* @major: the major version to check for
* @minor: the minor version to check for
* @micro: the micro version to check for
*
* Checks the version number of the SWE-GLib library that is being comipled
* against.
*
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
*/
/**
* gswe_check_version:
* @required_major: the required major version
* @required_minor: the required minor version
* @required_micro: the required micro version
*
* Checks that the SWE-GLib library in use is compatible with the given
* version.
*
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
*/
gboolean
gswe_check_version(guint required_major, guint required_minor, guint required_micro)
{
return (GSWE_CHECK_VERSION(required_major, required_minor, required_micro));
}

34
src/gswe-version.h.in Normal file
View File

@@ -0,0 +1,34 @@
/* gswe-version.h: SWE-GLib version information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_VERSION_H__
#define __GSWE_VERSION_H__
#define GSWE_MAJOR_VERSION @SWE_GLIB_MAJOR_VERSION@
#define GSWE_MINOR_VERSION @SWE_GLIB_MINOR_VERSION@
#define GSWE_MICRO_VERSION @SWE_GLIB_MICRO_VERSION@
gboolean gswe_check_version(guint required_major, guint required_minor, guint required_micro);
#define GSWE_CHECK_VERSION(major,minor,micro) \
(GSWE_MAJOR_VERSION > (major) || \
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION > (minor)) || \
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION == (minor) && \
GSWE_MICRO_VERSION >= (micro)))
#endif /* __GSWE_VERSION_H__ */