Adds a function for dynamic version information retrieval

The current way of exposing TagLib's version only through #define's
makes it impossible for clients (e.g. language bindings) to reliably
determine the TagLib version that is currently in use: using the
define's in client code will statically copy the compile-time values
into the client's library, but if TagLib is dynamically bound the
version (at least minor and patch version) can change after building
client code.
This commit is contained in:
Michael Helmling 2016-07-23 13:08:23 +02:00
parent 821ff14a43
commit a16c95b33f

View File

@ -46,6 +46,8 @@
* \endcode
*/
#include <tuple>
namespace TagLib
{
enum ByteOrder
@ -53,6 +55,13 @@ namespace TagLib
LittleEndian,
BigEndian
};
/*!
* Returns the library's version information as 3-tuple of ints (for major, minor, patch version).
*/
std::tuple<int, int, int> version()
{
return std::make_tuple(TAGLIB_MAJOR_VERSION, TAGLIB_MINOR_VERSION, TAGLIB_PATCH_VERSION);
}
}
/*!