From c8f03b46c1e1dddd63450d3db140b3deba6fcb69 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Wed, 5 May 2010 09:54:19 +0200
Subject: [PATCH] Moved CPlusPlus::LookupItem.

---
 .../cplusplus/DeprecatedLookupContext.cpp     |  7 --
 src/libs/cplusplus/DeprecatedLookupContext.h  | 40 +---------
 src/libs/cplusplus/LookupItem.cpp             | 75 +++++++++++++++++++
 src/libs/cplusplus/LookupItem.h               | 68 +++++++++++++++++
 src/libs/cplusplus/cplusplus-lib.pri          |  2 +
 5 files changed, 146 insertions(+), 46 deletions(-)
 create mode 100644 src/libs/cplusplus/LookupItem.cpp
 create mode 100644 src/libs/cplusplus/LookupItem.h

diff --git a/src/libs/cplusplus/DeprecatedLookupContext.cpp b/src/libs/cplusplus/DeprecatedLookupContext.cpp
index 19ec1b96d59..0368c490295 100644
--- a/src/libs/cplusplus/DeprecatedLookupContext.cpp
+++ b/src/libs/cplusplus/DeprecatedLookupContext.cpp
@@ -41,13 +41,6 @@
 
 #include <QtDebug>
 
-uint CPlusPlus::qHash(const CPlusPlus::LookupItem &key)
-{
-    const uint h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type());
-    const uint h2 = QT_PREPEND_NAMESPACE(qHash)(key.lastVisibleSymbol());
-    return ((h1 << 16) | (h1 >> 16)) ^ h2;
-}
-
 using namespace CPlusPlus;
 
 /////////////////////////////////////////////////////////////////////
diff --git a/src/libs/cplusplus/DeprecatedLookupContext.h b/src/libs/cplusplus/DeprecatedLookupContext.h
index 186cd585d69..8914de01be8 100644
--- a/src/libs/cplusplus/DeprecatedLookupContext.h
+++ b/src/libs/cplusplus/DeprecatedLookupContext.h
@@ -31,41 +31,11 @@
 #define CPLUSPLUS_DEPRECATEDLOOKUPCONTEXT_H
 
 #include "CppDocument.h"
+#include "LookupItem.h"
 #include <FullySpecifiedType.h>
 
 namespace CPlusPlus {
 
-class CPLUSPLUS_EXPORT LookupItem
-{
-public:
-    LookupItem()
-        : _lastVisibleSymbol(0) {}
-
-    LookupItem(const FullySpecifiedType &type, Symbol *lastVisibleSymbol)
-        : _type(type), _lastVisibleSymbol(lastVisibleSymbol) {}
-
-    FullySpecifiedType type() const { return _type; }
-    void setType(const FullySpecifiedType &type) { _type = type; }
-
-    Symbol *lastVisibleSymbol() const { return _lastVisibleSymbol; }
-    void setLastVisibleSymbol(Symbol *symbol) { _lastVisibleSymbol = symbol; }
-
-    bool operator == (const LookupItem &other) const
-    {
-        if (_type == other._type)
-            return _lastVisibleSymbol == other._lastVisibleSymbol;
-
-        return false;
-    }
-
-    bool operator != (const LookupItem &result) const
-    { return ! operator == (result); }
-
-private:
-    FullySpecifiedType _type;
-    Symbol *_lastVisibleSymbol;
-};
-
 class CPLUSPLUS_EXPORT DeprecatedLookupContext
 {
 public:
@@ -228,14 +198,6 @@ private:
     QList<Scope *> _visibleScopes;
 };
 
-uint qHash(const CPlusPlus::LookupItem &result);
-
 } // end of namespace CPlusPlus
 
-#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
-//this ensures that code outside QmlJS can use the hash function
-//it also a workaround for some compilers
-inline uint qHash(const CPlusPlus::LookupItem &item) { return CPlusPlus::qHash(item); }
-#endif
-
 #endif // CPLUSPLUS_DEPRECATEDLOOKUPCONTEXT_H
diff --git a/src/libs/cplusplus/LookupItem.cpp b/src/libs/cplusplus/LookupItem.cpp
new file mode 100644
index 00000000000..c5e43674eff
--- /dev/null
+++ b/src/libs/cplusplus/LookupItem.cpp
@@ -0,0 +1,75 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "LookupItem.h"
+#include <FullySpecifiedType.h>
+#include <Symbol.h>
+#include <Control.h>
+
+#include <QtDebug>
+
+using namespace CPlusPlus;
+
+uint CPlusPlus::qHash(const CPlusPlus::LookupItem &key)
+{
+    const uint h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type());
+    const uint h2 = QT_PREPEND_NAMESPACE(qHash)(key.lastVisibleSymbol());
+    return ((h1 << 16) | (h1 >> 16)) ^ h2;
+}
+
+LookupItem::LookupItem()
+    : _lastVisibleSymbol(0)
+{ }
+
+LookupItem::LookupItem(const FullySpecifiedType &type, Symbol *lastVisibleSymbol)
+    : _type(type), _lastVisibleSymbol(lastVisibleSymbol)
+{ }
+
+FullySpecifiedType LookupItem::type() const
+{ return _type; }
+
+void LookupItem::setType(const FullySpecifiedType &type)
+{ _type = type; }
+
+Symbol *LookupItem::lastVisibleSymbol() const
+{ return _lastVisibleSymbol; }
+
+void LookupItem::setLastVisibleSymbol(Symbol *symbol)
+{ _lastVisibleSymbol = symbol; }
+
+bool LookupItem::operator == (const LookupItem &other) const
+{
+    if (_type == other._type)
+        return _lastVisibleSymbol == other._lastVisibleSymbol;
+
+    return false;
+}
+
+bool LookupItem::operator != (const LookupItem &result) const
+{ return ! operator == (result); }
diff --git a/src/libs/cplusplus/LookupItem.h b/src/libs/cplusplus/LookupItem.h
new file mode 100644
index 00000000000..fab6c61a9c5
--- /dev/null
+++ b/src/libs/cplusplus/LookupItem.h
@@ -0,0 +1,68 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef CPLUSPLUS_LOOKUPITEM_H
+#define CPLUSPLUS_LOOKUPITEM_H
+
+#include <FullySpecifiedType.h>
+#include <QtCore/QHash>
+
+namespace CPlusPlus {
+
+class CPLUSPLUS_EXPORT LookupItem
+{
+public:
+    LookupItem();
+    LookupItem(const FullySpecifiedType &type, Symbol *lastVisibleSymbol);
+
+    FullySpecifiedType type() const;
+    void setType(const FullySpecifiedType &type);
+
+    Symbol *lastVisibleSymbol() const;
+    void setLastVisibleSymbol(Symbol *symbol);
+
+    bool operator == (const LookupItem &other) const;
+    bool operator != (const LookupItem &other) const;
+
+private:
+    FullySpecifiedType _type;
+    Symbol *_lastVisibleSymbol;
+};
+
+uint qHash(const CPlusPlus::LookupItem &result);
+
+} // end of namespace CPlusPlus
+
+#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
+//this ensures that code outside QmlJS can use the hash function
+//it also a workaround for some compilers
+inline uint qHash(const CPlusPlus::LookupItem &item) { return CPlusPlus::qHash(item); }
+#endif
+
+#endif // CPLUSPLUS_LOOKUPITEM_H
diff --git a/src/libs/cplusplus/cplusplus-lib.pri b/src/libs/cplusplus/cplusplus-lib.pri
index d481b0ea512..3904b690ad3 100644
--- a/src/libs/cplusplus/cplusplus-lib.pri
+++ b/src/libs/cplusplus/cplusplus-lib.pri
@@ -34,6 +34,7 @@ HEADERS += \
     $$PWD/TypeOfExpression.h \
     $$PWD/TypePrettyPrinter.h \
     $$PWD/ResolveExpression.h \
+    $$PWD/LookupItem.h \
     $$PWD/DeprecatedLookupContext.h \
     $$PWD/CppBindings.h \
     $$PWD/ASTParent.h \
@@ -59,6 +60,7 @@ SOURCES += \
     $$PWD/TypeOfExpression.cpp \
     $$PWD/TypePrettyPrinter.cpp \
     $$PWD/ResolveExpression.cpp \
+    $$PWD/LookupItem.cpp \
     $$PWD/DeprecatedLookupContext.cpp \
     $$PWD/CppBindings.cpp \
     $$PWD/ASTParent.cpp \
-- 
GitLab