Exiv2
Namespaces | Macros | Functions
version.hpp File Reference

Precompiler define and a function to test the Exiv2 version. References: Similar versioning defines are used in KDE, GTK and other libraries. See http://apr.apache.org/versioning.html for accompanying guidelines. More...

#include <string>
+ Include dependency graph for version.hpp:
+ This graph shows which files directly or indirectly include this file:

Namespaces

 Exiv2
 Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of the objects of this namespace.
 

Macros

#define EXIV2_MAJOR_VERSION   (0)
 Exiv2 MAJOR version number of the library used at compile-time.
 
#define EXIV2_MINOR_VERSION   (24)
 Exiv2 MINOR version number of the library used at compile-time.
 
#define EXIV2_PATCH_VERSION   (0)
 Exiv2 PATCH version number of the library used at compile-time.
 
#define EXIV2_MAKE_VERSION(major, minor, patch)   (((major) << 16) | ((minor) << 8) | (patch))
 Make an integer version number for comparison from a major, minor and a patch version number.
 
#define EXIV2_VERSION   EXIV2_MAKE_VERSION(EXIV2_MAJOR_VERSION,EXIV2_MINOR_VERSION,EXIV2_PATCH_VERSION)
 The Exiv2 version number of the library used at compile-time as an integer number for easy comparison.
 
#define EXIV2_CHECK_VERSION(major, minor, patch)   ( Exiv2::versionNumber() >= EXIV2_MAKE_VERSION(major,minor,patch) )
 Deprecated version check macro. Do not use. More...
 
#define EXIV2_TEST_VERSION(major, minor, patch)   ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) )
 Macro to test the version of the available Exiv2 library at compile-time. Return true if it is the same as or newer than the passed-in version. More...
 

Functions

int Exiv2::versionNumber ()
 Return the version of Exiv2 available at runtime as an integer.
 
std::string Exiv2::versionString ()
 Return the version string Example: "0.24.0" (major.minor.patch)
 
std::string Exiv2::versionNumberHexString ()
 Return the version of Exiv2 as hex string of fixed length 6.
 
const char * Exiv2::version ()
 Return the version of Exiv2 available at runtime as a string.
 
bool Exiv2::testVersion (int major, int minor, int patch)
 Test the version of the available Exiv2 library at runtime. Return true if it is the same as or newer than the passed-in version. More...
 
EXIV2API void dumpLibraryInfo (std::ostream &os)
 

Detailed Description

Precompiler define and a function to test the Exiv2 version. References: Similar versioning defines are used in KDE, GTK and other libraries. See http://apr.apache.org/versioning.html for accompanying guidelines.

Version
Rev
3201
Author
Andreas Huggel (ahu) ahuggel@gmx.net
Date
31-May-06, ahu: created

Macro Definition Documentation

#define EXIV2_CHECK_VERSION (   major,
  minor,
  patch 
)    ( Exiv2::versionNumber() >= EXIV2_MAKE_VERSION(major,minor,patch) )

Deprecated version check macro. Do not use.

This macro has flaws and only remains for backward compatibility. Use EXIV2_TEST_VERSION and testVersion() instead.

#define EXIV2_TEST_VERSION (   major,
  minor,
  patch 
)    ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) )

Macro to test the version of the available Exiv2 library at compile-time. Return true if it is the same as or newer than the passed-in version.

Versions are denoted using a triplet of integers: MAJOR.MINOR.PATCH .

1 // Don't include the <exiv2/version.hpp> file directly, it is included by
2 // <exiv2/types.hpp>. Early Exiv2 versions didn't have version.hpp and the macros.
3 
4 #include <exiv2/types.hpp>
5 
6 // Make sure an EXIV2_TEST_VERSION macro exists:
7 
8 #ifdef EXIV2_VERSION
9 # ifndef EXIV2_TEST_VERSION
10 # define EXIV2_TEST_VERSION(major,minor,patch) \
11  ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) )
12 # endif
13 #else
14 # define EXIV2_TEST_VERSION(major,minor,patch) (false)
15 #endif
16 
17 std::cout << "Compiled with Exiv2 version " << EXV_PACKAGE_VERSION << "\n"
18  << "Runtime Exiv2 version is " << Exiv2::version() << "\n";
19 
20 // Test the Exiv2 version available at runtime but compile the if-clause only if
21 // the compile-time version is at least 0.15. Earlier versions didn't have a
22 // testVersion() function:
23 
24 #if EXIV2_TEST_VERSION(0,15,0)
25 if (Exiv2::testVersion(0,13,0)) {
26  std::cout << "Available Exiv2 version is equal to or greater than 0.13\n";
27 }
28 else {
29  std::cout << "Installed Exiv2 version is less than 0.13\n";
30 }
31 #else
32 std::cout << "Compile-time Exiv2 version doesn't have Exiv2::testVersion()\n";
33 #endif