QQmlSA::SourceLocation Class
class QQmlSA::SourceLocation代表源代码中的位置或区域。更多
头文件: | #include <SourceLocation> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS QmlCompiler) target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler) |
状态: 技术预览 | 技术预览 |
公共函数
SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0) | |
SourceLocation(const QQmlSA::SourceLocation &other) | |
SourceLocation(QQmlSA::SourceLocation &&other) | |
~SourceLocation() | |
quint32 | begin() const |
quint32 | end() const |
QQmlSA::SourceLocation | endZeroLengthLocation(QStringView text) const |
bool | isValid() const |
quint32 | length() const |
quint32 | offset() const |
quint32 | startColumn() const |
quint32 | startLine() const |
QQmlSA::SourceLocation | startZeroLengthLocation() const |
QQmlSA::SourceLocation & | operator=(QQmlSA::SourceLocation &&other) |
QQmlSA::SourceLocation & | operator=(const QQmlSA::SourceLocation &other) |
相关非成员
qsizetype | qHash(const QQmlSA::SourceLocation &location, qsizetype seed = 0) |
bool | operator!=(const QQmlSA::SourceLocation &lhs, const QQmlSA::SourceLocation &rhs) |
bool | operator==(const QQmlSA::SourceLocation &lhs, const QQmlSA::SourceLocation &rhs) |
成员函数文档
[explicit]
SourceLocation::SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0)
构建一个新的源位置,其值由offset,length,line 和column 给出。
SourceLocation::SourceLocation(const QQmlSA::SourceLocation &other)
创建other 的副本。
[noexcept]
SourceLocation::SourceLocation(QQmlSA::SourceLocation &&other)
移动-从other 构建源位置。
[noexcept]
SourceLocation::~SourceLocation()
销毁SourceLocation 实例。
quint32 SourceLocation::begin() const
返回源位置开头的偏移量。
quint32 SourceLocation::end() const
返回源位置末端的偏移量。
QQmlSA::SourceLocation SourceLocation::endZeroLengthLocation(QStringView text) const
返回指向text 的该源位置末尾的长度为 0 的源位置。
bool SourceLocation::isValid() const
如果SourceLocation 有效,则返回true
,否则返回false
。
quint32 SourceLocation::length() const
返回源位置的长度。
quint32 SourceLocation::offset() const
返回源位置开头的偏移量。
quint32 SourceLocation::startColumn() const
返回包含该源位置起始列的列号。
quint32 SourceLocation::startLine() const
返回包含源位置起始行的行号。
QQmlSA::SourceLocation SourceLocation::startZeroLengthLocation() const
返回一个长度为 0 的源位置,指向该源位置的起点。
[noexcept]
QQmlSA::SourceLocation &SourceLocation::operator=(QQmlSA::SourceLocation &&other)
移动--将other 分配到此SourceLocation 。
QQmlSA::SourceLocation &SourceLocation::operator=(const QQmlSA::SourceLocation &other)
将other 分配给此SourceLocation 。
相关非会员
qsizetype qHash(const QQmlSA::SourceLocation &location, qsizetype seed = 0)
返回location 的哈希值,使用seed 作为计算的种子。
bool operator!=(const QQmlSA::SourceLocation &lhs, const QQmlSA::SourceLocation &rhs)
如果lhs 不等于rhs ,则返回 true,否则返回false
。关于两个源位置何时被视为相等,请参阅SourceLocation::operator== 。
bool operator==(const QQmlSA::SourceLocation &lhs, const QQmlSA::SourceLocation &rhs)
如果lhs 等于rhs ,则返回 true,否则返回false
。如果两个 SourceLocations 的偏移、长度、行和列成员值相同,则视为相等。
© 2025 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.