aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-12-06 05:11:04 +0100
committerhjk <hjk@qt.io>2021-12-06 17:10:49 +0000
commit104ea4accc8bf7d2e317c10638a299c3af267ede (patch)
tree8ab53d49a45cb72372a5294d272a7e43c815d661 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent8cb5c3cfdd07f98449d3df0a676c5026c33f6b7a (diff)
Make some qHash and comparison operators overloads hidden friends
Restricts lookup scope more to necessary bits. Change-Id: Ia42c95aaa70534843b7f6a90bfc56d2a1202c612 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 59bd65c092..8cfff10c65 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -82,27 +82,29 @@ using namespace TextEditor;
using namespace Core;
using namespace ProjectExplorer;
-class OverrideItem {
+class OverrideItem
+{
public:
OverrideItem() : line(0) {}
OverrideItem(const QString &text, int line = 0) : text(text), line(line) {}
+
bool isValid() { return line != 0; }
QByteArray toByteArray() const
{
return "OverrideItem(" + text.toLatin1() + ", " + QByteArray::number(line) + ')';
}
+ friend bool operator==(const OverrideItem &lhs, const OverrideItem &rhs)
+ {
+ return lhs.text == rhs.text && lhs.line == rhs.line;
+ }
+
QString text;
int line;
};
typedef QList<OverrideItem> OverrideItemList;
Q_DECLARE_METATYPE(OverrideItem)
-inline bool operator==(const OverrideItem &lhs, const OverrideItem &rhs)
-{
- return lhs.text == rhs.text && lhs.line == rhs.line;
-}
-
QT_BEGIN_NAMESPACE
namespace QTest {
template<> char *toString(const OverrideItem &data)