From e731adcbd87005c7167ff50a23bf479639cb49a3 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Wed, 31 May 2006 16:32:41 +0000 Subject: [PATCH] Added EXIV2_CHECK_VERSION(major,minor,patch) and related defines for use by applications to check the Exiv2 version --- src/Makefile | 3 +- src/exiv2_version.h | 79 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/exiv2_version.h diff --git a/src/Makefile b/src/Makefile index f5942e34..3f12b0d1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,7 +47,8 @@ include $(top_srcdir)/config/config.mk # Source files # Add standalone C++ header files to this list -CCHDR = exv_conf.h \ +CCHDR = exiv2_version.h \ + exv_conf.h \ exv_msvc.h \ mn.hpp \ rcsid.hpp diff --git a/src/exiv2_version.h b/src/exiv2_version.h new file mode 100644 index 00000000..82dacbc5 --- /dev/null +++ b/src/exiv2_version.h @@ -0,0 +1,79 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2006 Andreas Huggel + * + * This program is part of the Exiv2 distribution. + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. + */ +/*! + @file exiv2_version.h + @brief Define to check the %Exiv2 version. The %Exiv2 library itself does not + use the defines in this file, they are meant for use by applications. + References: Similar versioning schemes are used in KDE, GTK and other + libraries. See http://apr.apache.org/versioning.html for accompanying + guidelines. + @version $Rev$ + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @date 31-May-06, ahu: created + */ +#ifndef EXIV2_VERSION_H_ +#define EXIV2_VERSION_H_ + +/*! + @brief %Exiv2 MAJOR version number. + */ +#define EXIV2_MAJOR_VERSION (0) +/*! + @brief %Exiv2 MINOR version number. + */ +#define EXIV2_MINOR_VERSION (10) +/*! + @brief %Exiv2 PATCH version number. + */ +#define EXIV2_PATCH_VERSION (0) +/*! + @brief Make an integer version number for comparison from a major, minor and + a patch version number. + */ +#define EXIV2_MAKE_VERSION(major,minor,patch) \ + (((major) << 16) | ((minor) << 8) | (patch)) +/*! + @brief The %Exiv2 version number as an integer number for easy comparison. + */ +#define EXIV2_VERSION \ + EXIV2_MAKE_VERSION(EXIV2_MAJOR_VERSION,EXIV2_MINOR_VERSION,EXIV2_PATCH_VERSION) +/*! + @brief Check the version of the %Exiv2 library. Return TRUE if the version of + %Exiv2 is the same as or newer than the passed-in version. + + Versions are denoted using a standard triplet of integers: + MAJOR.MINOR.PATCH. The basic intent is that MAJOR versions are incompatible, + large-scale upgrades of the API. MINOR versions retain source and binary + compatibility with older minor versions, and changes in the PATCH level are + perfectly compatible, forwards and backwards. + + Details of these guidelines are described in http://apr.apache.org/versioning.html + + It is important to note that as long as the library has not reached 1.0.0 it + is not subject to the guidelines described in the document above. Before a 1.0 + release (version 0.x.y), the API can and will be changing freely, without + regard to the restrictions detailed in the above document. + */ +#define EXIV2_CHECK_VERSION(major,minor,patch) \ + ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) ) + +#endif /* EXIV2_VERSION_H_ */