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
8#include <private/qqmljssourcelocation_p.h>
9
11
12using namespace Qt::StringLiterals;
13
14namespace QQmlSA {
15
16static_assert(SourceLocationPrivate::sizeOfSourceLocation() == sizeof(SourceLocation));
17
18/*!
19 \class QQmlSA::SourceLocation
20 \inmodule QtQmlCompiler
21
22 \brief Represents a location or region in the source code.
23 */
24
25/*!
26 Constructs a new SourceLocation with values given by \a offset, \a length,
27 \a line, and \a column.
28 */
33
34// explicitly defaulted out-of-line for PIMPL
35/*!
36 Creates a copy of \a other.
37 */
39
40/*!
41 \fn SourceLocation::SourceLocation(SourceLocation &&other) noexcept
42 Move-Constructs a SourceLocation from \a other.
43 */
44
45/*!
46 Assigns \a other to this SourceLocation.
47 */
49
50/*!
51 \fn SourceLocation &SourceLocation::operator=(SourceLocation &&other) noexcept
52 Move-assigns \a other to this SourceLocation.
53 */
54
55/*!
56 Destructs this SourceLocation instance.
57 */
58SourceLocation::~SourceLocation() = default;
59
60/*!
61 Returns \c true is this SourceLocation is valid, \c false otherwise.
62 */
64{
66}
67
68/*!
69 Returns the offset of the beginning of this source location.
70 */
72{
73 return offset();
74}
75
76/*!
77 Returns the offset of the end of this source location.
78 */
80{
81 return offset() + length();
82}
83
84/*!
85 Returns the offset of the beginning of this source location.
86 */
91
92/*!
93 Returns the length of this source location.
94 */
99
100/*!
101 Returns the line number containing the beginning of this source location.
102 */
107
108/*!
109 Returns the column number containing the beginning of this source location.
110 */
115
116/*!
117 Returns a source location of lenth zero pointing to the beginning of this
118 source location.
119 */
129
130/*!
131 Returns a source location of lenth zero pointing to the end of this source
132 location pointing to \a text.
133 */
142
143/*!
144 \fn friend qsizetype SourceLocation::qHash(const SourceLocation &location, qsizetype seed)
145 Returns the hash value for \a location, using \a seed to seed the calculation.
146 */
147
148/*!
149 \fn friend bool SourceLocation::operator==(const SourceLocation &lhs, const SourceLocation &rhs)
150 Returns true if \a lhs equals \a rhs, and \c false otherwise.
151 Two SourceLocations are considered equal if they have the same values for
152 their offset, length, line, and column members.
153 */
154/*!
155 \fn friend bool SourceLocation::operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
156 Returns true if \a lhs does not equal \a rhs, and \c false otherwise.
157 See \l {SourceLocation::operator==} for when two source locations are considered equal.
158 */
159
161{
163}
164
166 const SourceLocation &rhs)
167{
170}
171
172/*!
173 Returns the source location of the origin of any QML document.
174 */
179
180} // namespace QQmlSA
181
182QT_END_NAMESPACE
\inmodule QtQmlCompiler
\inmodule QtQmlCompiler
Combined button and popup list for selecting options.