mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Merge pull request #748 from supermihi/taglib2
Adds a function for dynamic version information retrieval
This commit is contained in:
commit
a64772a832
@ -321,6 +321,7 @@ set(matroska_SRCS
|
||||
)
|
||||
|
||||
set(toolkit_SRCS
|
||||
toolkit/taglib.cpp
|
||||
toolkit/tstring.cpp
|
||||
toolkit/tstringlist.cpp
|
||||
toolkit/tstringhandler.cpp
|
||||
|
37
taglib/toolkit/taglib.cpp
Normal file
37
taglib/toolkit/taglib.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "taglib.h"
|
||||
#include "tstring.h"
|
||||
#include <string>
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
|
||||
String TagLib::Version::string()
|
||||
{
|
||||
return String::number(TAGLIB_MAJOR_VERSION)
|
||||
+ "." + String::number(TAGLIB_MINOR_VERSION)
|
||||
+ "." + String::number(TAGLIB_PATCH_VERSION);
|
||||
}
|
||||
|
||||
unsigned int TagLib::Version::combined()
|
||||
{
|
||||
return (TAGLIB_MAJOR_VERSION << 16)
|
||||
|| (TAGLIB_MINOR_VERSION << 8)
|
||||
|| (TAGLIB_PATCH_VERSION << 4);
|
||||
}
|
||||
|
||||
|
||||
unsigned int (TagLib::Version::major)()
|
||||
{
|
||||
return TAGLIB_MAJOR_VERSION;
|
||||
}
|
||||
|
||||
unsigned int (TagLib::Version::minor)()
|
||||
{
|
||||
return TAGLIB_MINOR_VERSION;
|
||||
}
|
||||
|
||||
unsigned int TagLib::Version::patch()
|
||||
{
|
||||
return TAGLIB_PATCH_VERSION;
|
||||
}
|
||||
|
@ -53,6 +53,38 @@ namespace TagLib
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
};
|
||||
class String;
|
||||
namespace Version
|
||||
{
|
||||
/*!
|
||||
* Returns the version as a string in the form
|
||||
* (Major Version).(Minor Version).(Patch Version), e.g. "4.2.0".
|
||||
*/
|
||||
String string();
|
||||
|
||||
/*!
|
||||
* 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 combined();
|
||||
|
||||
/*!
|
||||
* Returns the major version, e.g. 4
|
||||
*/
|
||||
unsigned int (major)();
|
||||
|
||||
/*!
|
||||
* Returns the minor version, e.g. 2
|
||||
*/
|
||||
unsigned int (minor)();
|
||||
|
||||
/*!
|
||||
* Returns the patch version, e.g. 0
|
||||
*/
|
||||
unsigned int patch();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user