GCC Code Coverage Report


Directory: src/
File: pinkscape_slide.cpp
Date: 2025-09-09 14:54:30
Exec Total Coverage
Lines: 14 19 73.7%
Functions: 3 3 100.0%
Branches: 19 35 54.3%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include <sys/stat.h>
8 #include <sys/types.h>
9 #include <fstream>
10
11 #include "data_all.h"
12 #include "convertToString.h"
13
14 #include "pinkscape_slide.h"
15
16 ///Load the map file of all the formulae if it exists
17 /** @param[out] mapFormula : map of formulae to be loaded to avoid calling latex too much
18 */
19 1 void pinkscape_loadSlideMap(PMapSlide & mapFormula, const PPath & baseOutputName){
20
5/5
✓ Branch 0 (2→3) taken 1 times.
✓ Branch 2 (3→4) taken 1 times.
✓ Branch 4 (4→5) taken 1 times.
✓ Branch 6 (5→6) taken 1 times.
✓ Branch 8 (6→7) taken 1 times.
1 PPath fileName(baseOutputName + PPath(SLIDE_RECOVER_FILE));
21
2/3
✓ Branch 0 (11→12) taken 1 times.
✓ Branch 2 (12→13) taken 1 times.
✗ Branch 3 (12→14) not taken.
1 if(!data_load(fileName, mapFormula)){return;}
22 1 }
23
24 ///Save the map file of the formulae to avoid extra latex call
25 /** @param[out] mapFormula : map of formulae to be saved
26 */
27 1 void pinkscape_saveSlideMap(const PMapSlide & mapFormula, const PPath & baseOutputName){
28
5/5
✓ Branch 0 (2→3) taken 1 times.
✓ Branch 2 (3→4) taken 1 times.
✓ Branch 4 (4→5) taken 1 times.
✓ Branch 6 (5→6) taken 1 times.
✓ Branch 8 (6→7) taken 1 times.
1 PPath fileName(baseOutputName + PPath(SLIDE_RECOVER_FILE));
29
2/3
✓ Branch 0 (11→12) taken 1 times.
✓ Branch 2 (12→13) taken 1 times.
✗ Branch 3 (12→14) not taken.
1 if(!data_save(fileName, mapFormula)){return;}
30 1 }
31
32 ///Check if the slide we are going to save was already saved (with the same content) or not
33 /** @param[out] outputMode : output mode to be checked and/or updated
34 * @param outputSlide : output file name of the current slide
35 * @param slideContent : content of the slide in svg
36 */
37 9 bool pinkscape_isSlideKnown(POutoutMode & outputMode, const PPath & outputSlide, const PString & slideContent){
38 9 PMapSlide & mapSlide = outputMode.mapSlide;
39
1/1
✓ Branch 0 (2→3) taken 9 times.
9 PMapSlide::iterator it(mapSlide.find(outputSlide));
40
1/2
✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→20) taken 9 times.
9 if(it != mapSlide.end()){ //The slide is already known
41 if(it->second == slideContent){ //If the slide content is the same
42 if(outputSlide.isFileExist()){ //We do not need to save it because it already exist
43 return true;
44 }else{
45 std::cout << "pinkscape_isSlideKnown : file '"<<outputSlide<<"' does not exist" << std::endl;
46 }
47 }else{
48 std::cout << "pinkscape_isSlideKnown : '"<<outputSlide<<" 'slide content changed" << std::endl;
49 }
50 }
51 //The slide is not known
52
53 //Let's update the slide content (or create it)
54
3/3
✓ Branch 0 (20→21) taken 9 times.
✓ Branch 2 (21→22) taken 9 times.
✓ Branch 4 (22→23) taken 9 times.
9 mapSlide[outputSlide] = slideContent;
55 9 return false;
56 }
57
58
59
60
61
62