GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixCore/src/PString_impl.h
Date: 2025-04-25 19:10:50
Exec Total Coverage
Lines: 25 27 92.6%
Branches: 9 14 64.3%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #ifndef __PSTRING_IMPL_H__
8 #define __PSTRING_IMPL_H__
9
10 #include "PString.h"
11 #include "convertToString.h"
12
13 ///Convert a value to a PString
14 /** @param value : value to be converted
15 * @return corresponding PString
16 */
17 template<typename T>
18 6 PString PString::toString(const T & value){
19
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
6 return valueToString(value);
20 }
21
22 ///Convert the given string into a value
23 /** @param other : PString to be converted
24 * @return corresponding value
25 */
26 template<typename T>
27 T PString::toValue(const PString & other){
28 return stringToValue<T>(other);
29 }
30
31 ///Convert a value to a PString
32 /** @param other : value to be converted
33 * @return corresponding PString
34 */
35 template<typename T>
36 1 PString & PString::fromValue(const T & other){
37
1/1
✓ Branch 1 taken 1 times.
1 std::string tmpValue(valueToString(other));
38
1/1
✓ Branch 1 taken 1 times.
1 copyPString(tmpValue);
39 1 return *this;
40 1 }
41
42 ///Convert the current string into a value
43 /** @return corresponding value
44 */
45 template<typename T>
46 1 T PString::toValue() const{
47 1 T value(stringToValue<T>(*this));
48 1 return value;
49 }
50
51 ///Set type in PString
52 /** @param other : type to be set in the PString
53 * @return PString
54 */
55 template<typename T>
56 1719 PString & PString::operator = (const T & other){
57
1/2
✓ Branch 1 taken 1250 times.
✗ Branch 2 not taken.
1719 std::string tmp(valueToString(other));
58
1/2
✓ Branch 1 taken 1250 times.
✗ Branch 2 not taken.
1719 copyPString(tmp);
59 1719 return *this;
60 1719 }
61
62 ///Append type in PString
63 /** @param other : type to be appended
64 * @return PString
65 */
66 template<typename T>
67 8463 PString & PString::operator += (const T & other){
68
1/2
✓ Branch 1 taken 4366 times.
✗ Branch 2 not taken.
8463 std::string tmp(valueToString(other));
69
1/2
✓ Branch 1 taken 4366 times.
✗ Branch 2 not taken.
8463 concatenatePString(tmp);
70 8463 return *this;
71 8463 }
72
73 ///Append type in PString
74 /** @param other : type to be appended
75 * @return PString
76 */
77 template<typename T>
78 18 PString & PString::operator << (const T & other){
79
1/1
✓ Branch 1 taken 9 times.
18 std::string tmp(valueToString(other));
80
1/1
✓ Branch 1 taken 9 times.
18 concatenatePString(tmp);
81 18 return *this;
82 18 }
83
84
85 #endif
86
87