+ void add_type(AtomicType* type)
+ {
+ types.push_back(type);
+ type->parent = this;
+ }
+ void add_namespace(Namespace* ns)
+ {
+ namespaces.push_back(ns);
+ ns->parent = this;
+ }
+ Namespace* _findNamespace(const std::string& name, bool godown = false) {
+ for(std::vector<Namespace*>::iterator i = namespaces.begin();
+ i != namespaces.end(); ++i) {
+ Namespace* ns = *i;
+ if(ns->name == name)
+ return ns;
+ }
+ if(godown && parent)
+ return parent->_findNamespace(name, true);
+
+ return 0;
+ }
+
+ Namespace* findNamespace(const std::string& name, bool godown = false) {
+ Namespace* ret = _findNamespace(name, godown);
+ if(!ret) {
+ std::ostringstream msg;
+ msg << "Couldn't find namespace '" << name << "'.";
+ throw std::runtime_error(msg.str());
+ }
+
+ return ret;
+ }
+