PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
PString.cpp
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 
8 #include "PString.h"
9 
12  :std::string("")
13 {
15 }
16 
18 
20 PString::PString(const std::string & str)
21  :std::string(str)
22 {
24 }
25 
27 
29 PString::PString(const PString & other)
30  :std::string()
31 {
32  copyPString(other);
33 }
34 
37 
38 }
39 
41 
45  copyPString(other);
46  return *this;
47 }
48 
50 
54  concatenatePString(other);
55  return *this;
56 }
57 
59 
62 PString & PString::operator += (const std::string & other){
63  concatenatePString(other);
64  return *this;
65 }
66 
68 
72 PString operator + (const PString & other1, const PString & other2){
73  PString res(other1);
74  res += other2;
75  return res;
76 }
77 
79 
83 PString operator << (const PString & other1, const PString & other2){
84  PString res(other1);
85  res += other2;
86  return res;
87 }
88 
90 
92 void PString::copyPString(const PString & other){
93  resize(other.size());
94  memcpy((char*)data(), other.data(), other.size());
95 }
96 
98 
100 void PString::copyPString(const std::string & other){
101  resize(other.size());
102  memcpy((char*)data(), other.data(), other.size());
103 }
104 
106 
109  std::string tmp(*this);
110  resize(tmp.size() + other.size());
111  memcpy((char*)data(), tmp.data(), tmp.size());
112  memcpy((char*)data() + tmp.size(), other.data(), other.size());
113 }
114 
116 
118 void PString::concatenatePString(const std::string & other){
119  std::string tmp(*this);
120  resize(tmp.size() + other.size());
121  memcpy((char*)data(), tmp.data(), tmp.size());
122  memcpy((char*)data() + tmp.size(), other.data(), other.size());
123 }
124 
127 
128 }
129 
130 
131 
132 
133 
PString.h
operator<<
PString operator<<(const PString &other1, const PString &other2)
Concatenate 2 PString together.
Definition: PString.cpp:83
PString::concatenatePString
void concatenatePString(const PString &other)
Concatenate a PString into the current PString.
Definition: PString.cpp:108
operator+
PString operator+(const PString &other1, const PString &other2)
Concatenate 2 PString together.
Definition: PString.cpp:72
PString::PString
PString()
Default constructeur of PString.
Definition: PString.cpp:11
createReleaseCurl.str
str
Definition: createReleaseCurl.py:128
PString::initialisationPString
void initialisationPString()
Initialisation function of the class PString.
Definition: PString.cpp:126
PString
Extends the std::string.
Definition: PString.h:17
PString::copyPString
void copyPString(const PString &other)
Copy function of PString.
Definition: PString.cpp:92
PString::operator=
PString & operator=(const PString &other)
Definition of equal operator of PString.
Definition: PString.cpp:44
PString::~PString
virtual ~PString()
Destructeur of PString.
Definition: PString.cpp:36
PString::operator+=
PString & operator+=(const PString &other)
Add a PString to an other.
Definition: PString.cpp:53