Adjust version macros to TagLib naming conventions; use dedicated namespace

This commit is contained in:
Michael Helmling 2016-07-30 13:47:46 +02:00
parent 0f096af504
commit c352425ee7
2 changed files with 47 additions and 41 deletions

View File

@ -4,31 +4,34 @@
using namespace TagLib;
String TagLib::GetVersionString()
String TagLib::Version::string()
{
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()
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;
}

View File

@ -54,34 +54,37 @@ namespace TagLib
BigEndian
};
class String;
/*!
* Returns the version as a string in the form
* (Major Version).(Minor Version).(Patch Version), e.g. "4.2.0".
*/
String GetVersionString();
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 GetVersion();
/*!
* 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 GetMajorVersion();
/*!
* Returns the major version, e.g. 4
*/
unsigned int (major)();
/*!
* Returns the minor version, e.g. 2
*/
unsigned int GetMinorVersion();
/*!
* Returns the minor version, e.g. 2
*/
unsigned int (minor)();
/*!
* Returns the patch version, e.g. 0
*/
unsigned int GetPatchVersion();
/*!
* Returns the patch version, e.g. 0
*/
unsigned int patch();
}
}
/*!