GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixCore/src/PString_impl.h
Date: 2025-03-14 12:04:36
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 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 46 PString & PString::fromValue(const T & other){
37
1/1
✓ Branch 1 taken 46 times.
46 std::string tmpValue(valueToString(other));
38
1/1
✓ Branch 1 taken 46 times.
46 copyPString(tmpValue);
39 46 return *this;
40 46 }
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 90912 PString & PString::operator = (const T & other){
57
1/2
✓ Branch 1 taken 90032 times.
✗ Branch 2 not taken.
90912 std::string tmp(valueToString(other));
58
1/2
✓ Branch 1 taken 90032 times.
✗ Branch 2 not taken.
90912 copyPString(tmp);
59 90912 return *this;
60 90912 }
61
62 ///Append type in PString
63 /** @param other : type to be appended
64 * @return PString
65 */
66 template<typename T>
67 475839 PString & PString::operator += (const T & other){
68
1/2
✓ Branch 1 taken 237932 times.
✗ Branch 2 not taken.
475839 std::string tmp(valueToString(other));
69
1/2
✓ Branch 1 taken 237932 times.
✗ Branch 2 not taken.
475839 concatenatePString(tmp);
70 475839 return *this;
71 475839 }
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