diff options
| author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-11 13:46:32 +0200 |
|---|---|---|
| committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-11 15:25:19 +0200 |
| commit | f74ba9daef50a0b267056c8753819d59621fc000 (patch) | |
| tree | b8400aa8bd8248b6b42552f79d56294ed04d8657 /src/shared/cplusplus/Symbols.cpp | |
| parent | 6618a3cd679bf76f8325ca38b934545b0d8f4c60 (diff) | |
| download | qt-creator-f74ba9daef50a0b267056c8753819d59621fc000.tar.gz | |
Introduced CPlusPlus::Template and process the template declarations.
Diffstat (limited to 'src/shared/cplusplus/Symbols.cpp')
| -rw-r--r-- | src/shared/cplusplus/Symbols.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp index f7477a4b14..23f17de6df 100644 --- a/src/shared/cplusplus/Symbols.cpp +++ b/src/shared/cplusplus/Symbols.cpp @@ -430,6 +430,63 @@ void Enum::visitSymbol0(SymbolVisitor *visitor) } } +Template::Template(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name) + : Scope(translationUnit, sourceLocation, name) +{ } + +Template::~Template() +{ } + +unsigned Template::templateParameterCount() const +{ + if (declaration() != 0) + return memberCount() - 1; + + return 0; +} + +Symbol *Template::templateParameterAt(unsigned index) const +{ return memberAt(index); } + +Symbol *Template::declaration() const +{ + if (isEmpty()) + return 0; + + if (Symbol *s = memberAt(memberCount() - 1)) { + if (s->isClass() || s->isForwardClassDeclaration() || + s->isTemplate() || s->isFunction() || s->isDeclaration()) + return s; + } + + return 0; +} + +FullySpecifiedType Template::type() const +{ return FullySpecifiedType(const_cast<Template *>(this)); } + +bool Template::isEqualTo(const Type *other) const +{ return other == this; } + +void Template::visitSymbol0(SymbolVisitor *visitor) +{ + if (visitor->visit(this)) { + for (unsigned i = 0; i < memberCount(); ++i) { + visitSymbol(memberAt(i), visitor); + } + } +} + +void Template::accept0(TypeVisitor *visitor) +{ visitor->visit(this); } + +bool Template::matchType0(const Type *otherType, TypeMatcher *matcher) const +{ + if (const Template *otherTy = otherType->asTemplateType()) + return matcher->match(this, otherTy); + return false; +} + Namespace::Namespace(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name) : Scope(translationUnit, sourceLocation, name) { } |
