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// Qt-Security score:significant
4
5#ifndef QQMLPROFILEREVENTLOCATION_P_H
6#define QQMLPROFILEREVENTLOCATION_P_H
7
8#include <QtCore/qstring.h>
9#include <QtCore/qhash.h>
10#include <QtCore/qdatastream.h>
11#include <QtCore/private/qglobal_p.h>
12
13//
14// W A R N I N G
15// -------------
16//
17// This file is not part of the Qt API. It exists purely as an
18// implementation detail. This header file may change from version to
19// version without notice, or even be removed.
20//
21// We mean it.
22//
23
25
26class QQmlProfilerEventLocation
27{
28public:
29 QQmlProfilerEventLocation() : m_line(-1),m_column(-1) {}
30 QQmlProfilerEventLocation(const QString &file, int lineNumber, int columnNumber) :
31 m_filename(file), m_line(lineNumber), m_column(columnNumber)
32 {}
33
34 void clear()
35 {
36 m_filename.clear();
37 m_line = m_column = -1;
38 }
39
40 bool isValid() const
41 {
42 return !m_filename.isEmpty();
43 }
44
45 QString filename() const { return m_filename; }
46 int line() const { return m_line; }
47 int column() const { return m_column; }
48
49private:
50 friend QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventLocation &location);
51 friend QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location);
52
53 friend size_t qHash(const QQmlProfilerEventLocation &key, size_t seed = 0) noexcept
54 { return qHashMulti(seed, key.m_filename, key.m_line, key.m_column); }
55
56 QString m_filename;
57 int m_line;
58 int m_column;
59};
60
61inline bool operator==(const QQmlProfilerEventLocation &location1,
62 const QQmlProfilerEventLocation &location2)
63{
64 // compare filename last as it's expensive.
65 return location1.line() == location2.line() && location1.column() == location2.column()
66 && location1.filename() == location2.filename();
67}
68
69inline bool operator!=(const QQmlProfilerEventLocation &location1,
70 const QQmlProfilerEventLocation &location2)
71{
72 return !(location1 == location2);
73}
74
75QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventLocation &location);
76QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventLocation &location);
77
78Q_DECLARE_TYPEINFO(QQmlProfilerEventLocation, Q_RELOCATABLE_TYPE);
79
80QT_END_NAMESPACE
81
82#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)
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)