Directory: | ./ |
---|---|
File: | tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_create.cpp |
Date: | 2025-03-24 18:12:43 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 74 | 83 | 89.2% |
Branches: | 40 | 50 | 80.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_create.h" | ||
8 | |||
9 | ///Create a NONE PLatexObj | ||
10 | /** @return corresponding PLatexObj | ||
11 | */ | ||
12 | 135 | PLatexObj platexobj_createNone(){ | |
13 | 135 | PLatexObj obj; | |
14 |
1/1✓ Branch 1 taken 135 times.
|
135 | obj.setType(PLatexType::NONE); |
15 | 135 | return obj; | |
16 | } | ||
17 | |||
18 | ///Create a part, chapter, section, subsection, subsubsection | ||
19 | /** @param sectionType : type of the section (PLatexType::PART, PLatexType::CHAPTER, PLatexType::SECTION, PLatexType::SUBSECTION, PLatexType::SUBSUBSECTION) | ||
20 | * @param complexTitle : title of the section | ||
21 | * @param label : label to refer the section | ||
22 | * @return corresponding PLatexObj | ||
23 | */ | ||
24 | 496 | PLatexObj platexobj_createSection(PLatexType::PLatexType sectionType, const PLatexObj & complexTitle, const PString & label){ | |
25 | 496 | PLatexObj sec; | |
26 |
1/1✓ Branch 1 taken 496 times.
|
496 | sec.setType(sectionType); |
27 |
3/3✓ Branch 1 taken 496 times.
✓ Branch 3 taken 220 times.
✓ Branch 4 taken 276 times.
|
496 | if(complexTitle.getType() == PLatexType::NONE){ |
28 |
2/2✓ Branch 1 taken 220 times.
✓ Branch 4 taken 220 times.
|
220 | sec.setComplexTitle(complexTitle.getVecContent()); |
29 | }else{ | ||
30 | 276 | std::vector<PLatexObj> vecContent; | |
31 |
1/1✓ Branch 1 taken 276 times.
|
276 | vecContent.push_back(complexTitle); |
32 |
1/1✓ Branch 1 taken 276 times.
|
276 | sec.setComplexTitle(vecContent); |
33 | 276 | } | |
34 |
1/1✓ Branch 1 taken 496 times.
|
496 | sec.setLabelName(label); |
35 | 496 | return sec; | |
36 | } | ||
37 | |||
38 | ///Create a new line | ||
39 | /** @return corresponding PLatexObj | ||
40 | */ | ||
41 | 588 | PLatexObj platexobj_createNewLine(){ | |
42 | 588 | PLatexObj obj; | |
43 |
1/1✓ Branch 1 taken 588 times.
|
588 | obj.setType(PLatexType::NEWLINE); |
44 | 588 | return obj; | |
45 | } | ||
46 | |||
47 | ///Create a TEXT | ||
48 | /** @param text : text to put into the PLatexObj | ||
49 | * @param label : label to refer the section | ||
50 | * @return corresponding PLatexObj | ||
51 | */ | ||
52 | 1261 | PLatexObj platexobj_createText(const PString & text, const PString & label){ | |
53 | 1261 | PLatexObj obj; | |
54 |
1/1✓ Branch 1 taken 1261 times.
|
1261 | obj.setType(PLatexType::TEXT); |
55 |
1/1✓ Branch 1 taken 1261 times.
|
1261 | obj.setText(text); |
56 |
1/1✓ Branch 1 taken 1261 times.
|
1261 | obj.setLabelName(label); |
57 | 1261 | return obj; | |
58 | } | ||
59 | |||
60 | ///Create a TEXT | ||
61 | /** @param text : text to put into the PLatexObj | ||
62 | * @param label : label to refer the section | ||
63 | * @return corresponding PLatexObj | ||
64 | */ | ||
65 | 792 | PLatexObj platexobj_createTextBf(const PString & text, const PString & label){ | |
66 | 792 | PLatexObj obj; | |
67 |
1/1✓ Branch 1 taken 792 times.
|
792 | obj.setType(PLatexType::TEXTBF); |
68 |
1/1✓ Branch 1 taken 792 times.
|
792 | obj.setName(text); |
69 |
1/1✓ Branch 1 taken 792 times.
|
792 | obj.setLabelName(label); |
70 | 792 | return obj; | |
71 | } | ||
72 | |||
73 | ///Create a PARAGRAPH | ||
74 | /** @param text : text to put into the PLatexObj | ||
75 | * @param label : label to refer the section | ||
76 | * @return corresponding PLatexObj | ||
77 | */ | ||
78 | 3 | PLatexObj platexobj_createParagraph(const PString & text, const PString & label){ | |
79 |
2/2✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
|
6 | return platexobj_createParagraph(platexobj_createText(text, ""), label); |
80 | } | ||
81 | |||
82 | ///Create a PARAGRAPH | ||
83 | /** @param objText : text to put into the PLatexObj | ||
84 | * @param label : label to refer the section | ||
85 | * @return corresponding PLatexObj | ||
86 | */ | ||
87 | 60 | PLatexObj platexobj_createParagraph(const PLatexObj & objText, const PString & label){ | |
88 | 60 | PLatexObj obj; | |
89 |
1/1✓ Branch 1 taken 60 times.
|
60 | obj.setType(PLatexType::PARAGRAPHE); |
90 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | appendVecContent(obj.getVecContent(), objText); |
91 |
1/1✓ Branch 1 taken 60 times.
|
60 | obj.setLabelName(label); |
92 | 60 | return obj; | |
93 | } | ||
94 | |||
95 | ///Create a reference (REF) | ||
96 | /** @param label : label to reference | ||
97 | * @param text : text of the reference link (can be empty) | ||
98 | * @return corresponding PLatexObj | ||
99 | */ | ||
100 | 135 | PLatexObj platexobj_createRef(const PString & label, const PString & text){ | |
101 |
2/2✓ Branch 2 taken 135 times.
✓ Branch 5 taken 135 times.
|
270 | return platexobj_createRef(label, platexobj_createText(text, "")); |
102 | } | ||
103 | |||
104 | ///Create a reference (REF) | ||
105 | /** @param label : label to reference | ||
106 | * @param textObj : PLatexObj of the reference link (can be empty) | ||
107 | * @return corresponding PLatexObj | ||
108 | */ | ||
109 | 1011 | PLatexObj platexobj_createRef(const PString & label, const PLatexObj & textObj){ | |
110 | 1011 | PLatexObj obj; | |
111 |
1/1✓ Branch 1 taken 1011 times.
|
1011 | obj.setType(PLatexType::REF); |
112 |
1/1✓ Branch 1 taken 1011 times.
|
1011 | obj.setName(label); |
113 |
2/2✓ Branch 1 taken 1011 times.
✓ Branch 4 taken 1011 times.
|
1011 | appendVecContent(obj.getVecContent(), textObj); |
114 | 1011 | return obj; | |
115 | } | ||
116 | |||
117 | ///Create an ITEMIZE | ||
118 | /** @return corresponding PLatexObj | ||
119 | */ | ||
120 | 168 | PLatexObj platexobj_createItemize(){ | |
121 | 168 | PLatexObj obj; | |
122 |
1/1✓ Branch 1 taken 168 times.
|
168 | obj.setType(PLatexType::ITEMIZE); |
123 | 168 | return obj; | |
124 | } | ||
125 | |||
126 | ///Create an ITEM | ||
127 | /** @param obj : PLatexObj to put in the ITEM | ||
128 | * @return corresponding PLatexObj | ||
129 | */ | ||
130 | 345 | PLatexObj platexobj_createItem(const PLatexObj & obj){ | |
131 | 345 | PLatexObj out; | |
132 |
1/1✓ Branch 1 taken 345 times.
|
345 | out.setType(PLatexType::ITEM); |
133 |
2/2✓ Branch 1 taken 345 times.
✓ Branch 4 taken 345 times.
|
345 | appendVecContent(out.getVecContent(), obj); |
134 | 345 | return out; | |
135 | } | ||
136 | |||
137 | ///Create an ITEM | ||
138 | /** @param vecObj : vector of PLatexObj to put in the ITEM | ||
139 | * @return corresponding PLatexObj | ||
140 | */ | ||
141 | ✗ | PLatexObj platexobj_createItem(const std::vector<PLatexObj> & vecObj){ | |
142 | ✗ | PLatexObj obj; | |
143 | ✗ | obj.setType(PLatexType::ITEM); | |
144 | ✗ | appendVecContent(obj.getVecContent(), vecObj); | |
145 | ✗ | return obj; | |
146 | } | ||
147 | |||
148 | ///Create an TIMETABLE_TIMEROW | ||
149 | /** @return corresponding PLatexObj | ||
150 | */ | ||
151 | 64 | PLatexObj platexobj_createTimetableTimeRow(){ | |
152 | 64 | PLatexObj obj; | |
153 |
1/1✓ Branch 1 taken 64 times.
|
64 | obj.setType(PLatexType::TIMETABLE_TIMEROW); |
154 | 64 | return obj; | |
155 | } | ||
156 | |||
157 | ///Create a TIMETABLE_BLOCK | ||
158 | /** @param blockStyle : style of the block | ||
159 | * @return corresponding PLatexObj | ||
160 | */ | ||
161 | 199 | PLatexObj platexobj_createTimetableBlock(const PString & blockStyle){ | |
162 | 199 | PLatexObj cell; | |
163 |
1/1✓ Branch 1 taken 199 times.
|
199 | cell.setType(PLatexType::TIMETABLE_BLOCK); |
164 |
1/1✓ Branch 1 taken 199 times.
|
199 | cell.setText(blockStyle); |
165 | 199 | return cell; | |
166 | } | ||
167 | |||
168 | ///Create a TIMETABLE_BLOCK | ||
169 | /** @param blockStyle : style of the block | ||
170 | * @param obj : PLatexObj to put in the ITEM | ||
171 | * @return corresponding PLatexObj | ||
172 | */ | ||
173 | 199 | PLatexObj platexobj_createTimetableBlock(const PString & blockStyle, const PLatexObj & obj){ | |
174 | 199 | PLatexObj cell(platexobj_createTimetableBlock(blockStyle)); | |
175 |
2/2✓ Branch 1 taken 199 times.
✓ Branch 4 taken 199 times.
|
199 | appendVecContent(cell.getVecContent(), obj); |
176 | 199 | return cell; | |
177 | } | ||
178 | |||
179 | ///Create a TIMETABLE_BLOCK | ||
180 | /** @param blockStyle : style of the block | ||
181 | * @param vecObj : vector of PLatexObj to put in the ITEM | ||
182 | * @return corresponding PLatexObj | ||
183 | */ | ||
184 | ✗ | PLatexObj platexobj_createTimetableBlock(const PString & blockStyle, const std::vector<PLatexObj> & vecObj){ | |
185 | ✗ | PLatexObj cell(platexobj_createTimetableBlock(blockStyle)); | |
186 | ✗ | appendVecContent(cell.getVecContent(), vecObj); | |
187 | ✗ | return cell; | |
188 | } | ||
189 | |||
190 | ///Create a RENDEZVOUS | ||
191 | /** @param fileNameIcs : name of the .ics file | ||
192 | * @return corresponding PLatexObj | ||
193 | */ | ||
194 | 895 | PLatexObj platexobj_createRendezVous(const PPath & fileNameIcs){ | |
195 | 895 | PLatexObj obj; | |
196 |
1/1✓ Branch 1 taken 895 times.
|
895 | obj.setType(PLatexType::RENDEZVOUS); |
197 |
1/1✓ Branch 1 taken 895 times.
|
895 | obj.setText(fileNameIcs); |
198 | 895 | return obj; | |
199 | } | ||
200 | |||
201 | |||
202 |