PhoenixClockMock  2.0.0
Tool to manipulate mock of clock (split, merge and get info)
PString.cpp File Reference
#include "PString.h"
+ Include dependency graph for PString.cpp:

Go to the source code of this file.

Functions

PVecString eraseFirstLastChar (const PVecString &vecStr, const PString &vecChar)
 Erase first and last characters of all PString in given vector. More...
 
void eraseFirstLastChar (PVecString &vecOut, const PVecString &vecStr, const PString &vecChar)
 Erase first and last characters of all PString in given vector. More...
 
bool findInVectorString (const PVecString &vecStr, const PString &str)
 Find a string in a vector of string. More...
 
PString operator+ (const PString &other1, const PString &other2)
 Concatenate 2 PString together. More...
 
PString phoenix_charToString (const char *ch)
 Convert a char pointer into a string (event if the char pointer is NULL) More...
 
bool phoenix_isCharLowerCase (char ch)
 Tels if the character is lower case letter. More...
 
bool phoenix_isCharNumber (char ch)
 Tels if the character is a number or not. More...
 
bool phoenix_isCharUpperCase (char ch)
 Tels if the character is upper case letter. More...
 

Function Documentation

◆ eraseFirstLastChar() [1/2]

PVecString eraseFirstLastChar ( const PVecString vecStr,
const PString vecChar 
)

Erase first and last characters of all PString in given vector.

Parameters
vecStr: input PString
vecChar: set of characters to be removed
Returns
output vector of PString

Definition at line 63 of file PString.cpp.

63  {
64  PVecString vecOut;
65  eraseFirstLastChar(vecOut, vecStr, vecChar);
66  return vecOut;
67 }
void eraseFirstLastChar(PVecString &vecOut, const PVecString &vecStr, const PString &vecChar)
Erase first and last characters of all PString in given vector.
Definition: PString.cpp:52
std::vector< PString > PVecString
Definition: PString.h:99

References eraseFirstLastChar().

+ Here is the call graph for this function:

◆ eraseFirstLastChar() [2/2]

void eraseFirstLastChar ( PVecString vecOut,
const PVecString vecStr,
const PString vecChar 
)

Erase first and last characters of all PString in given vector.

Parameters
[out]vecOut: output vector of PString
vecStr: input PString
vecChar: set of characters to be removed

Definition at line 52 of file PString.cpp.

52  {
53  for(PVecString::const_iterator it(vecStr.begin()); it != vecStr.end(); ++it){
54  vecOut.push_back(it->eraseFirstLastChar(vecChar));
55  }
56 }

Referenced by checkEraseChar(), and eraseFirstLastChar().

+ Here is the caller graph for this function:

◆ findInVectorString()

bool findInVectorString ( const PVecString vecStr,
const PString str 
)

Find a string in a vector of string.

Parameters
vecStr: vector of string
str: string to be searched
Returns
true if the string has been found, false otherwise

Definition at line 74 of file PString.cpp.

74  {
75  if(vecStr.size() == 0lu || str == ""){return false;}
76  bool isSearch(true);
77  PVecString::const_iterator it(vecStr.begin());
78  while(it != vecStr.end() && isSearch){
79  isSearch = *it != str;
80  ++it;
81  }
82  return !isSearch;
83 }

Referenced by testFindInVecString().

+ Here is the caller graph for this function:

◆ operator+()

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

Concatenate 2 PString together.

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

Definition at line 209 of file PString.cpp.

209  {
210  PString res(other1);
211  res += other2;
212  return res;
213 }
Extends the std::string.
Definition: PString.h:16

◆ phoenix_charToString()

PString phoenix_charToString ( const char *  ch)

Convert a char pointer into a string (event if the char pointer is NULL)

Parameters
ch: char pointer to be converted into a string
Returns
corresponding string, or empty string if the input char pointer is NULL

Definition at line 14 of file PString.cpp.

14  {
15  if(ch != NULL){
16  PString str(ch);
17  return str;
18  }else{
19  return "";
20  }
21 }

Referenced by PString::add(), checkCharToString(), PPath::getCurrentDirectory(), and phoenix_getenv().

+ Here is the caller graph for this function:

◆ phoenix_isCharLowerCase()

bool phoenix_isCharLowerCase ( char  ch)

Tels if the character is lower case letter.

Parameters
ch: caractère à tester
Returns
true if the character is lower case letter, false otherwise

Definition at line 35 of file PString.cpp.

35  {
36  return (ch >= 97 && ch <= 122);
37 }

Referenced by PString::firstToUpper(), PString::isLowerCase(), and PString::toUpper().

+ Here is the caller graph for this function:

◆ phoenix_isCharNumber()

bool phoenix_isCharNumber ( char  ch)

Tels if the character is a number or not.

Parameters
ch: character to be analysed
Returns
true if it is a number, false otherwise

Definition at line 43 of file PString.cpp.

43  {
44  return (ch >= 48 && ch <= 57);
45 }

Referenced by PString::isNumber().

+ Here is the caller graph for this function:

◆ phoenix_isCharUpperCase()

bool phoenix_isCharUpperCase ( char  ch)

Tels if the character is upper case letter.

Parameters
ch: caractère à tester
Returns
true if character is upper case letter, false otherwise

Definition at line 27 of file PString.cpp.

27  {
28  return (ch >= 65 && ch <= 90);
29 }

Referenced by PString::firstToLower(), PString::isUpperCase(), PString::toLower(), and PString::toLowerUnderscore().

+ Here is the caller graph for this function: