Changeset 11071 for code/trunk/src/libraries/core/ClassTreeMask.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/ClassTreeMask.cc
r10624 r11071 207 207 return ((*this->nodes_.top().first) == compare); 208 208 else 209 return (compare == 0);209 return (compare == nullptr); 210 210 } 211 211 … … 218 218 return ((*this->nodes_.top().first) != compare); 219 219 else 220 return (compare != 0);220 return (compare != nullptr); 221 221 } 222 222 … … 293 293 { 294 294 // No it's not: Search for classes inheriting from the given class and add the rules for them 295 for ( std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)296 if ( (*it)->isA(this->root_->getClass()))297 if (overwrite || (!this->nodeExists( *it))) // If we don't want to overwrite, only add nodes that don't already exist298 this->add(this->root_, *it, bInclude, overwrite);295 for (const Identifier* directChild : subclass->getDirectChildren()) 296 if (directChild->isA(this->root_->getClass())) 297 if (overwrite || (!this->nodeExists(directChild))) // If we don't want to overwrite, only add nodes that don't already exist 298 this->add(this->root_, directChild, bInclude, overwrite); 299 299 } 300 300 … … 325 325 { 326 326 // Search for an already existing node, containing the subclass we want to add 327 for ( std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)327 for (ClassTreeMaskNode* subnode : node->subnodes_) 328 328 { 329 if (subclass->isA( (*it)->getClass()))329 if (subclass->isA(subnode->getClass())) 330 330 { 331 331 // We've found an existing node -> delegate the work with a recursive function-call and return 332 this->add( *it, subclass, bInclude, overwrite);332 this->add(subnode, subclass, bInclude, overwrite); 333 333 return; 334 334 } … … 392 392 if (!subclass) 393 393 return; 394 for ( std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)395 this->add( *it, this->isIncluded(*it), false, false);394 for (const Identifier* directChild : subclass->getDirectChildren()) 395 this->add(directChild, this->isIncluded(directChild), false, false); 396 396 397 397 this->add(subclass, bInclude, false, clean); … … 435 435 436 436 // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call. 437 for ( std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)438 if (subclass->isA( (*it)->getClass()))439 return isIncluded( *it, subclass);437 for (ClassTreeMaskNode* subnode : node->subnodes_) 438 if (subclass->isA(subnode->getClass())) 439 return isIncluded(subnode, subclass); 440 440 441 441 // There is no subnode containing our class -> the rule of the current node takes in effect … … 851 851 this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin(); 852 852 else 853 this->objectIterator_ = ObjectList<BaseObject> ::end();853 this->objectIterator_ = ObjectList<BaseObject>().end(); 854 854 855 855 // Check if the iterator points on a valid object. If not, go to the next object by calling ++ … … 915 915 916 916 // Iterate through all subnodes 917 for ( std::list<ClassTreeMaskNode*>::iterator it1 = node->subnodes_.begin(); it1 != node->subnodes_.end(); ++it1)917 for (ClassTreeMaskNode* subnode : node->subnodes_) 918 918 { 919 919 // Recursive call to this function with the subnode 920 this->create( *it1);920 this->create(subnode); 921 921 922 922 // Only execute the following code if the current node is included, meaning some of the subnodes might be included too … … 926 926 927 927 // Iterate through all direct children 928 for (std::set<const Identifier*>::iterator it 2 = directChildren.begin(); it2 != directChildren.end(); ++it2)928 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it) 929 929 { 930 930 // Check if the subnode (it1) is a child of the directChild (it2) 931 if ( (*it1)->getClass()->isA(*it2))931 if (subnode->getClass()->isA(*it)) 932 932 { 933 933 // Yes it is - remove the directChild (it2) from the list, because it will already be handled by a recursive call to the create() function 934 directChildren.erase(it 2);934 directChildren.erase(it); 935 935 936 936 // Check if the removed directChild was exactly the subnode 937 if (! (*it1)->getClass()->isExactlyA(*it2))937 if (!subnode->getClass()->isExactlyA(*it)) 938 938 { 939 939 // No, it wasn't exactly the subnode - therefore there are some classes between 940 940 941 941 // Add the previously removed directChild (it2) to the subclass-list 942 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it 2, true));942 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true)); 943 943 944 944 // Insert all directChildren of the directChild 945 directChildren.insert((*it 2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());945 directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end()); 946 946 947 947 // Restart the scan with the expanded set of directChildren … … 957 957 // The bool is "false", meaning they have no subnodes and therefore need no further checks 958 958 if (node->isIncluded()) 959 for ( std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)960 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>( *it, false));959 for (const Identifier* directChild : directChildren) 960 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(directChild, false)); 961 961 } 962 962 }
Note: See TracChangeset
for help on using the changeset viewer.