Changeset 901 for code/branches/core2/src/orxonox/core/Namespace.cc
- Timestamp:
- Mar 19, 2008, 12:38:32 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/Namespace.cc
r898 r901 41 41 42 42 this->bAutogeneratedFileRootNamespace_ = false; 43 this->b DeleteNamespaceNodesAfterDestruction_ = false;43 this->bRoot_ = false; 44 44 this->operator_ = "or"; 45 45 } … … 47 47 Namespace::~Namespace() 48 48 { 49 if (this->b DeleteNamespaceNodesAfterDestruction_)49 if (this->bRoot_) 50 50 for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it) 51 51 delete (*it); … … 73 73 name.replace(pos, 1, " "); 74 74 SubString tokens(name, " ", "", false, '\\', '"', '\0', '\0', '\0'); 75 for (unsigned int i = 0; i < tokens.size(); i++)75 if (this->bRoot_) 76 76 { 77 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it) 77 this->representingNamespaces_.insert(new NamespaceNode(this->getName())); 78 } 79 else 80 { 81 for (unsigned int i = 0; i < tokens.size(); i++) 78 82 { 79 std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]); 80 this->representingNamespaces_.insert(temp.begin(), temp.end()); 83 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it) 84 { 85 std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]); 86 this->representingNamespaces_.insert(temp.begin(), temp.end()); 87 } 81 88 } 82 89 } … … 138 145 return false; 139 146 } 147 148 std::string Namespace::toString() const 149 { 150 std::string output; 151 152 int i = 0; 153 for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it) 154 { 155 if (i > 0) 156 output += " / "; 157 158 output += (*it)->toString(); 159 } 160 161 return output; 162 } 163 164 std::string Namespace::toString(const std::string& indentation) const 165 { 166 std::string output; 167 168 int i = 0; 169 for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it) 170 { 171 if (i > 0) 172 output += "\n"; 173 174 output += (*it)->toString(indentation); 175 } 176 177 return output; 178 } 140 179 }
Note: See TracChangeset
for help on using the changeset viewer.