Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsasourcelocation.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
7
9
10using namespace Qt::StringLiterals;
11
12namespace QQmlSA {
13
14static_assert(SourceLocationPrivate::sizeOfSourceLocation() == sizeof(SourceLocation));
15
16/*!
17 \class QQmlSA::SourceLocation
18 \inmodule QtQmlCompiler
19
20 \brief Represents a location or region in the source code.
21 */
22
23/*!
24 Constructs a new SourceLocation with values given by \a offset, \a length,
25 \a line, and \a column.
26 */
31
32// explicitly defaulted out-of-line for PIMPL
33/*!
34 Creates a copy of \a other.
35 */
37
38/*!
39 \fn SourceLocation::SourceLocation(SourceLocation &&other) noexcept
40 Move-Constructs a SourceLocation from \a other.
41 */
42
43/*!
44 Assigns \a other to this SourceLocation.
45 */
47
48/*!
49 \fn SourceLocation &SourceLocation::operator=(SourceLocation &&other) noexcept
50 Move-assigns \a other to this SourceLocation.
51 */
52
53/*!
54 Destructs this SourceLocation instance.
55 */
56SourceLocation::~SourceLocation() = default;
57
58/*!
59 Returns \c true is this SourceLocation is valid, \c false otherwise.
60 */
62{
64}
65
66/*!
67 Returns the offset of the beginning of this source location.
68 */
70{
71 return offset();
72}
73
74/*!
75 Returns the offset of the end of this source location.
76 */
78{
79 return offset() + length();
80}
81
82/*!
83 Returns the offset of the beginning of this source location.
84 */
89
90/*!
91 Returns the length of this source location.
92 */
97
98/*!
99 Returns the line number containing the beginning of this source location.
100 */
105
106/*!
107 Returns the column number containing the beginning of this source location.
108 */
113
114/*!
115 Returns a source location of lenth zero pointing to the beginning of this
116 source location.
117 */
127
128/*!
129 Returns a source location of lenth zero pointing to the end of this source
130 location pointing to \a text.
131 */
140
141/*!
142 \fn friend qsizetype SourceLocation::qHash(const SourceLocation &location, qsizetype seed)
143 Returns the hash value for \a location, using \a seed to seed the calculation.
144 */
145
146/*!
147 \fn friend bool SourceLocation::operator==(const SourceLocation &lhs, const SourceLocation &rhs)
148 Returns true if \a lhs equals \a rhs, and \c false otherwise.
149 Two SourceLocations are considered equal if they have the same values for
150 their offset, length, line, and column members.
151 */
152/*!
153 \fn friend bool SourceLocation::operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
154 Returns true if \a lhs does not equal \a rhs, and \c false otherwise.
155 See \l {SourceLocation::operator==} for when two source locations are considered equal.
156 */
157
159{
161}
162
164 const SourceLocation &rhs)
165{
168}
169
170} // namespace QQmlSA
171
172QT_END_NAMESPACE
\inmodule QtQmlCompiler
\inmodule QtQmlCompiler