Logo Search packages:      
Sourcecode: fet version File versions

void Rules::write ( const QString &  filename  ) 

Write the rules to the xml input file "inputfile".

Definition at line 4154 of file rules.cpp.

References activitiesList, comments, daysOfTheWeek, equipmentsList, hoursOfTheDay, initialized, institutionName, nDaysPerWeek, nHoursPerDay, roomsList, spaceConstraintsList, subjectsList, subjectTagsList, teachersList, timeConstraintsList, and yearsList.

{
      assert(this->initialized);

      QString s;

      QFile file(filename);
      if(!file.open(IO_WriteOnly)){
            assert(0);
            exit(1);
      }

      QTextStream tos(&file);

      s+="<!DOCTYPE FET><FET version=\""+FET_VERSION+"\">\n\n";
      
      //the institution name and comments
      s+="<Institution_Name>"+this->institutionName+"</Institution_Name>\n\n";
      s+="<Comments>"+this->comments+"</Comments>\n\n";

      //the hours and days
      s+="<Hours_List>\n      <Number>"+QString::number(this->nHoursPerDay)+"</Number>\n";
      for(int i=0; i<=this->nHoursPerDay; i++)
            s+="  <Name>"+this->hoursOfTheDay[i]+"</Name>\n";
      s+="</Hours_List>\n\n";
      s+="<Days_List>\n <Number>"+QString::number(this->nDaysPerWeek)+"</Number>\n";
      for(int i=0; i<this->nDaysPerWeek; i++)
            s+="  <Name>"+this->daysOfTheWeek[i]+"</Name>\n";
      s+="</Days_List>\n\n";

      //students list
      s+="<Students_List>\n";
      for(StudentsYear* sty=this->yearsList.first(); sty; sty=this->yearsList.next())
            s += sty->getXMLDescription();
      s+="</Students_List>\n\n";

      //teachers list
      s += "<Teachers_List>\n";
      for(Teacher* tch=this->teachersList.first(); tch; tch=this->teachersList.next())
            s += tch->getXMLDescription();
      s += "</Teachers_List>\n\n";

      //subjects list
      s += "<Subjects_List>\n";
      for(Subject* sbj=this->subjectsList.first(); sbj; sbj=this->subjectsList.next())
            s += sbj->getXMLDescription();
      s += "</Subjects_List>\n\n";

      //subject tags list
      s += "<Subject_Tags_List>\n";
      for(SubjectTag* stg=this->subjectTagsList.first(); stg; stg=this->subjectTagsList.next())
            s += stg->getXMLDescription();
      s += "</Subject_Tags_List>\n\n";

      //activities list
      s += "<Activities_List>\n";
      for(Activity* act=this->activitiesList.first(); act; act=this->activitiesList.next()){
            s += act->getXMLDescription(*this);
            s += "\n";
      }
      s += "</Activities_List>\n\n";

      //equipments list
      s += "<Equipments_List>\n";
      for(Equipment* eq=this->equipmentsList.first(); eq; eq=this->equipmentsList.next())
            s += eq->getXMLDescription();
      s += "</Equipments_List>\n\n";

      //rooms list
      s += "<Rooms_List>\n";
      for(Room* rm=this->roomsList.first(); rm; rm=this->roomsList.next())
            s += rm->getXMLDescription();
      s += "</Rooms_List>\n\n";

      //time constraints list
      s += "<Time_Constraints_List>\n";
      for(TimeConstraint* ctr=this->timeConstraintsList.first(); ctr; ctr=this->timeConstraintsList.next())
            s += ctr->getXMLDescription(*this);
      s += "</Time_Constraints_List>\n\n";

      //constraints list
      s += "<Space_Constraints_List>\n";
      for(SpaceConstraint* ctr=this->spaceConstraintsList.first(); ctr; ctr=this->spaceConstraintsList.next())
            s += ctr->getXMLDescription(*this);
      s += "</Space_Constraints_List>\n\n";

      s+="</FET>\n";

      tos<<s;
}


Generated by  Doxygen 1.6.0   Back to index