PhoenixLecture  2.0.0
Set of tools to make lectures
ptimetable_updateEndTime.h File Reference
#include "PTimeTable.h"
+ Include dependency graph for ptimetable_updateEndTime.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ptimetable_updateEndTime (PTimeTable &timetable)
 Update the end time of the blocks. More...
 

Function Documentation

◆ ptimetable_updateEndTime()

void ptimetable_updateEndTime ( PTimeTable timetable)

Update the end time of the blocks.

Parameters
[out]timetable: PTimeTable to be udpated

Definition at line 54 of file ptimetable_updateEndTime.cpp.

54  {
55  std::vector<PTimeTableBlock> & vecBlock = timetable.getVecBlock();
56  if(vecBlock.size() == 0lu){return;} //Nothing to do
57  PLatexObj defaultLocation = timetable.getLocation();
58  PString mainUrl(timetable.getMainUrl());
59  PLatexDate lastDate = timetable.getBeginDate();
60  PLatexTime lastTime;
61  lastTime.setHour(0lu);
62  lastTime.setMinute(0lu);
63  for(std::vector<PTimeTableBlock>::iterator it(vecBlock.begin()); it != vecBlock.end(); ++it){
64  PTimeTableBlock & block = *it;
65  ptimetable_updateTime(lastTime, block.getBeginTime());
66  lastTime = addTime(block.getBeginTime(), block.getDuration());
67  block.setEndTime(lastTime);
68  ptimetable_updateDate(lastDate, block.getDate());
69  if(it->getLocation().getVecContent().size() == 0lu){
70  it->setLocation(defaultLocation);
71  }
72  if(it->getMainUrl() == ""){
73  it->setMainUrl(mainUrl);
74  }
75  }
76 }
Describes a date.
Definition: PTimeTable.h:58
Describe a latex object.
Definition: PLatexObj.h:40
Describes a date.
Definition: PTimeTable.h:86
void setMinute(size_t minute)
Sets the minute of the PLatexTime.
Definition: PTimeTable.cpp:322
void setHour(size_t hour)
Sets the hour of the PLatexTime.
Definition: PTimeTable.cpp:315
Extends the std::string.
Definition: PString.h:16
Block of a Timetable.
Definition: PTimeTable.h:109
const PLatexDate & getDate() const
Gets the date of the PTimeTableBlock.
Definition: PTimeTable.cpp:586
void setEndTime(const PLatexTime &endTime)
Sets the endTime of the PTimeTableBlock.
Definition: PTimeTable.cpp:453
const PLatexTime & getBeginTime() const
Gets the beginTime of the PTimeTableBlock.
Definition: PTimeTable.cpp:600
const PLatexTime & getDuration() const
Gets the duration of the PTimeTableBlock.
Definition: PTimeTable.cpp:628
const PLatexDate & getBeginDate() const
Gets the beginDate of the PTimeTable.
Definition: PTimeTable.cpp:873
const PLatexObj & getLocation() const
Gets the location of the PTimeTable.
Definition: PTimeTable.cpp:915
const std::vector< PTimeTableBlock > & getVecBlock() const
Gets the vecBlock of the PTimeTable.
Definition: PTimeTable.cpp:929
const PString & getMainUrl() const
Gets the mainUrl of the PTimeTable.
Definition: PTimeTable.cpp:831
void ptimetable_updateTime(PLatexTime &lastTime, PLatexTime &blockBegin)
Update the date of the block.
void ptimetable_updateDate(PLatexDate &lastDate, PLatexDate &blockDate)
Update the date of the block.
PLatexTime addTime(const PLatexTime &beginTime, const PLatexTime &durationTime)
Add two PLatexTime together.

References addTime(), PTimeTable::getBeginDate(), PTimeTableBlock::getBeginTime(), PTimeTableBlock::getDate(), PTimeTableBlock::getDuration(), PTimeTable::getLocation(), PTimeTable::getMainUrl(), PTimeTable::getVecBlock(), ptimetable_updateDate(), ptimetable_updateTime(), PTimeTableBlock::setEndTime(), PLatexTime::setHour(), and PLatexTime::setMinute().

Referenced by PConfigParser::parseTimeTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: