aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/cplusplus/Names.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/cplusplus/Names.cpp')
-rw-r--r--src/shared/cplusplus/Names.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/shared/cplusplus/Names.cpp b/src/shared/cplusplus/Names.cpp
index 3dafad910b2..32762841b6f 100644
--- a/src/shared/cplusplus/Names.cpp
+++ b/src/shared/cplusplus/Names.cpp
@@ -268,5 +268,62 @@ bool ConversionNameId::isEqualTo(const Name *other) const
return _type.isEqualTo(c->type());
}
+SelectorNameId::SelectorNameId(Name *const names[],
+ unsigned nameCount,
+ bool hasArguments)
+ : _names(0),
+ _nameCount(nameCount),
+ _hasArguments(hasArguments)
+{
+ if (_nameCount) {
+ _names = new Name *[_nameCount];
+ std::copy(&names[0], &names[nameCount], _names);
+ }
+}
+
+SelectorNameId::~SelectorNameId()
+{ delete[] _names; }
+
+void SelectorNameId::accept0(NameVisitor *visitor)
+{ visitor->visit(this); }
+
+Identifier *SelectorNameId::identifier() const
+{
+ // FIXME: (EV)
+ return nameAt(0)->identifier();
+}
+
+unsigned SelectorNameId::nameCount() const
+{ return _nameCount; }
+
+Name *SelectorNameId::nameAt(unsigned index) const
+{ return _names[index]; }
+
+Name *const *SelectorNameId::names() const
+{ return _names; }
+
+bool SelectorNameId::hasArguments() const
+{ return _hasArguments; }
+
+bool SelectorNameId::isEqualTo(const Name *other) const
+{
+ const SelectorNameId *q = other->asSelectorNameId();
+ if (! q)
+ return false;
+ else if (hasArguments() != q->hasArguments())
+ return false;
+ else {
+ const unsigned count = nameCount();
+ if (count != q->nameCount())
+ return false;
+ for (unsigned i = 0; i < count; ++i) {
+ Name *l = nameAt(i);
+ Name *r = q->nameAt(i);
+ if (! l->isEqualTo(r))
+ return false;
+ }
+ }
+ return true;
+}
CPLUSPLUS_END_NAMESPACE