PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
PString Class Reference

Extends the std::string. More...

#include <PString.h>

+ Inheritance diagram for PString:
+ Collaboration diagram for PString:

Public Member Functions

PStringoperator+= (const PString &other)
 Add a PString to an other. More...
 
PStringoperator+= (const std::string &other)
 Add a std::string to an other. More...
 
template<typename T >
PStringoperator+= (const T &other)
 Append type in PString. More...
 
template<typename T >
PStringoperator<< (const T &other)
 Append type in PString. More...
 
PStringoperator= (const PString &other)
 Definition of equal operator of PString. More...
 
template<typename T >
PStringoperator= (const T &other)
 Set type in PString. More...
 
 PString ()
 Default constructeur of PString. More...
 
 PString (const PString &other)
 Copy constructor of PString. More...
 
 PString (const std::string &str)
 Default constructeur of PString. More...
 
virtual ~PString ()
 Destructeur of PString. More...
 

Protected Member Functions

void concatenatePString (const PString &other)
 Concatenate a PString into the current PString. More...
 
void concatenatePString (const std::string &other)
 Concatenate a std::string into the current PString. More...
 
void copyPString (const PString &other)
 Copy function of PString. More...
 
void copyPString (const std::string &other)
 Copy function of PString. More...
 

Private Member Functions

void initialisationPString ()
 Initialisation function of the class PString. More...
 

Friends

PString operator+ (const PString &other1, const PString &other2)
 Concatenate 2 PString together. More...
 
template<typename T >
PString operator+ (const PString &other1, const T &other2)
 Add a PString and a type. More...
 
template<typename T >
PString operator+ (const T &other1, const PString &other2)
 Add a PString and a type. More...
 
PString operator<< (const PString &other1, const PString &other2)
 Concatenate 2 PString together. More...
 

Detailed Description

Extends the std::string.

Definition at line 17 of file PString.h.

Constructor & Destructor Documentation

◆ PString() [1/3]

PString::PString ( )

Default constructeur of PString.

Definition at line 11 of file PString.cpp.

12  :std::string("")
13 {
15 }

References initialisationPString().

+ Here is the call graph for this function:

◆ PString() [2/3]

PString::PString ( const std::string &  str)

Default constructeur of PString.

Parameters
str: string to initialise the PString

Definition at line 20 of file PString.cpp.

21  :std::string(str)
22 {
24 }

References initialisationPString().

+ Here is the call graph for this function:

◆ PString() [3/3]

PString::PString ( const PString other)

Copy constructor of PString.

Parameters
other: class to copy

Definition at line 29 of file PString.cpp.

30  :std::string()
31 {
32  copyPString(other);
33 }

References copyPString().

+ Here is the call graph for this function:

◆ ~PString()

PString::~PString ( )
virtual

Destructeur of PString.

Definition at line 36 of file PString.cpp.

36  {
37 
38 }

Member Function Documentation

◆ concatenatePString() [1/2]

void PString::concatenatePString ( const PString other)
protected

Concatenate a PString into the current PString.

Parameters
other: PString to be added

Definition at line 108 of file PString.cpp.

108  {
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 }

Referenced by operator+=().

+ Here is the caller graph for this function:

◆ concatenatePString() [2/2]

void PString::concatenatePString ( const std::string &  other)
protected

Concatenate a std::string into the current PString.

Parameters
other: std::string to be added

Definition at line 118 of file PString.cpp.

118  {
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 }

◆ copyPString() [1/2]

void PString::copyPString ( const PString other)
protected

Copy function of PString.

Parameters
other: class to copy

Definition at line 92 of file PString.cpp.

92  {
93  resize(other.size());
94  memcpy((char*)data(), other.data(), other.size());
95 }

Referenced by operator=(), and PString().

+ Here is the caller graph for this function:

◆ copyPString() [2/2]

void PString::copyPString ( const std::string &  other)
protected

Copy function of PString.

Parameters
other: class to copy

Definition at line 100 of file PString.cpp.

100  {
101  resize(other.size());
102  memcpy((char*)data(), other.data(), other.size());
103 }

◆ initialisationPString()

void PString::initialisationPString ( )
private

Initialisation function of the class PString.

Definition at line 126 of file PString.cpp.

126  {
127 
128 }

Referenced by PString().

+ Here is the caller graph for this function:

◆ operator+=() [1/3]

PString & PString::operator+= ( const PString other)

Add a PString to an other.

Parameters
other: PString to be added to the current one
Returns
PString

Definition at line 53 of file PString.cpp.

53  {
54  concatenatePString(other);
55  return *this;
56 }

References concatenatePString().

+ Here is the call graph for this function:

◆ operator+=() [2/3]

PString & PString::operator+= ( const std::string &  other)

Add a std::string to an other.

Parameters
other: std::string to be added to the current one
Returns
PString

Definition at line 62 of file PString.cpp.

62  {
63  concatenatePString(other);
64  return *this;
65 }

References concatenatePString().

+ Here is the call graph for this function:

◆ operator+=() [3/3]

template<typename T >
PString& PString::operator+= ( const T &  other)
inline

Append type in PString.

Parameters
other: type to be appended
Returns
PString

Definition at line 48 of file PString.h.

55  {

◆ operator<<()

template<typename T >
PString& PString::operator<< ( const T &  other)
inline

Append type in PString.

Parameters
other: type to be appended
Returns
PString

Definition at line 59 of file PString.h.

70  {

◆ operator=() [1/2]

PString & PString::operator= ( const PString other)

Definition of equal operator of PString.

Parameters
other: class to copy
Returns
copied class

Definition at line 44 of file PString.cpp.

44  {
45  copyPString(other);
46  return *this;
47 }

References copyPString().

+ Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T >
PString& PString::operator= ( const T &  other)
inline

Set type in PString.

Parameters
other: type to be set in the PString
Returns
PString

Definition at line 34 of file PString.h.

44  {

Friends And Related Function Documentation

◆ operator+ [1/3]

PString operator+ ( const PString other1,
const PString other2 
)
friend

Concatenate 2 PString together.

Parameters
other1: left PString
other2: right PString
Returns
concatenated PString

Definition at line 72 of file PString.cpp.

72  {
73  PString res(other1);
74  res += other2;
75  return res;
76 }

◆ operator+ [2/3]

template<typename T >
PString operator+ ( const PString other1,
const T &  other2 
)
friend

Add a PString and a type.

Parameters
other1: PString
other2: type to be appended
Returns
PString

Definition at line 74 of file PString.h.

82  {

◆ operator+ [3/3]

template<typename T >
PString operator+ ( const T &  other1,
const PString other2 
)
friend

Add a PString and a type.

Parameters
other1: type to be appended
other2: PString
Returns
PString

Definition at line 86 of file PString.h.

89  :
90  void copyPString(const PString & other);
91  void copyPString(const std::string & other);

◆ operator<<

PString operator<< ( const PString other1,
const PString other2 
)
friend

Concatenate 2 PString together.

Parameters
other1: left PString
other2: right PString
Returns
concatenated PString

Definition at line 83 of file PString.cpp.

83  {
84  PString res(other1);
85  res += other2;
86  return res;
87 }

The documentation for this class was generated from the following files:
PString::concatenatePString
void concatenatePString(const PString &other)
Concatenate a PString into the current PString.
Definition: PString.cpp:108
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