GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_updateFileName.cpp
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 30 30 100.0%
Branches: 45 46 97.8%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "convertToString.h"
8 #include "platexobj_updateFileName.h"
9
10
11 ///Update the fileName of the PLatexObj part,chapter,section,subsection,subsubsection
12 /** @param[out] obj : PLatexObj to be updated
13 */
14 12627 void platexobj_updateFileName(PLatexObj & obj){
15
6/6
✓ Branch 1 taken 12165 times.
✓ Branch 2 taken 462 times.
✓ Branch 4 taken 12038 times.
✓ Branch 5 taken 127 times.
✓ Branch 6 taken 12038 times.
✓ Branch 7 taken 589 times.
12627 if(!isSection(obj) && obj.getType() != PLatexType::FILE){return;}
16
17
2/2
✓ Branch 1 taken 462 times.
✓ Branch 2 taken 127 times.
589 if(obj.getType() != PLatexType::FILE){
18
1/1
✓ Branch 1 taken 462 times.
462 PString fileName("");
19
1/1
✓ Branch 1 taken 462 times.
462 PVecNumber & vecNumber = obj.getVecSecNumber();
20
2/2
✓ Branch 3 taken 1313 times.
✓ Branch 4 taken 462 times.
1775 for(PVecNumber::iterator it(vecNumber.begin()); it != vecNumber.end(); ++it){
21
3/3
✓ Branch 2 taken 1313 times.
✓ Branch 5 taken 1313 times.
✓ Branch 8 taken 1313 times.
1313 fileName += valueToString(*it) + "-";
22 }
23
3/3
✓ Branch 1 taken 462 times.
✓ Branch 4 taken 462 times.
✓ Branch 7 taken 462 times.
462 fileName += valueToString(obj.getId());
24
1/1
✓ Branch 1 taken 462 times.
462 fileName += ".html";
25
1/1
✓ Branch 1 taken 462 times.
462 obj.setLink(fileName);
26 462 }
27 589 PVecLatexObj & vecContent = obj.getVecContent();
28
1/2
✓ Branch 1 taken 589 times.
✗ Branch 2 not taken.
589 if(vecContent.size() != 0lu){
29
2/2
✓ Branch 4 taken 12500 times.
✓ Branch 5 taken 589 times.
13089 for(PVecLatexObj::iterator it(vecContent.begin()); it != vecContent.end(); ++it){
30
1/1
✓ Branch 2 taken 12500 times.
12500 platexobj_updateFileName(*it);
31 }
32 }
33 }
34
35 ///Update the html link
36 /** @param[out] obj : PLatexObj to be updated
37 * @param htmlFile : link of the current file
38 */
39 21258 void platexobj_updateLink(PLatexObj & obj, const PPath & htmlFile){
40
2/2
✓ Branch 1 taken 462 times.
✓ Branch 2 taken 20796 times.
21258 if(isSection(obj)){
41 462 PVecLatexObj & vecObj = obj.getVecContent();
42
2/2
✓ Branch 3 taken 5287 times.
✓ Branch 4 taken 462 times.
5749 for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
43
3/3
✓ Branch 1 taken 5287 times.
✓ Branch 4 taken 5287 times.
✓ Branch 8 taken 5287 times.
5287 platexobj_updateLink(*it, obj.getLink());
44 }
45 }else{
46
2/2
✓ Branch 1 taken 20669 times.
✓ Branch 2 taken 127 times.
20796 if(obj.getType() != PLatexType::FILE){
47
6/6
✓ Branch 3 taken 20669 times.
✓ Branch 6 taken 20669 times.
✓ Branch 9 taken 20669 times.
✓ Branch 12 taken 20669 times.
✓ Branch 15 taken 20669 times.
✓ Branch 18 taken 20669 times.
20669 obj.setLink(htmlFile + PPath("#" + valueToString(obj.getId())));
48 }
49 20796 PVecLatexObj & vecObj = obj.getVecContent();
50
2/2
✓ Branch 4 taken 15844 times.
✓ Branch 5 taken 20796 times.
36640 for(PVecLatexObj::iterator it(vecObj.begin()); it != vecObj.end(); ++it){
51
1/1
✓ Branch 2 taken 15844 times.
15844 platexobj_updateLink(*it, htmlFile);
52 }
53 }
54 21258 }
55
56 ///Update the html link
57 /** @param[out] obj : PLatexObj to be updated
58 */
59 127 void platexobj_updateLink(PLatexObj & obj){
60
2/2
✓ Branch 1 taken 127 times.
✓ Branch 4 taken 127 times.
127 PPath tmp("index.html");
61
1/1
✓ Branch 1 taken 127 times.
127 platexobj_updateLink(obj, tmp);
62 127 }
63
64