From dd3c11274f6f32de1900e88bec75a4d6dae01d6f Mon Sep 17 00:00:00 2001 From: vog Date: Mon, 22 Aug 2011 21:56:41 +0000 Subject: [PATCH] Added new function Exiv2::versionNumberHexString() --- src/version.cpp | 11 +++++++++++ src/version.hpp | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/src/version.cpp b/src/version.cpp index 6dc5f21f..7061fdb1 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -39,12 +39,23 @@ EXIV2_RCSID("@(#) $Id$") #include "version.hpp" +// + standard includes +#include +#include + namespace Exiv2 { int versionNumber() { return EXIV2_MAKE_VERSION(EXIV2_MAJOR_VERSION, EXIV2_MINOR_VERSION, EXIV2_PATCH_VERSION); } + std::string versionNumberHexString() + { + std::ostringstream os; + os << std::hex << std::setw(6) << std::setfill('0') << Exiv2::versionNumber(); + return os.str(); + } + const char* version() { return EXV_PACKAGE_VERSION; diff --git a/src/version.hpp b/src/version.hpp index c71246c1..8574765a 100644 --- a/src/version.hpp +++ b/src/version.hpp @@ -32,6 +32,11 @@ #ifndef VERSION_HPP_ #define VERSION_HPP_ +// ***************************************************************************** +// included header files +// + standard includes +#include + /*! @brief %Exiv2 MAJOR version number of the library used at compile-time. */ @@ -116,6 +121,10 @@ namespace Exiv2 { @brief Return the version of %Exiv2 available at runtime as an integer. */ EXIV2API int versionNumber(); + /*! + @brief Return the version of %Exiv2 as hex string of fixed length 6. + */ + EXIV2API std::string versionNumberHexString(); /*! @brief Return the version of %Exiv2 available at runtime as a string. */