Logo Search packages:      
Sourcecode: fet version File versions

bool Rules::removeSubjectTag ( const QString &  subjectTagName  ) 

Removes this subject tag. In the list of activities, the subject tag will be removed from all activities which posess it. It returns false on failure. If successful, returns true.

Definition at line 771 of file rules.cpp.

References activitiesList, internalStructureComputed, removeSpaceConstraint(), spaceConstraintsList, ConstraintSubjectSubjectTagRequireEquipments::subjectTagName, and subjectTagsList.

{
      //check the activities first
      //TODO: improve this part
      for(Activity* act=this->activitiesList.first(); act; act=this->activitiesList.next())
            if( act->subjectTagName == subjectTagName)
                  act->subjectTagName="";
                  
      //delete the space constraints related to this subject
      for(SpaceConstraint* ctr=this->spaceConstraintsList.first(); ctr; ){
            if(ctr->type==CONSTRAINT_SUBJECT_SUBJECT_TAG_REQUIRE_EQUIPMENTS){
                  ConstraintSubjectSubjectTagRequireEquipments* c=(ConstraintSubjectSubjectTagRequireEquipments*)ctr;

                  if(c->subjectTagName == subjectTagName){
                        this->removeSpaceConstraint(ctr);
                        ctr=this->spaceConstraintsList.current();
                  }
                  else
                        ctr=this->spaceConstraintsList.next();
            }
            else
                  ctr=this->spaceConstraintsList.next();
      }

      
      //remove the subject tag from the list
      for(SubjectTag* sbt=this->subjectTagsList.first(); sbt; sbt=this->subjectTagsList.next())
            if(sbt->name==subjectTagName)
                  break;
      this->subjectTagsList.remove();

      this->internalStructureComputed=false;

      return true;
}


Generated by  Doxygen 1.6.0   Back to index