From 5871f2bb8181b39357cffa5677a75424151ca494 Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Mon, 19 Jul 2010 09:37:09 +0200 Subject: [PATCH] Fix compilation (workaround for probable gcc bug). Original version looks fine to me, but fails to compile with e.g. gcc versions Ubuntu 4.4.3-4ubuntu5 and Debian 4.4.4-6. Reviewed-by: Kai Koehne Reviewed-by: kh1 --- .../classview/classviewsymbolinformation.h | 20 +++++++++---------- .../classview/classviewsymbollocation.h | 19 +++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/plugins/classview/classviewsymbolinformation.h b/src/plugins/classview/classviewsymbolinformation.h index 988fb0f0b73..3c03c308562 100644 --- a/src/plugins/classview/classviewsymbolinformation.h +++ b/src/plugins/classview/classviewsymbolinformation.h @@ -53,6 +53,11 @@ public: inline const QString &type() const { return m_type; } inline int iconType() const { return m_iconType; } inline uint hash() const { return m_hash; } + inline bool operator==(const SymbolInformation &other) const + { + return iconType() == other.iconType() && name() == other.name() + && type() == other.type(); + } /*! \brief Get an icon type sort order. Not pre-calculated - is needed for converting @@ -69,21 +74,16 @@ private: uint m_hash; //!< precalculated hash value - to speed up qHash }; -} // namespace Internal -} // namespace ClassView - -inline bool operator==(const ClassView::Internal::SymbolInformation &a, - const ClassView::Internal::SymbolInformation &b) -{ - return a.iconType() == b.iconType() && a.name() == b.name() && a.type() == b.type(); -} - //! qHash overload for QHash/QSet -inline uint qHash(const ClassView::Internal::SymbolInformation &information) +inline uint qHash(const SymbolInformation &information) { return information.hash(); } + +} // namespace Internal +} // namespace ClassView + Q_DECLARE_METATYPE(ClassView::Internal::SymbolInformation) #endif // CLASSVIEWSYMBOLINFORMATION_H diff --git a/src/plugins/classview/classviewsymbollocation.h b/src/plugins/classview/classviewsymbollocation.h index b886a2470f6..cc028bb002d 100644 --- a/src/plugins/classview/classviewsymbollocation.h +++ b/src/plugins/classview/classviewsymbollocation.h @@ -54,6 +54,11 @@ public: inline int line() const { return m_line; } inline int column() const { return m_column; } inline int hash() const { return m_hash; } + inline bool operator==(const SymbolLocation &other) const + { + return line() == other.line() && column() == other.column() + && fileName() == other.fileName(); + } private: QString m_fileName; //!< file name @@ -62,21 +67,15 @@ private: int m_hash; //!< precalculated hash value for the object, to speed up qHash }; -} // namespace Internal -} // namespace ClassView - -inline bool operator==(const ClassView::Internal::SymbolLocation &a, - const ClassView::Internal::SymbolLocation &b) -{ - return a.line() == b.line() && a.column() == b.column() && a.fileName() == b.fileName(); -} - //! qHash overload for QHash/QSet -inline uint qHash(const ClassView::Internal::SymbolLocation &location) +inline uint qHash(const SymbolLocation &location) { return location.hash(); } +} // namespace Internal +} // namespace ClassView + Q_DECLARE_METATYPE(ClassView::Internal::SymbolLocation) #endif // CLASSVIEWSYMBOLLOCATION_H -- GitLab