GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixTex2Html/src/PLatexObj/update_wip.cpp
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 32 33 97.0%
Branches: 38 40 95.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7
8 #include "update_wip.h"
9
10 ///Check in a vector of latex objects if there is a wip
11 /** @param vecContent : vector of latex objects
12 * @return true if the vector of content contains a wip
13 */
14 33 bool updateVecContent(const PVecLatexObj & vecContent){
15 33 bool hasWip(false);
16
2/2
✓ Branch 4 taken 54 times.
✓ Branch 5 taken 33 times.
87 for(PVecLatexObj::const_iterator it(vecContent.begin()); it != vecContent.end(); ++it){
17
2/3
✓ Branch 2 taken 54 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 54 times.
54 if(it->getType() == PLatexType::WORK_IN_PROGRESS){
18 hasWip = true;
19
3/3
✓ Branch 2 taken 54 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 48 times.
54 }else if(it->getVecContent().size() != 0lu){
20
2/2
✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
6 hasWip |= updateVecContent(it->getVecContent());
21 }
22 }
23 33 return hasWip;
24 }
25
26 ///Update the wip of a obj and say if there was a WIP inside or not
27 /** @param[out] obj : PLatexObj to be updated
28 * @return true if the section contains a wip
29 */
30 27 bool updateSectionWip(PLatexObj & obj){
31 27 bool hasWip(false);
32 27 PVecLatexObj & vecObj = obj.getVecContent();
33
2/2
✓ Branch 4 taken 201 times.
✓ Branch 5 taken 27 times.
228 for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
34
3/3
✓ Branch 2 taken 201 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 183 times.
201 if(isSection(*it)){
35
1/1
✓ Branch 2 taken 18 times.
18 hasWip |= updateSectionWip(*it);
36
3/3
✓ Branch 2 taken 183 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 174 times.
183 }else if(it->getType() == PLatexType::WORK_IN_PROGRESS){
37 9 hasWip = true;
38 }else{
39
3/3
✓ Branch 2 taken 174 times.
✓ Branch 5 taken 27 times.
✓ Branch 6 taken 147 times.
174 if(it->getVecContent().size() != 0lu){ //If the content contains sub latex
40
2/2
✓ Branch 2 taken 27 times.
✓ Branch 5 taken 27 times.
27 hasWip |= updateVecContent(it->getVecContent());
41 }
42 }
43 }
44
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 if(isSection(obj)){
45 27 obj.setIsWorkInProgress(hasWip);
46
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 12 times.
27 if(hasWip){
47
1/1
✓ Branch 1 taken 15 times.
15 PLatexObj wipObj;
48
1/1
✓ Branch 1 taken 15 times.
15 wipObj.setType(PLatexType::TEXT);
49
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 wipObj.setText(" (WIP)");
50
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 obj.getComplexTitle().push_back(wipObj);
51 15 }
52 }
53 27 return hasWip;
54 }
55
56 ///Update the Part/Chapter/Section/etc if they contains a work in progress
57 /** @param[out] obj : PLatexObj to be updated
58 */
59 3 void updateWip(PLatexObj & obj){
60 3 PVecLatexObj & vecObj = obj.getVecContent();
61
2/2
✓ Branch 4 taken 95 times.
✓ Branch 5 taken 3 times.
98 for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
62
3/3
✓ Branch 2 taken 95 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 86 times.
95 if(isSection(*it)){
63
1/1
✓ Branch 2 taken 9 times.
9 updateSectionWip(*it);
64 }
65 }
66 3 }
67
68
69