GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixPresentation/tmp_project/PhoenixBeamerCreator/tmp_project/PhoenixCore/src/convertToString_impl.h
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 11 11 100.0%
Branches: 6 12 50.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #ifndef __CONVERTTOSTRING_IMPL_H__
8 #define __CONVERTTOSTRING_IMPL_H__
9
10 #include "convertToString.h"
11 #include "PString.h"
12 #include "PPath.h"
13
14 ///Convert a type into a string
15 /** @param val : value to be converted
16 * @return converted string
17 */
18 template<typename T>
19 7931265 std::string valueToString(const T & val){
20
1/2
✓ Branch 1 taken 7384157 times.
✗ Branch 2 not taken.
7931265 std::stringstream str;
21
1/2
✓ Branch 1 taken 7384157 times.
✗ Branch 2 not taken.
7931265 str << val;
22
1/2
✓ Branch 1 taken 7384157 times.
✗ Branch 2 not taken.
15862530 return str.str();
23 7931265 }
24
25 ///Convert a string into value
26 /** @param str : string to be converted
27 * @return converted value
28 */
29 template<typename T>
30 96 T stringToValue(const std::string & str){
31
1/2
✓ Branch 1 taken 95 times.
✗ Branch 2 not taken.
96 std::stringstream strStream;
32
1/2
✓ Branch 1 taken 95 times.
✗ Branch 2 not taken.
96 strStream << str;
33 T val;
34
1/2
✓ Branch 1 taken 95 times.
✗ Branch 2 not taken.
96 strStream >> val;
35 96 return val;
36 96 }
37
38
39 #endif
40
41