Directory: | ./ |
---|---|
File: | tmp_project/PhoenixTex2Html/src/PTimeTable/ptimetable_tex.cpp |
Date: | 2025-03-24 18:12:43 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 289 | 295 | 98.0% |
Branches: | 478 | 497 | 96.2% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include <iomanip> | ||
8 | #include "platexobj_create.h" | ||
9 | |||
10 | #include "ptimetable_invitation.h" | ||
11 | #include "ptimetable_tex.h" | ||
12 | |||
13 | ///Convert a date into a string which can be used in a std::map | ||
14 | /** @param date : PLatexDate to be converted in to a string | ||
15 | * @return corresponding string (year-month-day) | ||
16 | */ | ||
17 | 321 | PString ptimetable_dateToStr(const PLatexDate & date){ | |
18 |
1/1✓ Branch 1 taken 321 times.
|
321 | std::stringstream dateStr; |
19 |
12/12✓ Branch 1 taken 321 times.
✓ Branch 4 taken 321 times.
✓ Branch 7 taken 321 times.
✓ Branch 11 taken 321 times.
✓ Branch 15 taken 321 times.
✓ Branch 18 taken 321 times.
✓ Branch 21 taken 321 times.
✓ Branch 24 taken 321 times.
✓ Branch 28 taken 321 times.
✓ Branch 32 taken 321 times.
✓ Branch 35 taken 321 times.
✓ Branch 38 taken 321 times.
|
321 | dateStr << date.getYear() << "-" << std::setfill('0') << std::setw(2) << date.getMonth() << "-" << std::setfill('0') << std::setw(2) << date.getDay(); |
20 |
2/2✓ Branch 1 taken 321 times.
✓ Branch 4 taken 321 times.
|
963 | return dateStr.str(); |
21 | 321 | } | |
22 | |||
23 | ///Convert a date into a string | ||
24 | /** @param date : PLatexDate to be converted in to a string | ||
25 | * @return corresponding string (day-month-year) | ||
26 | */ | ||
27 | 219 | PString ptimetable_dateToText(const PLatexDate & date){ | |
28 |
1/1✓ Branch 1 taken 219 times.
|
219 | std::stringstream dateStr; |
29 |
12/12✓ Branch 2 taken 219 times.
✓ Branch 6 taken 219 times.
✓ Branch 9 taken 219 times.
✓ Branch 12 taken 219 times.
✓ Branch 15 taken 219 times.
✓ Branch 19 taken 219 times.
✓ Branch 23 taken 219 times.
✓ Branch 26 taken 219 times.
✓ Branch 29 taken 219 times.
✓ Branch 32 taken 219 times.
✓ Branch 35 taken 219 times.
✓ Branch 38 taken 219 times.
|
219 | dateStr << std::setfill('0') << std::setw(2) << date.getDay() << "/" << std::setfill('0') << std::setw(2) << date.getMonth() << "/" << date.getYear(); |
30 |
2/2✓ Branch 1 taken 219 times.
✓ Branch 4 taken 219 times.
|
657 | return dateStr.str(); |
31 | 219 | } | |
32 | |||
33 | ///Convert a PLatexTime into a string | ||
34 | /** @param texTime : PLatexTime to be converted in to a string | ||
35 | * @return corresponding string (hour:minute) | ||
36 | */ | ||
37 | 2478 | PString ptimetable_timeToStr(const PLatexTime & texTime){ | |
38 |
1/1✓ Branch 1 taken 2478 times.
|
2478 | std::stringstream timeStr; |
39 |
9/9✓ Branch 2 taken 2478 times.
✓ Branch 6 taken 2478 times.
✓ Branch 9 taken 2478 times.
✓ Branch 12 taken 2478 times.
✓ Branch 15 taken 2478 times.
✓ Branch 19 taken 2478 times.
✓ Branch 23 taken 2478 times.
✓ Branch 26 taken 2478 times.
✓ Branch 29 taken 2478 times.
|
2478 | timeStr << std::setfill('0') << std::setw(2) << texTime.getHour() << ":" << std::setfill('0') << std::setw(2) << texTime.getMinute(); |
40 |
2/2✓ Branch 1 taken 2478 times.
✓ Branch 4 taken 2478 times.
|
7434 | return timeStr.str(); |
41 | 2478 | } | |
42 | |||
43 | ///Update the later time of the week | ||
44 | /** @param[out] week : TexWeek to be udpated | ||
45 | * @param texTime : PLatexTime | ||
46 | */ | ||
47 | 270 | void ptimetable_updateWeekLaterTime(TexWeek & week, const PLatexTime & texTime){ | |
48 | 270 | PLatexTime & laterTime = week.laterTime; | |
49 |
2/2✓ Branch 2 taken 55 times.
✓ Branch 3 taken 215 times.
|
270 | if(laterTime.getHour() < texTime.getHour()){ |
50 | 55 | laterTime = texTime; | |
51 |
2/2✓ Branch 2 taken 44 times.
✓ Branch 3 taken 171 times.
|
215 | }else if(laterTime.getHour() == texTime.getHour()){ |
52 |
2/2✓ Branch 2 taken 15 times.
✓ Branch 3 taken 29 times.
|
44 | if(laterTime.getMinute() < texTime.getMinute()){ |
53 | 15 | laterTime = texTime; | |
54 | } | ||
55 | } | ||
56 | 270 | } | |
57 | |||
58 | ///Add a block in week | ||
59 | /** @param[out] week : TexWeek to be updated | ||
60 | * @param block : PTimeTableBlock to be added into the week | ||
61 | * @param invitationTimeTable : invitation of the full timetable | ||
62 | */ | ||
63 | 270 | void ptimetable_addBlockInWeek(TexWeek & week, const PTimeTableBlock & block, const PString & invitationTimeTable){ | |
64 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | PString blockDate(ptimetable_dateToStr(block.getDate())); |
65 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | PString beginTime(ptimetable_timeToStr(block.getBeginTime())); |
66 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | PString endTime(ptimetable_timeToStr(block.getEndTime())); |
67 | ///Update the later time of the week | ||
68 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | ptimetable_updateWeekLaterTime(week, block.getEndTime()); |
69 | |||
70 | 270 | std::map<PString, TexDay> & mapDay = week.mapDay; | |
71 |
1/1✓ Branch 1 taken 270 times.
|
270 | std::map<PString, TexDay>::iterator it(mapDay.find(blockDate)); |
72 |
2/2✓ Branch 2 taken 219 times.
✓ Branch 3 taken 51 times.
|
270 | if(it != mapDay.end()){ |
73 |
2/2✓ Branch 2 taken 219 times.
✓ Branch 5 taken 219 times.
|
219 | it->second.mapBlock[beginTime] = block; |
74 | }else{ | ||
75 |
1/1✓ Branch 1 taken 51 times.
|
51 | TexDay & day = mapDay[blockDate]; |
76 |
2/2✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
|
51 | day.date = block.getDate(); |
77 |
3/3✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
|
51 | day.invitation = invitationTimeTable + "_" + blockDate; |
78 |
2/2✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
|
51 | day.mapBlock[beginTime] = block; |
79 | } | ||
80 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | week.mapHour[beginTime] = ""; |
81 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | week.mapHour[endTime] = ""; |
82 | 270 | } | |
83 | |||
84 | ///Create the TexTimetable | ||
85 | /** @param[out] texTimetable : created TexTimetable | ||
86 | * @param timetable : PTimeTable to be used to create the TexTimetable | ||
87 | */ | ||
88 | 4 | void ptimetable_createTexTimeTable(TexTimetable & texTimetable, const PTimeTable & timetable){ | |
89 |
1/1✓ Branch 1 taken 4 times.
|
4 | const std::vector<PTimeTableBlock> & vecBlock = timetable.getVecBlock(); |
90 | 4 | std::vector<TexWeek> & vecWeek = texTimetable.vecWeek; | |
91 | |||
92 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | PString invitationTimeTable(timetable.getInvitation()); |
93 |
1/1✓ Branch 1 taken 4 times.
|
4 | texTimetable.invitation = invitationTimeTable; |
94 |
1/1✓ Branch 1 taken 4 times.
|
4 | TexWeek emptyWeek; |
95 |
1/1✓ Branch 1 taken 4 times.
|
4 | emptyWeek.laterTime.setHour(0lu); |
96 |
1/1✓ Branch 1 taken 4 times.
|
4 | emptyWeek.laterTime.setMinute(0lu); |
97 |
1/1✓ Branch 1 taken 4 times.
|
4 | vecWeek.push_back(emptyWeek); |
98 | //TODO : here we need to deal with untitled weeks | ||
99 | //If no week has a title we have to dispatch days in month, or let say by 6-7 on a row to avoid too large generated web site | ||
100 |
2/2✓ Branch 4 taken 277 times.
✓ Branch 5 taken 4 times.
|
281 | for(std::vector<PTimeTableBlock>::const_iterator it(vecBlock.begin()); it != vecBlock.end(); ++it){ |
101 |
4/4✓ Branch 2 taken 277 times.
✓ Branch 5 taken 277 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 271 times.
|
277 | if(it->getWeekTitle().getVecContent().size() != 0lu){ |
102 |
1/1✓ Branch 1 taken 6 times.
|
6 | vecWeek.push_back(emptyWeek); |
103 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 6 taken 6 times.
|
6 | vecWeek.back().weekTitle = it->getWeekTitle(); |
104 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 6 taken 6 times.
|
6 | vecWeek.back().invitation = it->getInvitation(); |
105 | } | ||
106 |
4/4✓ Branch 2 taken 277 times.
✓ Branch 5 taken 277 times.
✓ Branch 8 taken 270 times.
✓ Branch 9 taken 7 times.
|
277 | if(it->getTitle().getVecContent().size() != 0lu){ |
107 |
1/1✓ Branch 3 taken 270 times.
|
270 | ptimetable_addBlockInWeek(vecWeek.back(), *it, invitationTimeTable); |
108 | } | ||
109 | } | ||
110 | //Create the map of speakers | ||
111 |
1/1✓ Branch 1 taken 4 times.
|
4 | const std::vector<PLatexSpeaker> & vecSpeaker = timetable.getVecSpeaker(); |
112 |
2/2✓ Branch 4 taken 52 times.
✓ Branch 5 taken 4 times.
|
56 | for(std::vector<PLatexSpeaker>::const_iterator it(vecSpeaker.begin()); it != vecSpeaker.end(); ++it){ |
113 |
3/3✓ Branch 3 taken 52 times.
✓ Branch 6 taken 52 times.
✓ Branch 9 taken 52 times.
|
52 | texTimetable.mapSpeaker[it->getLabel()] = *it; |
114 | } | ||
115 | 4 | } | |
116 | |||
117 | ///Check if a block exists at a given time | ||
118 | /** @param[out] foundBlock : pointer to the found block, if there is one (NULL otherwise) | ||
119 | * @param mapBlock : map of blocks to be checked | ||
120 | * @param timeText : time to be searched | ||
121 | * @return true if time does exist, false otherwise | ||
122 | */ | ||
123 | 396 | bool ptimetable_checkBlockExist(const PTimeTableBlock *& foundBlock, const std::map<PString, PTimeTableBlock> & mapBlock, const PString & timeText){ | |
124 |
1/1✓ Branch 1 taken 396 times.
|
396 | std::map<PString, PTimeTableBlock>::const_iterator it(mapBlock.find(timeText)); |
125 |
2/2✓ Branch 2 taken 270 times.
✓ Branch 3 taken 126 times.
|
396 | if(it != mapBlock.end()){ |
126 | 270 | foundBlock = &(it->second); | |
127 | 270 | return true; | |
128 | }else{ | ||
129 | 126 | foundBlock = NULL; | |
130 | 126 | return false; | |
131 | } | ||
132 | } | ||
133 | |||
134 | ///Complete day with empty blocks to make them coherent | ||
135 | /** @param[out] day : TexDay to be completed | ||
136 | * @param mapHour : map of hours in the week | ||
137 | */ | ||
138 | 51 | void ptimetable_compelteDayEmptyBlock(TexDay & day, const std::map<PString, PString> & mapHour){ | |
139 | 51 | std::map<PString, PTimeTableBlock> & mapBlock = day.mapBlock; | |
140 | //Let's iterate over times of the week | ||
141 | 51 | std::map<PString, PString>::const_iterator itHour(mapHour.begin()); | |
142 |
2/2✓ Branch 2 taken 396 times.
✓ Branch 3 taken 51 times.
|
447 | while(itHour != mapHour.end()){ |
143 |
1/1✓ Branch 2 taken 396 times.
|
396 | PString currentTime(itHour->first); |
144 | //Let's check if we found a correspondingblock at this time | ||
145 | 396 | const PTimeTableBlock * foundBlock = NULL; | |
146 |
3/3✓ Branch 1 taken 396 times.
✓ Branch 3 taken 270 times.
✓ Branch 4 taken 126 times.
|
396 | if(ptimetable_checkBlockExist(foundBlock, mapBlock, currentTime)){ |
147 | //A block has been found, we can jump until its end | ||
148 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | PString endTime(ptimetable_timeToStr(foundBlock->getEndTime())); |
149 | //Normally the endtime should exist in mapHour | ||
150 |
1/1✓ Branch 1 taken 270 times.
|
270 | itHour = mapHour.find(endTime); |
151 | 270 | }else{ | |
152 | //No block found, ew have to add an empty block | ||
153 |
1/1✓ Branch 1 taken 126 times.
|
126 | PTimeTableBlock emptyBlock; |
154 |
1/1✓ Branch 1 taken 126 times.
|
126 | emptyBlock.setIsEmptyBlock(true); |
155 |
2/2✓ Branch 1 taken 126 times.
✓ Branch 4 taken 126 times.
|
126 | mapBlock[currentTime] = emptyBlock; |
156 | 126 | ++itHour; | |
157 | 126 | } | |
158 | 396 | } | |
159 | 51 | } | |
160 | |||
161 | ///Complete day of timetable with empty blocks to make them coherent | ||
162 | /** @param[out] texTimetable : TexTimetable to be completed | ||
163 | */ | ||
164 | 4 | void ptimetable_completeEmptyBlock(TexTimetable & texTimetable){ | |
165 | //Let's iterate over weeks | ||
166 | 4 | std::vector<TexWeek> & vecWeek = texTimetable.vecWeek; | |
167 |
2/2✓ Branch 4 taken 10 times.
✓ Branch 5 taken 4 times.
|
14 | for(std::vector<TexWeek>::iterator itWeek(vecWeek.begin()); itWeek != vecWeek.end(); ++itWeek){ |
168 | //Let's iterate over days | ||
169 | 10 | std::map<PString, TexDay> & mapDay = itWeek->mapDay; | |
170 | 10 | std::map<PString, PString> & mapHour = itWeek->mapHour; | |
171 |
2/2✓ Branch 4 taken 51 times.
✓ Branch 5 taken 10 times.
|
61 | for(std::map<PString, TexDay>::iterator itDay(mapDay.begin()); itDay != mapDay.end(); ++itDay){ |
172 |
1/1✓ Branch 2 taken 51 times.
|
51 | ptimetable_compelteDayEmptyBlock(itDay->second, mapHour); |
173 | } | ||
174 | } | ||
175 | 4 | } | |
176 | |||
177 | ///Update the time rows of the PTimeTableBlock | ||
178 | /** @param[out] block : PTimeTableBlock to be updated | ||
179 | * @param mapHour : map of all the begining hours in the week | ||
180 | */ | ||
181 | 396 | void ptimetable_updateBlockTimeRow(PTimeTableBlock & block, const std::map<PString, PString> & mapHour){ | |
182 |
2/2✓ Branch 1 taken 396 times.
✓ Branch 4 taken 396 times.
|
396 | PString beginTime(ptimetable_timeToStr(block.getBeginTime())); |
183 |
2/2✓ Branch 1 taken 396 times.
✓ Branch 4 taken 396 times.
|
396 | PString endTime(ptimetable_timeToStr(block.getEndTime())); |
184 | |||
185 |
1/1✓ Branch 1 taken 396 times.
|
396 | std::map<PString, PString>::const_iterator itBeginTime = mapHour.find(beginTime); |
186 |
1/1✓ Branch 1 taken 396 times.
|
396 | std::map<PString, PString>::const_iterator itEndTime = mapHour.find(endTime); |
187 |
5/6✓ Branch 2 taken 270 times.
✓ Branch 3 taken 126 times.
✓ Branch 6 taken 270 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 270 times.
✓ Branch 9 taken 126 times.
|
396 | if(itBeginTime != mapHour.end() && itEndTime != mapHour.end()){ |
188 | 270 | size_t nbHourBlock(0lu); | |
189 |
5/6✓ Branch 1 taken 378 times.
✓ Branch 2 taken 270 times.
✓ Branch 5 taken 378 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 378 times.
✓ Branch 8 taken 270 times.
|
648 | for(std::map<PString, PString>::const_iterator it(itBeginTime); it != itEndTime && it != mapHour.end(); ++it){ |
190 | 378 | ++nbHourBlock; | |
191 | } | ||
192 |
1/1✓ Branch 1 taken 270 times.
|
270 | block.setNbTimeRow(nbHourBlock); |
193 | } | ||
194 | 396 | } | |
195 | |||
196 | ///Update the time rows of the PTimeTableBlock | ||
197 | /** @param[out] texTimetable : TexTimetable to be updated | ||
198 | */ | ||
199 | 4 | void ptimetable_updateTimeRow(TexTimetable & texTimetable){ | |
200 | //Let's iterate over weeks | ||
201 | 4 | std::vector<TexWeek> & vecWeek = texTimetable.vecWeek; | |
202 |
2/2✓ Branch 4 taken 10 times.
✓ Branch 5 taken 4 times.
|
14 | for(std::vector<TexWeek>::iterator itWeek(vecWeek.begin()); itWeek != vecWeek.end(); ++itWeek){ |
203 | //Let's iterate over days | ||
204 | 10 | std::map<PString, TexDay> & mapDay = itWeek->mapDay; | |
205 | 10 | std::map<PString, PString> & mapHour = itWeek->mapHour; | |
206 |
2/2✓ Branch 4 taken 51 times.
✓ Branch 5 taken 10 times.
|
61 | for(std::map<PString, TexDay>::iterator itDay(mapDay.begin()); itDay != mapDay.end(); ++itDay){ |
207 | //Let's iterate over blocks | ||
208 | 51 | std::map<PString, PTimeTableBlock> & mapBlock = itDay->second.mapBlock; | |
209 |
2/2✓ Branch 4 taken 396 times.
✓ Branch 5 taken 51 times.
|
447 | for(std::map<PString, PTimeTableBlock>::iterator itBlock(mapBlock.begin()); itBlock != mapBlock.end(); ++itBlock){ |
210 |
1/1✓ Branch 2 taken 396 times.
|
396 | ptimetable_updateBlockTimeRow(itBlock->second, mapHour); |
211 | } | ||
212 | } | ||
213 | } | ||
214 | 4 | } | |
215 | |||
216 | ///Convert a PTimeTableBlock into PLatexObj | ||
217 | /** @param[out] vecContent : vector of PLatexObj to be updated | ||
218 | * @param block : PTimeTableBlock to be converted | ||
219 | */ | ||
220 | 1026 | void ptimetable_blockToTex(PLatexObj & obj, const PTimeTableBlock & block){ | |
221 |
2/2✓ Branch 1 taken 234 times.
✓ Branch 2 taken 792 times.
|
1026 | if(block.getIsEmptyBlock()){ |
222 |
1/1✓ Branch 1 taken 234 times.
|
234 | obj.setType(PLatexType::TIMETABLE_EMPTYBLOCK); |
223 | 234 | return; | |
224 | } | ||
225 |
1/1✓ Branch 1 taken 792 times.
|
792 | obj.setType(PLatexType::TIMETABLE_BLOCK); |
226 | 792 | obj.setRowSpan(block.getNbTimeRow()); | |
227 | |||
228 |
2/2✓ Branch 2 taken 396 times.
✓ Branch 3 taken 396 times.
|
792 | if(block.getStyle() != ""){ |
229 | 396 | obj.setText(block.getStyle()); | |
230 | } | ||
231 | 792 | std::vector<PLatexObj> & vecContent = obj.getVecContent(); | |
232 |
2/2✓ Branch 2 taken 486 times.
✓ Branch 3 taken 306 times.
|
792 | if(block.getVecSpeaker().size() != 0lu){ |
233 |
1/2✓ Branch 2 taken 486 times.
✗ Branch 3 not taken.
|
486 | if(block.getInvitation() != ""){ |
234 |
5/5✓ Branch 3 taken 486 times.
✓ Branch 6 taken 486 times.
✓ Branch 9 taken 486 times.
✓ Branch 12 taken 486 times.
✓ Branch 15 taken 486 times.
|
486 | vecContent.push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + block.getInvitation() + ".ics"))); |
235 |
3/3✓ Branch 4 taken 486 times.
✓ Branch 7 taken 486 times.
✓ Branch 10 taken 486 times.
|
486 | vecContent.push_back(platexobj_createRef("sec_" + block.getInvitation(), block.getTitle())); |
236 | } | ||
237 | }else{ | ||
238 | 306 | vecContent = block.getTitle().getVecContent(); | |
239 | } | ||
240 | } | ||
241 | |||
242 | ///Create a table cell | ||
243 | /** @param[out] cell : cell of a table | ||
244 | * @param text : text to write in the cell | ||
245 | */ | ||
246 | ✗ | void ptimetable_createTabCell(PLatexObj & cell, const PString & text){ | |
247 | ✗ | cell.setType(PLatexType::TIMETABLE_BLOCK); | |
248 | |||
249 | ✗ | PLatexObj textObj; | |
250 | ✗ | textObj.setType(PLatexType::TEXT); | |
251 | ✗ | textObj.setText(text); | |
252 | ✗ | cell.getVecContent().push_back(textObj); | |
253 | } | ||
254 | |||
255 | ///Convert a TexTimetable into a PLatexObj | ||
256 | /** @param[out] obj : PLatexObj from TexTimetable | ||
257 | * @param texTimetable : TexTimetable | ||
258 | */ | ||
259 | 61 | void ptimetable_toTex(PLatexObj & obj, const TexTimetable & texTimetable){ | |
260 | //std::vector<PString> vecDay{"Monday", "Tuesday", "Wednesday", "Thrusday", "Friday", "Saturday", "Sunday"}; | ||
261 |
1/1✓ Branch 1 taken 61 times.
|
61 | obj.setType(PLatexType::TIMETABLE); |
262 | 61 | obj.setLabelName(texTimetable.invitation); | |
263 | 61 | const std::vector<TexWeek> & vecWeek = texTimetable.vecWeek; | |
264 |
2/2✓ Branch 4 taken 67 times.
✓ Branch 5 taken 61 times.
|
128 | for(std::vector<TexWeek>::const_iterator itWeek(vecWeek.begin()); itWeek != vecWeek.end(); ++itWeek){ |
265 |
2/2✓ Branch 2 taken 3 times.
✓ Branch 3 taken 64 times.
|
67 | if(itWeek->mapDay.size() == 0lu){continue;} |
266 |
1/1✓ Branch 1 taken 64 times.
|
64 | PLatexObj weekObj; |
267 |
1/1✓ Branch 1 taken 64 times.
|
64 | weekObj.setType(PLatexType::TIMETABLE_WEEK); |
268 |
3/3✓ Branch 2 taken 64 times.
✓ Branch 4 taken 45 times.
✓ Branch 5 taken 19 times.
|
64 | if(itWeek->invitation != ""){ |
269 |
7/7✓ Branch 1 taken 45 times.
✓ Branch 5 taken 45 times.
✓ Branch 8 taken 45 times.
✓ Branch 11 taken 45 times.
✓ Branch 14 taken 45 times.
✓ Branch 17 taken 45 times.
✓ Branch 20 taken 45 times.
|
45 | weekObj.getComplexTitle().push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + itWeek->invitation + ".ics"))); |
270 |
5/5✓ Branch 1 taken 45 times.
✓ Branch 6 taken 45 times.
✓ Branch 9 taken 45 times.
✓ Branch 12 taken 45 times.
✓ Branch 15 taken 45 times.
|
45 | weekObj.getComplexTitle().push_back(platexobj_createRef("sec_"+itWeek->invitation, itWeek->weekTitle)); |
271 |
1/1✓ Branch 2 taken 45 times.
|
45 | weekObj.setLabelName(itWeek->invitation); |
272 | } | ||
273 | |||
274 | 64 | const std::map<PString, PString> & mapHour = itWeek->mapHour; | |
275 | 64 | const std::map<PString, TexDay> & mapDay = itWeek->mapDay; | |
276 | //Header of the week (days) | ||
277 |
1/1✓ Branch 1 taken 64 times.
|
64 | PLatexObj weekRowHeader(platexobj_createTimetableTimeRow()); |
278 |
7/7✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✓ Branch 10 taken 64 times.
✓ Branch 13 taken 64 times.
✓ Branch 16 taken 64 times.
✓ Branch 19 taken 64 times.
|
64 | weekRowHeader.getVecContent().push_back(platexobj_createTimetableBlock("timetableDayStyle", platexobj_createText("Period/Day"))); |
279 | |||
280 |
2/2✓ Branch 4 taken 135 times.
✓ Branch 5 taken 64 times.
|
199 | for(std::map<PString, TexDay>::const_iterator itDay(mapDay.begin()); itDay != mapDay.end(); ++itDay){ |
281 | 135 | const PLatexDate & date = itDay->second.date; | |
282 |
1/1✓ Branch 1 taken 135 times.
|
135 | std::stringstream dateStr; |
283 |
12/12✓ Branch 2 taken 135 times.
✓ Branch 6 taken 135 times.
✓ Branch 9 taken 135 times.
✓ Branch 12 taken 135 times.
✓ Branch 15 taken 135 times.
✓ Branch 19 taken 135 times.
✓ Branch 23 taken 135 times.
✓ Branch 26 taken 135 times.
✓ Branch 29 taken 135 times.
✓ Branch 32 taken 135 times.
✓ Branch 35 taken 135 times.
✓ Branch 38 taken 135 times.
|
135 | dateStr << std::setfill('0') << std::setw(2) << date.getDay() << "/" << std::setfill('0') << std::setw(2) << date.getMonth() << "/" << date.getYear(); |
284 | |||
285 |
1/1✓ Branch 1 taken 135 times.
|
135 | PLatexObj contentBlock(platexobj_createNone()); |
286 |
2/3✓ Branch 2 taken 135 times.
✓ Branch 4 taken 135 times.
✗ Branch 5 not taken.
|
135 | if(itDay->second.invitation != ""){ |
287 |
7/7✓ Branch 1 taken 135 times.
✓ Branch 5 taken 135 times.
✓ Branch 8 taken 135 times.
✓ Branch 11 taken 135 times.
✓ Branch 14 taken 135 times.
✓ Branch 17 taken 135 times.
✓ Branch 20 taken 135 times.
|
135 | contentBlock.getVecContent().push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + itDay->second.invitation + ".ics"))); |
288 |
7/7✓ Branch 1 taken 135 times.
✓ Branch 4 taken 135 times.
✓ Branch 7 taken 135 times.
✓ Branch 11 taken 135 times.
✓ Branch 14 taken 135 times.
✓ Branch 17 taken 135 times.
✓ Branch 20 taken 135 times.
|
135 | contentBlock.getVecContent().push_back(platexobj_createRef("sec_" + itDay->second.invitation, dateStr.str())); |
289 | } | ||
290 | |||
291 |
2/2✓ Branch 1 taken 135 times.
✓ Branch 4 taken 135 times.
|
135 | PLatexObj refTimetableBlock(platexobj_createTimetableBlock("timetableDayStyle", contentBlock)); |
292 |
2/2✓ Branch 1 taken 135 times.
✓ Branch 4 taken 135 times.
|
135 | weekRowHeader.getVecContent().push_back(refTimetableBlock); |
293 | 135 | } | |
294 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
|
64 | weekObj.getVecContent().push_back(weekRowHeader); |
295 | |||
296 | //Timetable with hours | ||
297 |
2/2✓ Branch 4 taken 494 times.
✓ Branch 5 taken 64 times.
|
558 | for(std::map<PString, PString>::const_iterator itHour(mapHour.begin()); itHour != mapHour.end(); ++itHour){ |
298 |
1/1✓ Branch 1 taken 494 times.
|
494 | PLatexObj timeRowObj; |
299 |
1/1✓ Branch 1 taken 494 times.
|
494 | timeRowObj.setType(PLatexType::TIMETABLE_TIMEROW); |
300 | |||
301 |
1/1✓ Branch 1 taken 494 times.
|
494 | PLatexObj textTime; |
302 |
1/1✓ Branch 2 taken 494 times.
|
494 | textTime.setText(itHour->first); |
303 |
1/1✓ Branch 1 taken 494 times.
|
494 | textTime.setType(PLatexType::TIMETABLE_TIME); |
304 |
2/2✓ Branch 1 taken 494 times.
✓ Branch 4 taken 494 times.
|
494 | timeRowObj.getVecContent().push_back(textTime); |
305 | |||
306 | 494 | size_t i(0lu); | |
307 |
2/2✓ Branch 3 taken 1296 times.
✓ Branch 4 taken 494 times.
|
1790 | for(std::map<PString, TexDay>::const_iterator itDay(mapDay.begin()); itDay != mapDay.end(); ++itDay){ |
308 | //For each day we have to find which block starts at the given hour time | ||
309 | 1296 | const std::map<PString, PTimeTableBlock> & mapBlock = itDay->second.mapBlock; | |
310 |
1/1✓ Branch 2 taken 1296 times.
|
1296 | std::map<PString, PTimeTableBlock>::const_iterator itBlock(mapBlock.find(itHour->first)); |
311 |
2/2✓ Branch 2 taken 1026 times.
✓ Branch 3 taken 270 times.
|
1296 | if(itBlock != mapBlock.end()){ //We found a corresponding block |
312 |
1/1✓ Branch 1 taken 1026 times.
|
1026 | PLatexObj blockObj; |
313 |
1/1✓ Branch 2 taken 1026 times.
|
1026 | ptimetable_blockToTex(blockObj, itBlock->second); |
314 |
2/2✓ Branch 1 taken 1026 times.
✓ Branch 4 taken 1026 times.
|
1026 | timeRowObj.getVecContent().push_back(blockObj); |
315 | 1026 | } | |
316 | 1296 | ++i; | |
317 | } | ||
318 |
2/2✓ Branch 1 taken 494 times.
✓ Branch 4 taken 494 times.
|
494 | weekObj.getVecContent().push_back(timeRowObj); |
319 | 494 | } | |
320 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
|
64 | obj.getVecContent().push_back(weekObj); |
321 | 64 | } | |
322 | 61 | } | |
323 | |||
324 | ///Create a single day with consistent mapHour | ||
325 | /** @param[out] out : output updated TexDay | ||
326 | * @param[out] mapHour : output updated map of hours | ||
327 | * @param day : TexDay to be updated | ||
328 | */ | ||
329 | 51 | void ptimetable_singleDay(TexDay & out, std::map<PString, PString> & mapHour, const TexDay & day){ | |
330 | 51 | out.date = day.date; | |
331 | 51 | out.invitation = day.invitation; | |
332 | 51 | const std::map<PString, PTimeTableBlock> & mapBlock = day.mapBlock; | |
333 |
2/2✓ Branch 4 taken 396 times.
✓ Branch 5 taken 51 times.
|
447 | for(std::map<PString, PTimeTableBlock>::const_iterator it(mapBlock.begin()); it != mapBlock.end(); ++it){ |
334 |
3/3✓ Branch 2 taken 396 times.
✓ Branch 4 taken 126 times.
✓ Branch 5 taken 270 times.
|
396 | if(it->second.getIsEmptyBlock()){continue;} |
335 |
2/2✓ Branch 2 taken 270 times.
✓ Branch 5 taken 270 times.
|
270 | PString beginTime(ptimetable_timeToStr(it->second.getBeginTime())); |
336 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | mapHour[beginTime] = ""; |
337 |
4/4✓ Branch 2 taken 270 times.
✓ Branch 5 taken 270 times.
✓ Branch 8 taken 270 times.
✓ Branch 11 taken 270 times.
|
270 | mapHour[ptimetable_timeToStr(it->second.getEndTime())] = ""; |
338 |
1/1✓ Branch 2 taken 270 times.
|
270 | PTimeTableBlock block(it->second); |
339 |
1/1✓ Branch 1 taken 270 times.
|
270 | block.setNbTimeRow(1lu); |
340 |
2/2✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
|
270 | out.mapBlock[beginTime] = block; |
341 | 270 | } | |
342 | |||
343 | 51 | } | |
344 | |||
345 | ///Save lectures in PLatexObj | ||
346 | /** @param[out] vecContent : vector of PLatexObj to be completed with TexTimetable | ||
347 | * @param block : PTimeTableBlock to be converted into PLatexObj | ||
348 | * @param texTimetable : full timetable TexTimetable | ||
349 | */ | ||
350 | 270 | void ptimetable_texLecture(std::vector<PLatexObj> & vecContent, const PTimeTableBlock & block, const TexTimetable & texTimetable){ | |
351 |
3/3✓ Branch 1 taken 270 times.
✓ Branch 4 taken 102 times.
✓ Branch 5 taken 168 times.
|
270 | if(block.getVecSpeaker().size() == 0lu){return;} |
352 |
6/6✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
|
168 | vecContent.push_back(platexobj_createSection(PLatexType::SUBSECTION, block.getTitle(), "sec_"+block.getInvitation())); |
353 |
3/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 6 taken 168 times.
✗ Branch 7 not taken.
|
168 | if(block.getInvitation() != ""){ |
354 |
7/7✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
|
168 | vecContent.push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + block.getInvitation() + ".ics"))); |
355 | } | ||
356 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | vecContent.push_back(platexobj_createTextBf("Date", "")); |
357 |
7/7✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
|
168 | vecContent.push_back(platexobj_createText(" : "+ptimetable_dateToText(block.getDate()), "")); |
358 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | vecContent.push_back(platexobj_createNewLine()); |
359 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | vecContent.push_back(platexobj_createTextBf("Location", "")); |
360 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | vecContent.push_back(platexobj_createText(" : ", "")); |
361 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | vecContent.push_back(block.getLocation()); |
362 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | vecContent.push_back(platexobj_createNewLine()); |
363 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | vecContent.push_back(platexobj_createTextBf("Start at", "")); |
364 |
7/7✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
|
168 | vecContent.push_back(platexobj_createText(" : "+ptimetable_timeToStr(block.getBeginTime()), "")); |
365 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | vecContent.push_back(platexobj_createNewLine()); |
366 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | vecContent.push_back(platexobj_createTextBf("Stop at", "")); |
367 |
7/7✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
|
168 | vecContent.push_back(platexobj_createText(" : "+ptimetable_timeToStr(block.getEndTime()), "")); |
368 | |||
369 | |||
370 |
6/6✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
|
168 | vecContent.push_back(platexobj_createSection(PLatexType::SUBSUBSECTIONSTAR, platexobj_createText("Speakers",""), "")); |
371 |
1/1✓ Branch 1 taken 168 times.
|
168 | PLatexObj listSpeaker(platexobj_createItemize()); |
372 |
1/1✓ Branch 1 taken 168 times.
|
168 | const std::vector<PString> & vecSpeaker = block.getVecSpeaker(); |
373 | 168 | const std::map<PString, PLatexSpeaker> & mapSpeaker = texTimetable.mapSpeaker; | |
374 |
2/2✓ Branch 4 taken 347 times.
✓ Branch 5 taken 168 times.
|
515 | for(std::vector<PString>::const_iterator itSpeaker(vecSpeaker.begin()); itSpeaker != vecSpeaker.end(); ++itSpeaker){ |
375 |
1/1✓ Branch 2 taken 347 times.
|
347 | std::map<PString, PLatexSpeaker>::const_iterator it(mapSpeaker.find(*itSpeaker)); |
376 |
2/2✓ Branch 2 taken 345 times.
✓ Branch 3 taken 2 times.
|
347 | if(it != mapSpeaker.end()){ |
377 | 345 | const PLatexSpeaker & speaker = it->second; | |
378 |
7/7✓ Branch 1 taken 345 times.
✓ Branch 4 taken 345 times.
✓ Branch 8 taken 345 times.
✓ Branch 11 taken 345 times.
✓ Branch 14 taken 345 times.
✓ Branch 17 taken 345 times.
✓ Branch 20 taken 345 times.
|
345 | listSpeaker.getVecContent().push_back(platexobj_createItem(platexobj_createRef("speaker_"+*itSpeaker, speaker.getName()))); |
379 | }else{ | ||
380 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 11 taken 2 times.
|
2 | std::cerr << "ptimetable_texLecture : speaker '"<<(*itSpeaker)<<"' not found in map of speakers" << std::endl; |
381 | } | ||
382 | } | ||
383 |
1/1✓ Branch 1 taken 168 times.
|
168 | vecContent.push_back(listSpeaker); |
384 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 57 times.
✓ Branch 8 taken 111 times.
|
168 | if(block.getDescription().getVecContent().size() != 0lu){ |
385 |
6/6✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
✓ Branch 7 taken 57 times.
✓ Branch 10 taken 57 times.
✓ Branch 13 taken 57 times.
✓ Branch 16 taken 57 times.
|
57 | vecContent.push_back(platexobj_createSection(PLatexType::SUBSUBSECTIONSTAR, platexobj_createText("Description",""), "")); |
386 |
4/4✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
✓ Branch 7 taken 57 times.
✓ Branch 10 taken 57 times.
|
57 | vecContent.push_back(platexobj_createParagraph(block.getDescription(), "")); |
387 | } | ||
388 | 168 | } | |
389 | |||
390 | ///Convert a PTimeTable into PLatexObj | ||
391 | /** @param[out] vecContent : vector of PLatexObj to be completed with PTimeTable | ||
392 | * @param day : TexDay to be converted into PLatexObj | ||
393 | * @param texTimetable : full timetable TexTimetable | ||
394 | * @param week : current week of the day | ||
395 | */ | ||
396 | 51 | void ptimetable_texSection(std::vector<PLatexObj> & vecContent, const TexDay & day, | |
397 | const TexTimetable & texTimetable, const TexWeek & week) | ||
398 | { | ||
399 |
6/6✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
✓ Branch 10 taken 51 times.
✓ Branch 13 taken 51 times.
✓ Branch 16 taken 51 times.
|
102 | PLatexObj sectionTitle(platexobj_createSection(PLatexType::SECTION, platexobj_createText(ptimetable_dateToText(day.date), ""), "sec_"+day.invitation)); |
400 |
1/1✓ Branch 1 taken 51 times.
|
51 | vecContent.push_back(sectionTitle); |
401 |
2/3✓ Branch 1 taken 51 times.
✓ Branch 3 taken 51 times.
✗ Branch 4 not taken.
|
51 | if(day.invitation != ""){ |
402 |
6/6✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
✓ Branch 10 taken 51 times.
✓ Branch 13 taken 51 times.
✓ Branch 16 taken 51 times.
|
51 | vecContent.push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + day.invitation + ".ics"))); |
403 | } | ||
404 | |||
405 |
1/1✓ Branch 1 taken 51 times.
|
51 | TexWeek weekTimeTable; |
406 |
1/1✓ Branch 1 taken 51 times.
|
51 | weekTimeTable.invitation = week.invitation; |
407 |
1/1✓ Branch 1 taken 51 times.
|
51 | weekTimeTable.weekTitle = week.weekTitle; |
408 | |||
409 |
1/1✓ Branch 1 taken 51 times.
|
51 | TexDay outDay; |
410 |
1/1✓ Branch 1 taken 51 times.
|
51 | ptimetable_singleDay(outDay, weekTimeTable.mapHour, day); |
411 |
3/3✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
|
51 | weekTimeTable.mapDay[ptimetable_dateToStr(outDay.date)] = outDay; |
412 | |||
413 | //Now we create a TexTimetable with the current day | ||
414 |
1/1✓ Branch 1 taken 51 times.
|
51 | TexTimetable dayTimetable; |
415 |
1/1✓ Branch 1 taken 51 times.
|
51 | dayTimetable.invitation = texTimetable.invitation; |
416 |
1/1✓ Branch 1 taken 51 times.
|
51 | dayTimetable.vecWeek.push_back(weekTimeTable); |
417 | |||
418 |
1/1✓ Branch 1 taken 51 times.
|
51 | PLatexObj timetableObj; |
419 |
1/1✓ Branch 1 taken 51 times.
|
51 | ptimetable_toTex(timetableObj, dayTimetable); |
420 |
1/1✓ Branch 1 taken 51 times.
|
51 | vecContent.push_back(timetableObj); |
421 | |||
422 | 51 | const std::map<PString, PTimeTableBlock> & mapBlock = day.mapBlock; | |
423 |
2/2✓ Branch 4 taken 396 times.
✓ Branch 5 taken 51 times.
|
447 | for(std::map<PString, PTimeTableBlock>::const_iterator it(mapBlock.begin()); it != mapBlock.end(); ++it){ |
424 |
3/3✓ Branch 2 taken 396 times.
✓ Branch 4 taken 126 times.
✓ Branch 5 taken 270 times.
|
396 | if(it->second.getIsEmptyBlock()){continue;} |
425 |
1/1✓ Branch 2 taken 270 times.
|
270 | ptimetable_texLecture(vecContent, it->second, texTimetable); |
426 | } | ||
427 | 51 | } | |
428 | |||
429 | |||
430 | ///Convert a PTimeTable into PLatexObj | ||
431 | /** @param[out] vecContent : vector of PLatexObj to be completed with PTimeTable | ||
432 | * @param week : TexWeek to be converted into PLatexObj | ||
433 | * @param texTimetable : full timetable TexTimetable | ||
434 | */ | ||
435 | 7 | void ptimetable_texChapter(std::vector<PLatexObj> & vecContent, const TexWeek & week, const TexTimetable & texTimetable){ | |
436 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1 times.
|
7 | if(week.weekTitle.getVecContent().size() != 0lu){ |
437 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
12 | PLatexObj chapterTitle(platexobj_createSection(PLatexType::CHAPTER, week.weekTitle, "sec_"+week.invitation)); |
438 |
1/1✓ Branch 1 taken 6 times.
|
6 | vecContent.push_back(chapterTitle); |
439 | 6 | } | |
440 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 1 times.
|
7 | if(week.invitation != ""){ |
441 |
5/5✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 6 times.
✓ Branch 11 taken 6 times.
✓ Branch 14 taken 6 times.
|
6 | vecContent.push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + week.invitation + ".ics"))); |
442 | } | ||
443 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1 times.
|
7 | if(week.weekTitle.getVecContent().size() != 0lu){ |
444 | //Now we create a TexTimetable with the current week | ||
445 |
1/1✓ Branch 1 taken 6 times.
|
6 | TexTimetable weekTimetable; |
446 |
1/1✓ Branch 1 taken 6 times.
|
6 | weekTimetable.invitation = texTimetable.invitation; |
447 |
1/1✓ Branch 1 taken 6 times.
|
6 | weekTimetable.vecWeek.push_back(week); |
448 |
1/1✓ Branch 1 taken 6 times.
|
6 | PLatexObj timetableObj; |
449 |
1/1✓ Branch 1 taken 6 times.
|
6 | ptimetable_toTex(timetableObj, weekTimetable); |
450 |
1/1✓ Branch 1 taken 6 times.
|
6 | vecContent.push_back(timetableObj); |
451 | 6 | } | |
452 | 7 | const std::map<PString, TexDay> & mapDay = week.mapDay; | |
453 |
2/2✓ Branch 4 taken 51 times.
✓ Branch 5 taken 7 times.
|
58 | for(std::map<PString, TexDay>::const_iterator itDay(mapDay.begin()); itDay != mapDay.end(); ++itDay){ |
454 |
1/1✓ Branch 2 taken 51 times.
|
51 | ptimetable_texSection(vecContent, itDay->second, texTimetable, week); |
455 | } | ||
456 | 7 | } | |
457 | |||
458 | |||
459 | ///Convert a PTimeTable into PLatexObj | ||
460 | /** @param[out] vecContent : vector of PLatexObj to be completed with PTimeTable | ||
461 | * @param texTimetable : TexTimetable to be converted into PLatexObj | ||
462 | */ | ||
463 | 4 | void ptimetable_texPart(std::vector<PLatexObj> & vecContent, const TexTimetable & texTimetable){ | |
464 | 4 | const std::vector<TexWeek> & vecWeek = texTimetable.vecWeek; | |
465 |
2/2✓ Branch 4 taken 10 times.
✓ Branch 5 taken 4 times.
|
14 | for(std::vector<TexWeek>::const_iterator itWeek(vecWeek.begin()); itWeek != vecWeek.end(); ++itWeek){ |
466 |
2/2✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
|
10 | if(itWeek->mapDay.size() == 0lu){continue;} |
467 |
1/1✓ Branch 2 taken 7 times.
|
7 | ptimetable_texChapter(vecContent, *itWeek, texTimetable); |
468 | } | ||
469 | 4 | } | |
470 | |||
471 | ///Convert a PTimeTable into PLatexObj | ||
472 | /** @param[out] vecContent : vector of PLatexObj to be completed with PTimeTable | ||
473 | * @param timetable : PTimeTable to be converted into PLatexObj | ||
474 | * @param outputDirectory : output directory of merge block | ||
475 | * @param isSaveSpeaker : true if the speakers have to saved in latex | ||
476 | * @return true on success, false otherwise | ||
477 | */ | ||
478 | 4 | bool ptimetable_tex(std::vector<PLatexObj> & vecContent, const PTimeTable & timetable, const PPath & outputDirectory, bool isSaveSpeaker){ | |
479 | //Let's convert the PTimeTable into a more precise representation | ||
480 |
1/1✓ Branch 1 taken 4 times.
|
4 | TexTimetable texTimetable; |
481 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::cerr << "ptimetable_tex : call ptimetable_createTexTimeTable" << std::endl; |
482 |
1/1✓ Branch 1 taken 4 times.
|
4 | ptimetable_createTexTimeTable(texTimetable, timetable); |
483 | //Add empty block to make days coherent | ||
484 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::cerr << "ptimetable_tex : call ptimetable_completeEmptyBlock" << std::endl; |
485 |
1/1✓ Branch 1 taken 4 times.
|
4 | ptimetable_completeEmptyBlock(texTimetable); |
486 | //Update the size of the blocks in the timetable | ||
487 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::cerr << "ptimetable_tex : call ptimetable_updateTimeRow" << std::endl; |
488 |
1/1✓ Branch 1 taken 4 times.
|
4 | ptimetable_updateTimeRow(texTimetable); |
489 | //Let's put all block in the vecContent | ||
490 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::cerr << "ptimetable_tex : call ptimetable_toTex" << std::endl; |
491 |
1/1✓ Branch 1 taken 4 times.
|
4 | PLatexObj timetableObj; |
492 |
1/1✓ Branch 1 taken 4 times.
|
4 | ptimetable_toTex(timetableObj, texTimetable); |
493 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
|
4 | vecContent.push_back(platexobj_createSection(PLatexType::PART, timetable.getName(), "sec_"+timetable.getInvitation())); |
494 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | if(texTimetable.invitation != ""){ |
495 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
|
4 | vecContent.push_back(platexobj_createRendezVous(PPath(LATEX_INVITATION_OUTPUT_DIR "/" + texTimetable.invitation + ".ics"))); |
496 | } | ||
497 |
1/1✓ Branch 1 taken 4 times.
|
4 | vecContent.push_back(timetableObj); |
498 |
1/1✓ Branch 1 taken 4 times.
|
4 | ptimetable_texPart(vecContent, texTimetable); |
499 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if(isSaveSpeaker){ |
500 |
1/1✓ Branch 1 taken 2 times.
|
2 | pspeaker_tex(vecContent, timetable); |
501 | } | ||
502 |
1/1✓ Branch 1 taken 4 times.
|
8 | return ptimetable_createInvitationMergBlock(outputDirectory, texTimetable); |
503 | // return ptimetable_createInvitation(outputDirectory, texTimetable); | ||
504 | 4 | } | |
505 | |||
506 | |||
507 |