mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Extend dynamic version retrieval; remove C++11 dependency
This commit is contained in:
parent
a16c95b33f
commit
0f096af504
@ -321,6 +321,7 @@ set(matroska_SRCS
|
||||
)
|
||||
|
||||
set(toolkit_SRCS
|
||||
toolkit/taglib.cpp
|
||||
toolkit/tstring.cpp
|
||||
toolkit/tstringlist.cpp
|
||||
toolkit/tstringhandler.cpp
|
||||
|
34
taglib/toolkit/taglib.cpp
Normal file
34
taglib/toolkit/taglib.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "taglib.h"
|
||||
#include "tstring.h"
|
||||
#include <string>
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
String TagLib::GetVersionString()
|
||||
{
|
||||
return String::number(TAGLIB_MAJOR_VERSION)
|
||||
+ "." + String::number(TAGLIB_MINOR_VERSION)
|
||||
+ "." + String::number(TAGLIB_PATCH_VERSION);
|
||||
}
|
||||
|
||||
unsigned int TagLib::GetMajorVersion()
|
||||
{
|
||||
return TAGLIB_MAJOR_VERSION;
|
||||
}
|
||||
|
||||
unsigned int TagLib::GetMinorVersion()
|
||||
{
|
||||
return TAGLIB_MINOR_VERSION;
|
||||
}
|
||||
|
||||
unsigned int TagLib::GetPatchVersion()
|
||||
{
|
||||
return TAGLIB_PATCH_VERSION;
|
||||
}
|
||||
|
||||
unsigned int TagLib::GetVersion()
|
||||
{
|
||||
return (TAGLIB_MAJOR_VERSION << 16)
|
||||
|| (TAGLIB_MINOR_VERSION << 8)
|
||||
|| (TAGLIB_PATCH_VERSION << 4);
|
||||
}
|
@ -46,8 +46,6 @@
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
enum ByteOrder
|
||||
@ -55,13 +53,35 @@ namespace TagLib
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
};
|
||||
class String;
|
||||
/*!
|
||||
* Returns the library's version information as 3-tuple of ints (for major, minor, patch version).
|
||||
* Returns the version as a string in the form
|
||||
* (Major Version).(Minor Version).(Patch Version), e.g. "4.2.0".
|
||||
*/
|
||||
std::tuple<int, int, int> version()
|
||||
{
|
||||
return std::make_tuple(TAGLIB_MAJOR_VERSION, TAGLIB_MINOR_VERSION, TAGLIB_PATCH_VERSION);
|
||||
}
|
||||
String GetVersionString();
|
||||
|
||||
/*!
|
||||
* Returns the version as an unsigned integer in the form
|
||||
* (Major Version << 16) | (Minor Version << 8) | (Patch Version), e.g. 0x040200
|
||||
* Use this for simple and consistent version comparison, e.g.
|
||||
* if (TagLib::GetVersion() <= ((1 << 16) | (11 << 8))) return false;
|
||||
*/
|
||||
unsigned int GetVersion();
|
||||
|
||||
/*!
|
||||
* Returns the major version, e.g. 4
|
||||
*/
|
||||
unsigned int GetMajorVersion();
|
||||
|
||||
/*!
|
||||
* Returns the minor version, e.g. 2
|
||||
*/
|
||||
unsigned int GetMinorVersion();
|
||||
|
||||
/*!
|
||||
* Returns the patch version, e.g. 0
|
||||
*/
|
||||
unsigned int GetPatchVersion();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user