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
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
25class QQmlProfilerEventLocation
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:
49 friend QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventLocation &location);
50 friend QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location);
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
71inline size_t qHash(const QQmlProfilerEventLocation &location)
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
79QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventLocation &location);
80QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location);
81
82Q_DECLARE_TYPEINFO(QQmlProfilerEventLocation, Q_RELOCATABLE_TYPE);
83
84QT_END_NAMESPACE
85
86#endif // QQMLPROFILEREVENTLOCATION_P_H
void setFlushInterval(quint32 flushInterval)
quint64 recordedFeatures() const
void traceFinished(qint64 timestamp, const QList< int > &engineIds)
void setRequestedFeatures(quint64 features)
void recordedFeaturesChanged(quint64 features)
void traceStarted(qint64 timestamp, const QList< int > &engineIds)
virtual void messageReceived(const QByteArray &) override
void recordingChanged(bool arg)
QQmlProfilerClient(QQmlProfilerClientPrivate &dd)
void onStateChanged(State status)
void sendRecordingStatus(int engineId=-1)
Combined button and popup list for selecting options.
QDataStream & operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location)
size_t qHash(const QQmlProfilerEventLocation &location)
Q_DECLARE_TYPEINFO(QQmlProfilerEventLocation, Q_RELOCATABLE_TYPE)
bool operator!=(const QQmlProfilerEventLocation &location1, const QQmlProfilerEventLocation &location2)
bool operator==(const QQmlProfilerEventLocation &location1, const QQmlProfilerEventLocation &location2)
QDataStream & operator>>(QDataStream &stream, QQmlProfilerEventLocation &location)