QBEInteger Class
template <typename T> class QBEIntegerQBEInteger 类提供了一种与平台无关的大端序整数类型。更多内容...
| 头文件: | #include <QBEInteger> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
公共函数
| QBEInteger(T value) | |
| operator T() const | |
| bool | operator!=(QBEInteger<T> other) const |
| QBEInteger<T> & | operator%=(T i) |
| QBEInteger<T> & | operator&=(T i) |
| QBEInteger<T> & | operator*=(T i) |
| QBEInteger<T> & | operator++() |
| QBEInteger<T> | operator++(int) |
| QBEInteger<T> & | operator+=(T i) |
| QBEInteger<T> & | operator--() |
| QBEInteger<T> | operator--(int) |
| QBEInteger<T> & | operator-=(T i) |
| QBEInteger<T> & | operator/=(T i) |
| QBEInteger<T> & | operator<<=(T i) |
| QBEInteger<T> & | operator=(T i) |
| bool | operator==(QBEInteger<T> other) const |
| QBEInteger<T> & | operator>>=(T i) |
| QBEInteger<T> & | operator^=(T i) |
| QBEInteger<T> & | operator|=(T i) |
静态公共成员
详细说明
QBEInteger<T> 以大端字节序存储整数值,其中T 指定了底层的C++整数类型。模板参数T 必须是C++整数类型:
- 8 位:char、signed char、unsigned char、qint8、quint8
- 16 位:short、unsigned short、qint16、quint16、char16_t
- 32 位:int、unsigned int、qint32、quint32、char32_t
- 64 位:long long、unsigned long long、qint64、quint64
- 平台特定大小:long、unsigned long
- 指针大小:qintptr、quintptr、qptrdiff
注意:使用 此类可能比使用原生整数速度更慢,因此仅在需要精确字节序时才应使用。
成员函数文档
[explicit constexpr] QBEInteger::QBEInteger(T value)
根据给定的value ,构建一个QBEInteger对象。
[static constexpr] QBEInteger<T> QBEInteger::max()
返回数值类型 T 所能表示的最大(有限)值。
[static constexpr] QBEInteger<T> QBEInteger::min()
返回数值类型 T 所能表示的最小(有限)值。
QBEInteger::operator T() const
将此QBEInteger 的值作为本机整数返回。
bool QBEInteger::operator!=(QBEInteger<T> other) const
如果该QBEInteger 的值与other 的值不一致,则返回true 。
QBEInteger<T> &QBEInteger::operator%=(T i)
将此QBEInteger 设置为除以i 后的余数,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator&=(T i)
对该QBEInteger 执行与i 的位与运算,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator*=(T i)
将 `i ` 与 `QBEInteger ` 相乘,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator++()
对该QBEInteger 执行前缀++ (递增)操作,并返回对此对象的引用。
QBEInteger<T> QBEInteger::operator++(int)
对该QBEInteger 执行后缀++ (递增)操作,并返回对该对象的引用。
QBEInteger<T> &QBEInteger::operator+=(T i)
将i 添加到此QBEInteger 中,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator--()
对该QBEInteger 执行前缀-- (递减)操作,并返回对该对象的引用。
QBEInteger<T> QBEInteger::operator--(int)
对该QBEInteger 执行后缀-- (递减)操作,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator-=(T i)
从该对象i 中减去QBEInteger ,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator/=(T i)
将此QBEInteger 与i 进行分割,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator<<=(T i)
对该QBEInteger 执行i 的右移操作,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator=(T i)
将i 赋值给此QBEInteger ,并返回对此QBEInteger 的引用。
bool QBEInteger::operator==(QBEInteger<T> other) const
如果此QBEInteger 的值与other 的值相等,则返回true 。
QBEInteger<T> &QBEInteger::operator>>=(T i)
对该QBEInteger 执行i 的左移操作,并返回对此对象的引用。
QBEInteger<T> &QBEInteger::operator^=(T i)
对该QBEInteger 对象与i 执行位异或运算,并返回该对象的引用。
QBEInteger<T> &QBEInteger::operator|=(T i)
对该QBEInteger 执行与i 的按位或运算,并返回对此对象的引用。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.