GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_rawtext.cpp
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 24 24 100.0%
Branches: 36 59 61.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "platexobj_html.h"
8 #include "platexobj_rawtext.h"
9
10
11 ///Convert a PLatexObj into a raw text string
12 /** @param[out] outputMode : output mode of the html backend
13 * @param obj : PLatexObj to be converted into a raw text string
14 * @return output string which contains the PLatexObj
15 */
16 21 PString platexobj_rawtextContent(const PLatexObj & obj){
17 21 PString body("");
18
3/3
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
21 body += platexobj_rawtext(obj.getVecContent());
19 21 return body;
20 }
21
22 ///Convert a PLatexObj in text
23 /** @param vecObj : vector of PLatexObj
24 * @return corresponding text
25 */
26 2478 PString platexobj_rawtext(const std::vector<PLatexObj> & vecObj){
27 2478 PString body("");
28
2/2
✓ Branch 3 taken 2540 times.
✓ Branch 4 taken 2478 times.
5018 for(std::vector<PLatexObj>::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
29
2/2
✓ Branch 2 taken 2540 times.
✓ Branch 5 taken 2540 times.
2540 body += platexobj_rawtext(*it);
30 }
31 2478 return body;
32 }
33
34 ///Convert a PLatexObj in text
35 /** @param obj : PLatexObj
36 * @return corresponding text
37 */
38 4502 PString platexobj_rawtext(const PLatexObj & obj){
39 4502 PString body("");
40
1/1
✓ Branch 1 taken 4502 times.
4502 PLatexType::PLatexType type(obj.getType());
41
4/4
✓ Branch 0 taken 2429 times.
✓ Branch 1 taken 2073 times.
✓ Branch 3 taken 2429 times.
✓ Branch 6 taken 2429 times.
4502 if(type == PLatexType::TEXT){body = platexobj_htmlStrText(obj);}
42
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2073 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2073 else if(type == PLatexType::URL){body = platexobj_htmlStrUrl(obj);}
43
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2073 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2073 else if(type == PLatexType::PERCENT){body += "%";}
44
45
4/4
✓ Branch 0 taken 45 times.
✓ Branch 1 taken 2028 times.
✓ Branch 3 taken 45 times.
✓ Branch 6 taken 45 times.
2073 else if(type == PLatexType::REF){body = platexobj_htmlStrRef(obj);}
46
4/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 2019 times.
✓ Branch 3 taken 9 times.
✓ Branch 6 taken 9 times.
2028 else if(type == PLatexType::HREF){body = platexobj_rawtextContent(obj);}
47
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2019 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2019 else if(type == PLatexType::TEXTBF){body = platexobj_rawtextContent(obj);}
48
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2019 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2019 else if(type == PLatexType::TEXTIT){body = platexobj_rawtextContent(obj);}
49
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2019 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2019 else if(type == PLatexType::DEBUG){body = platexobj_htmlStrTextDebug(obj);}
50
4/4
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 2007 times.
✓ Branch 3 taken 12 times.
✓ Branch 6 taken 12 times.
2019 else if(type == PLatexType::FUNCTION){body = platexobj_rawtextContent(obj);}
51
4/4
✓ Branch 0 taken 45 times.
✓ Branch 1 taken 1962 times.
✓ Branch 3 taken 45 times.
✓ Branch 6 taken 45 times.
2007 else if(type == PLatexType::RENDEZVOUS){body = platexobj_htmlStrRendezVous(obj);}
52 else{
53
3/3
✓ Branch 1 taken 1962 times.
✓ Branch 4 taken 1962 times.
✓ Branch 7 taken 1962 times.
1962 body = platexobj_rawtext(obj.getVecContent());
54 }
55 4502 return body;
56 }
57
58
59
60
61
62