Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlprofilereventlocation_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLPROFILEREVENTLOCATION_P_H
5#define QQMLPROFILEREVENTLOCATION_P_H
6
7#include <QtCore/qstring.h>
8#include <QtCore/qhash.h>
9#include <QtCore/qdatastream.h>
10#include <QtCore/private/qglobal_p.h>
11
12//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. It exists purely as an
17// implementation detail. This header file may change from version to
18// version without notice, or even be removed.
19//
20// We mean it.
21//
22
24
26{
27public:
28 QQmlProfilerEventLocation() : m_line(-1),m_column(-1) {}
29 QQmlProfilerEventLocation(const QString &file, int lineNumber, int columnNumber) :
30 m_filename(file), m_line(lineNumber), m_column(columnNumber)
31 {}
32
33 void clear()
34 {
35 m_filename.clear();
36 m_line = m_column = -1;
37 }
38
39 bool isValid() const
40 {
41 return !m_filename.isEmpty();
42 }
43
44 QString filename() const { return m_filename; }
45 int line() const { return m_line; }
46 int column() const { return m_column; }
47
48private:
51
52 QString m_filename;
53 int m_line;
54 int m_column;
55};
56
57inline bool operator==(const QQmlProfilerEventLocation &location1,
58 const QQmlProfilerEventLocation &location2)
59{
60 // compare filename last as it's expensive.
61 return location1.line() == location2.line() && location1.column() == location2.column()
62 && location1.filename() == location2.filename();
63}
64
65inline bool operator!=(const QQmlProfilerEventLocation &location1,
66 const QQmlProfilerEventLocation &location2)
67{
68 return !(location1 == location2);
69}
70
72{
73 return qHash(location.filename())
74 ^ ((location.line() & 0xfff) // 12 bits of line number
75 | ((location.column() << 16) & 0xff0000)); // 8 bits of column
76
77}
78
81
83
85
86#endif // QQMLPROFILEREVENTLOCATION_P_H
\inmodule QtCore\reentrant
Definition qdatastream.h:46
friend QDataStream & operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location)
QQmlProfilerEventLocation(const QString &file, int lineNumber, int columnNumber)
friend QDataStream & operator>>(QDataStream &stream, QQmlProfilerEventLocation &location)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1252
Combined button and popup list for selecting options.
EGLStreamKHR stream
GLint location
size_t qHash(const QQmlProfilerEventLocation &location)
QDataStream & operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location)
bool operator!=(const QQmlProfilerEventLocation &location1, const QQmlProfilerEventLocation &location2)
bool operator==(const QQmlProfilerEventLocation &location1, const QQmlProfilerEventLocation &location2)
QDataStream & operator>>(QDataStream &stream, QQmlProfilerEventLocation &location)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
QFile file
[0]