forked from qt-creator/qt-creator
Refactoring LookupContext.h
Extracting class AlreadyConsideredClassContainer to separate file Change-Id: If3bb89df5ce0bae87723ad4ecab7118337df0655 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
eb39b57e24
commit
70e3356a02
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "CppDocument.h"
|
||||
#include "LookupItem.h"
|
||||
#include "AlreadyConsideredClassContainer.h"
|
||||
#include <FullySpecifiedType.h>
|
||||
#include <Type.h>
|
||||
#include <SymbolVisitor.h>
|
||||
@@ -44,41 +45,6 @@
|
||||
namespace CPlusPlus {
|
||||
|
||||
class CreateBindings;
|
||||
class Class;
|
||||
template<typename T>
|
||||
class AlreadyConsideredClassContainer
|
||||
{
|
||||
public:
|
||||
AlreadyConsideredClassContainer() : _class(0) {}
|
||||
void insert(const T *item)
|
||||
{
|
||||
if (_container.isEmpty())
|
||||
_class = item;
|
||||
_container.insert(item);
|
||||
}
|
||||
bool contains(const T *item)
|
||||
{
|
||||
if (_container.contains(item))
|
||||
return true;
|
||||
|
||||
foreach (const T *existingItem, _container) {
|
||||
if (existingItem->isEqualTo(item))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void clear(const T *item)
|
||||
{
|
||||
if (_class != item || _container.size() == 1)
|
||||
_container.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
QSet<const T *> _container;
|
||||
const T * _class;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ClassOrNamespace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user