2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 Denis Mingulov
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2010-07-16 11:18:30 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-07-16 11:18:30 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMetaType>
|
|
|
|
|
#include <QString>
|
2010-07-16 11:18:30 +02:00
|
|
|
|
|
|
|
|
namespace ClassView {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class SymbolLocation
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
//! Default constructor
|
|
|
|
|
SymbolLocation();
|
|
|
|
|
|
|
|
|
|
//! Constructor
|
2021-02-16 01:37:49 +01:00
|
|
|
explicit SymbolLocation(const QString &file, int lineNumber = 0, int columnNumber = 0);
|
2010-07-16 11:18:30 +02:00
|
|
|
|
|
|
|
|
inline const QString &fileName() const { return m_fileName; }
|
|
|
|
|
inline int line() const { return m_line; }
|
|
|
|
|
inline int column() const { return m_column; }
|
2022-07-13 09:27:18 +02:00
|
|
|
inline size_t hash() const { return m_hash; }
|
2010-07-19 09:37:09 +02:00
|
|
|
inline bool operator==(const SymbolLocation &other) const
|
|
|
|
|
{
|
2021-02-16 01:37:49 +01:00
|
|
|
return hash() == other.hash() && line() == other.line() && column() == other.column()
|
2010-07-19 09:37:09 +02:00
|
|
|
&& fileName() == other.fileName();
|
|
|
|
|
}
|
2010-07-16 11:18:30 +02:00
|
|
|
|
|
|
|
|
private:
|
2021-02-16 01:37:49 +01:00
|
|
|
const QString m_fileName;
|
|
|
|
|
const int m_line;
|
|
|
|
|
const int m_column;
|
2022-07-13 09:27:18 +02:00
|
|
|
const size_t m_hash; // precalculated hash value - to speed up qHash
|
2010-07-16 11:18:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//! qHash overload for QHash/QSet
|
2022-07-13 09:27:18 +02:00
|
|
|
inline size_t qHash(const ClassView::Internal::SymbolLocation &location)
|
2010-07-16 11:18:30 +02:00
|
|
|
{
|
|
|
|
|
return location.hash();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-19 09:37:09 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClassView
|
|
|
|
|
|
2010-07-16 11:18:30 +02:00
|
|
|
Q_DECLARE_METATYPE(ClassView::Internal::SymbolLocation)
|