blob: 40ac200491dda9500620d552132dbf09584eb099 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (C) 2016 Denis Mingulov
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/filepath.h>
#include <QMetaType>
namespace ClassView::Internal {
class SymbolLocation
{
public:
//! Default constructor
SymbolLocation();
//! Constructor
explicit SymbolLocation(const Utils::FilePath &file, int lineNumber = 0, int columnNumber = 0);
const Utils::FilePath &filePath() const { return m_fileName; }
int line() const { return m_line; }
int column() const { return m_column; }
size_t hash() const { return m_hash; }
bool operator==(const SymbolLocation &other) const
{
return hash() == other.hash() && line() == other.line() && column() == other.column()
&& filePath() == other.filePath();
}
private:
const Utils::FilePath m_fileName;
const int m_line;
const int m_column;
const size_t m_hash; // precalculated hash value - to speed up qHash
};
//! qHash overload for QHash/QSet
inline size_t qHash(const ClassView::Internal::SymbolLocation &location)
{
return location.hash();
}
} // ClassView::Internal
Q_DECLARE_METATYPE(ClassView::Internal::SymbolLocation)
|