106 if (name.label() ==
"") {
return true; }
113 if (
prm__->isType(name.label())) {
118 if (
prm__->isInterface(name.label())) {
123 if (
prm__->isClass(name.label())) {
129 if (t->name().label() == name.label()) {
136 if (i->name().label() == name.label()) {
143 if (c->name().label() == name.label()) {
149 auto lookup =
"." + name.label();
151 auto matches = std::vector< std::string >();
154 for (
auto t:
prm__->types()) {
156 if (!found.exists(t->name())) {
158 matches.push_back(t->name());
164 if (
endsWith(t->name().label(), lookup)) {
165 if (!found.exists(t->name().label())) {
166 found.
insert(t->name().label());
167 matches.push_back(t->name().label());
173 for (
auto i:
prm__->interfaces()) {
175 if (!found.exists(i->name())) {
177 matches.push_back(i->name());
183 if (
endsWith(i->name().label(), lookup)) {
184 if (!found.exists(i->name().label())) {
185 found.
insert(i->name().label());
186 matches.push_back(i->name().label());
192 for (
auto c:
prm__->classes()) {
194 if (!found.exists(c->name())) {
196 matches.push_back(c->name());
202 if (
endsWith(c->name().label(), lookup)) {
203 if (!found.exists(c->name().label())) {
204 found.
insert(c->name().label());
205 matches.push_back(c->name().label());
210 if (matches.
size() == 1) {
212 name.label() = matches.back();
215 }
else if (matches.
size() == 0) {
218 O3PRM_TYPE_NOT_FOUND(name, *
errors__);
224 O3PRM_TYPE_AMBIGUOUS(name, matches, *
errors__);
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
PRM< GUM_SCALAR > * prm__
bool endsWith(std::string const &value, std::string const &ending)
Returns true if value ends with ending.
O3InterfaceList & interfaces()
ErrorsContainer * errors__
Size size() const noexcept
Returns the number of elements in the set.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
void insert(const Key &k)
Inserts a new element into the set.