GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixCore/src/PString_impl.h
Date: 2025-03-14 11:56:07
Exec Total Coverage
Lines: 25 27 92.6%
Branches: 9 12 75.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 __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 4 PString PString::toString(const T & value){
19
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 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 81 PString & PString::fromValue(const T & other){
37
1/1
✓ Branch 1 taken 81 times.
81 std::string tmpValue(valueToString(other));
38
1/1
✓ Branch 1 taken 81 times.
81 copyPString(tmpValue);
39 81 return *this;
40 81 }
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 1441 PString & PString::operator = (const T & other){
57
1/2
✓ Branch 1 taken 727 times.
✗ Branch 2 not taken.
1441 std::string tmp(valueToString(other));
58
1/2
✓ Branch 1 taken 727 times.
✗ Branch 2 not taken.
1441 copyPString(tmp);
59 1441 return *this;
60 1441 }
61
62 ///Append type in PString
63 /** @param other : type to be appended
64 * @return PString
65 */
66 template<typename T>
67 37 PString & PString::operator += (const T & other){
68
1/1
✓ Branch 1 taken 28 times.
37 std::string tmp(valueToString(other));
69
1/1
✓ Branch 1 taken 28 times.
37 concatenatePString(tmp);
70 37 return *this;
71 37 }
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