PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
PString_impl.h
Go to the documentation of this file.
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 
14 
17 template<typename T>
18 PString PString::toString(const T & value){
19  return valueToString(value);
20 }
21 
23 
26 template<typename T>
27 T PString::toValue(const PString & other){
28  return stringToValue<T>(other);
29 }
30 
32 
35 template<typename T>
36 PString & PString::fromValue(const T & other){
37  std::string tmpValue(valueToString(other));
38  copyPString(tmpValue);
39  return *this;
40 }
41 
43 
45 template<typename T>
46 T PString::toValue() const{
47  T value(stringToValue<T>(*this));
48  return value;
49 }
50 
52 
55 template<typename T>
56 PString & PString::operator = (const T & other){
57  std::string tmp(valueToString(other));
58  copyPString(tmp);
59  return *this;
60 }
61 
63 
66 template<typename T>
67 PString & PString::operator += (const T & other){
68  std::string tmp(valueToString(other));
69  concatenatePString(tmp);
70  return *this;
71 }
72 
74 
77 template<typename T>
78 PString & PString::operator << (const T & other){
79  std::string tmp(valueToString(other));
80  concatenatePString(tmp);
81  return *this;
82 }
83 
84 
85 #endif
86 
Extends the std::string.
Definition: PString.h:16
PString & operator=(const PString &other)
Definition of equal operator of PString.
Definition: PString.cpp:112
PString & fromValue(const T &other)
Convert a value to a PString.
Definition: PString_impl.h:36
static PString toString(const T &value)
Convert a value to a PString.
Definition: PString_impl.h:18
PString & operator<<(const T &other)
Append type in PString.
Definition: PString_impl.h:78
PString & operator+=(const PString &other)
Add a PString to an other.
Definition: PString.cpp:130
T toValue() const
Convert the current string into a value.
Definition: PString_impl.h:46
void copyPString(const PString &other)
Copy function of PString.
Definition: PString.cpp:706
void concatenatePString(const PString &other)
Concatenate a PString into the current PString.
Definition: PString.cpp:722
std::string valueToString(const T &val)
Convert a type into a string.