Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/ClassTreeMask.cc

    r10624 r11071  
    207207            return ((*this->nodes_.top().first) == compare);
    208208        else
    209             return (compare == 0);
     209            return (compare == nullptr);
    210210    }
    211211
     
    218218            return ((*this->nodes_.top().first) != compare);
    219219        else
    220             return (compare != 0);
     220            return (compare != nullptr);
    221221    }
    222222
     
    293293        {
    294294            // 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 exist
    298                         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);
    299299        }
    300300
     
    325325        {
    326326            // 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_)
    328328            {
    329                 if (subclass->isA((*it)->getClass()))
     329                if (subclass->isA(subnode->getClass()))
    330330                {
    331331                    // 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);
    333333                    return;
    334334                }
     
    392392        if (!subclass)
    393393            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);
    396396
    397397        this->add(subclass, bInclude, false, clean);
     
    435435
    436436            // 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);
    440440
    441441            // There is no subnode containing our class -> the rule of the current node takes in effect
     
    851851            this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin();
    852852        else
    853             this->objectIterator_ = ObjectList<BaseObject>::end();
     853            this->objectIterator_ = ObjectList<BaseObject>().end();
    854854
    855855        // Check if the iterator points on a valid object. If not, go to the next object by calling ++
     
    915915
    916916            // 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_)
    918918            {
    919919                // Recursive call to this function with the subnode
    920                 this->create(*it1);
     920                this->create(subnode);
    921921
    922922                // Only execute the following code if the current node is included, meaning some of the subnodes might be included too
     
    926926
    927927                    // Iterate through all direct children
    928                     for (std::set<const Identifier*>::iterator it2 = directChildren.begin(); it2 != directChildren.end(); ++it2)
     928                    for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    929929                    {
    930930                        // Check if the subnode (it1) is a child of the directChild (it2)
    931                         if ((*it1)->getClass()->isA(*it2))
     931                        if (subnode->getClass()->isA(*it))
    932932                        {
    933933                            // 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(it2);
     934                            directChildren.erase(it);
    935935
    936936                            // Check if the removed directChild was exactly the subnode
    937                             if (!(*it1)->getClass()->isExactlyA(*it2))
     937                            if (!subnode->getClass()->isExactlyA(*it))
    938938                            {
    939939                                // No, it wasn't exactly the subnode - therefore there are some classes between
    940940
    941941                                // Add the previously removed directChild (it2) to the subclass-list
    942                                 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it2, true));
     942                                this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true));
    943943
    944944                                // Insert all directChildren of the directChild
    945                                 directChildren.insert((*it2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());
     945                                directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end());
    946946
    947947                                // Restart the scan with the expanded set of directChildren
     
    957957            // The bool is "false", meaning they have no subnodes and therefore need no further checks
    958958            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));
    961961        }
    962962    }
Note: See TracChangeset for help on using the changeset viewer.