Version Class
class Visindigo::General::Version在现有主流版本号表示方法中找到的一个折中方案。. 详情...
| 头文件: | #include <General/Version.h> |
| 自以下版本: | Visindigo 0.13.0 |
公开成员函数
| Version() | |
| Version(const QString &version) | |
| Version(quint32 major, quint32 minor, quint32 patch, bool useBuild = false, quint32 build = 0, const QString &nickName = "") | |
| Version(const Visindigo::General::Version &other) | |
| Version(Visindigo::General::Version &&other) | |
| ~Version() | |
| quint32 | getBuild() const |
| quint32 | getMajor() const |
| quint32 | getMinor() const |
| QString | getNickName() const |
| quint32 | getPatch() const |
| bool | getUseBuild() const |
| void | setNickName(const QString &name) |
| void | setVersion(const QString &version) |
| void | setVersion(quint32 major, quint32 minor, quint32 patch, bool useBuild, quint32 build = 0, const QString &nickName = "") |
| QString | toString() |
| bool | operator!=(const Visindigo::General::Version &other) const |
| bool | operator<(const Visindigo::General::Version &other) const |
| bool | operator<=(const Visindigo::General::Version &other) const |
| Visindigo::General::Version & | operator=(Visindigo::General::Version &&other) |
| Visindigo::General::Version & | operator=(const Visindigo::General::Version &other) |
| bool | operator==(const Visindigo::General::Version &other) const |
| bool | operator>(const Visindigo::General::Version &other) const |
| bool | operator>=(const Visindigo::General::Version &other) const |
静态公开成员
| Visindigo::General::Version | getABIVersion() |
| Visindigo::General::Version | getAPIVersion() |
宏
| Compiled_VIABI_Version | |
| Visindigo_ABI_VERSION_MAJOR | |
| Visindigo_ABI_VERSION_MINOR | |
| Visindigo_VERSION_MAJOR | |
| Visindigo_VERSION_MINOR | |
| Visindigo_VERSION_PATCH |
详细说明
版本号类,表示软件的版本信息。版本号由主版本号、次版本号、修订号、可选的构建号和可选的昵称组成。
这个类支持复制和移动,并且提供了比较运算符来比较不同版本号的大小关系。
成员函数文档
Version::Version()
默认构造函数,创建一个版本号为0.0.0的对象。默认不使用构建号,昵称为空。
另请参阅 setVersion().
Version::Version(const QString &version)
version 版本号字符串,格式为 "major.minor.patch[.build] [nickName]"。
如果字符串格式不正确,则版本号保持为默认值0.0.0。
Version::Version(quint32 major, quint32 minor, quint32 patch, bool useBuild = false, quint32 build = 0, const QString &nickName = "")
major 主版本号 minor 次版本号 patch 修订号 useBuild 是否使用构建号 build 构建号 nickName 昵称
构建号默认不使用且值为0,昵称默认为空字符串。
Version::Version(const Visindigo::General::Version &other)
other 另一个版本号对象。
复制构造函数,创建一个与 other 相同的版本号对象。
[noexcept] Version::Version(Visindigo::General::Version &&other)
other 另一个版本号对象。
移动构造函数,转移 other 的资源到新对象中,other 变为空对象。
[noexcept] Version::~Version()
析构函数,释放资源。
[static] Visindigo::General::Version Version::getABIVersion()
返回Visindigo在编译时的ABI版本号。
[static] Visindigo::General::Version Version::getAPIVersion()
返回Visindigo在编译时的API版本号。
quint32 Version::getBuild() const
返回构建号。
quint32 Version::getMajor() const
返回主版本号。
quint32 Version::getMinor() const
返回次版本号。
QString Version::getNickName() const
返回昵称。
quint32 Version::getPatch() const
返回修订号。
bool Version::getUseBuild() const
返回是否使用构建号。
void Version::setNickName(const QString &name)
name 昵称
void Version::setVersion(const QString &version)
version 版本号字符串,格式为 "major.minor.patch[.build] [nickName]"。
如果字符串格式不正确,则版本号保持不变。
void Version::setVersion(quint32 major, quint32 minor, quint32 patch, bool useBuild, quint32 build = 0, const QString &nickName = "")
major 主版本号 minor 次版本号 patch 修订号 useBuild 是否使用构建号 build 构建号 nickName 昵称
QString Version::toString()
将版本号转换为字符串表示,格式为 "major.minor.patch[.build] [nickName]"。
bool Version::operator!=(const Visindigo::General::Version &other) const
other 另一个版本号对象。
不等于运算符,是等于运算符的取反。
bool Version::operator<(const Visindigo::General::Version &other) const
other 另一个版本号对象。
小于运算符,比较当前对象与 other 的版本号大小。它依次比较主版本号、次版本号、修订号和构建号(如果使用)。
bool Version::operator<=(const Visindigo::General::Version &other) const
other 另一个版本号对象。
小于等于运算符,是小于运算符和等于运算符的取或。
[noexcept] Visindigo::General::Version &Version::operator=(Visindigo::General::Version &&other)
other 另一个版本号对象。
移动赋值运算符,将 other 的资源转移到当前对象中,other 变为空对象。
Visindigo::General::Version &Version::operator=(const Visindigo::General::Version &other)
other 另一个版本号对象。
复制赋值运算符,将 other 的值赋给当前对象。
bool Version::operator==(const Visindigo::General::Version &other) const
other 另一个版本号对象。
等于运算符,比较当前对象与 other 的版本号是否相等。它比较主版本号、次版本号、修订号和构建号(如果使用)。
bool Version::operator>(const Visindigo::General::Version &other) const
other 另一个版本号对象。
大于运算符,比较当前对象与 other 的版本号大小。它依次比较主版本号、次版本号、修订号和构建号(如果使用)。
bool Version::operator>=(const Visindigo::General::Version &other) const
other 另一个版本号对象。
大于等于运算符,是大于运算符和等于运算符的取或。
宏文档
Compiled_VIABI_Version
定义编译时的Visindigo ABI版本号。
这和 Version::getABIVersion() 在使用上略有区别。
因为它是被定义在头文件里的,因此在编译期就被确定,可以静态的留存在程序中, 被用来保存编译时的ABI版本号信息。Visindigo::General::Plugin就使用此宏 来固定编译ABI版本号。
而 Version::getABIVersion() 则可在运行时调用, 更多的是用来在运行时查询所使用的Visindigo库的ABI版本号信息。
当编译版本与使用的库版本一致时,这两个版本号是相同的。
Visindigo_ABI_VERSION_MAJOR
定义Visindigo的ABI主版本号。
Visindigo_ABI_VERSION_MINOR
定义Visindigo的ABI次版本号。
Visindigo_VERSION_MAJOR
定义Visindigo的主版本号。
Visindigo_VERSION_MINOR
定义Visindigo的次版本号。
Visindigo_VERSION_PATCH
定义Visindigo的修订号。