PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
string_lower_upper.h File Reference
#include <string>
#include <list>
+ Include dependency graph for string_lower_upper.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::string firstToLower (const std::string &str)
 Convert first letter of the std::string in lower case. More...
 
std::string firstToUpper (const std::string &str)
 Convert first letter of the std::string in upper case. More...
 
bool isCharLetter (char ch)
 Tels if the character is a letter or '_'. More...
 
bool isCharLetterOrStar (char ch)
 Tels if the character is letter, star or '_'. More...
 
bool isCharLowerCase (char ch)
 Tels if the character is lower case letter. More...
 
bool isCharNumber (char ch)
 Tels if the character is a number or not. More...
 
bool isCharNumberDotMinusPlusE (char ch)
 Tels if the character is a figure, a '.', a -, +, e or E. More...
 
bool isCharNumberOrDot (char ch)
 Tels if the character is a number or a '.'. More...
 
bool isCharNumberOrLetter (char ch)
 Tels if the character is letter, figure or '_'. More...
 
bool isCharNumberOrLetterOrDot (char ch)
 Tels if the character is a letter, number, '.' or '_'. More...
 
bool isCharNumberOrLetterOrStar (char ch)
 Tels if the character is letter, number, star or '_'. More...
 
bool isCharNumberOrStar (char ch)
 Tels if the character is number or star. More...
 
bool isCharUpperCase (char ch)
 Tels if the character is upper case letter. More...
 
bool isListStrNumber (const std::list< std::string > &listStr)
 Say if the list of std::string contains a number. More...
 
bool isStrLowerCase (const std::string &str)
 Say if the given std::string is in lowercase. More...
 
bool isStrNumber (const std::string &str)
 Tels if std::string contains figures. More...
 
bool isStrNumberDotMinusPlusE (const std::string &str)
 Tels if std::string std::string contains figures, '.', -, +, e or E. More...
 
bool isStrNumberOrDot (const std::string &str)
 Tels if std::string contains figures or dots. More...
 
bool isStrUpperCase (const std::string &str)
 Say if the given std::string is in uppercase. More...
 
std::string strToLower (const std::string &str)
 Convert std::string in lower case. More...
 
std::string strToLowerUnderscore (const std::string &str)
 Convert std::string in lower case and space in '_'. More...
 
std::string strToUpper (const std::string &str)
 Convert std::string in upper case. More...
 

Function Documentation

◆ firstToLower()

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

Convert first letter of the std::string in lower case.

Parameters
str: std::string to be converted
Returns
std::string with first letter of the std::string in lower case

Definition at line 262 of file string_lower_upper.cpp.

262  {
263  if(str.size() == 0lu) return "";
264  std::string strOut(str);
265  char currentChar = strOut[0lu];
266  if(isCharUpperCase(currentChar)){
267  strOut[0lu] = currentChar + (char)32;
268  }
269  return strOut;
270 }

References isCharUpperCase(), and createReleaseCurl::str.

Referenced by checkResultFirstLower().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ firstToUpper()

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

Convert first letter of the std::string in upper case.

Parameters
str: std::string to be converted
Returns
std::string with first letter of the std::string in upper case

Definition at line 248 of file string_lower_upper.cpp.

248  {
249  if(str.size() == 0lu) return "";
250  std::string strOut(str);
251  char currentChar = strOut[0lu];
252  if(isCharLowerCase(currentChar)){
253  strOut[0lu] = currentChar - (char)32;
254  }
255  return strOut;
256 }

References isCharLowerCase(), and createReleaseCurl::str.

Referenced by checkResultFirstUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCharLetter()

bool isCharLetter ( char  ch)

Tels if the character is a letter or '_'.

Parameters
ch: character to be analysed
Returns
true si c'est une lettre ou un _ , false otherwise

Definition at line 98 of file string_lower_upper.cpp.

98  {
99  return (((int)ch >= 65 && (int)ch <= 90) || ((int)ch >= 97 && (int)ch <= 122) || ((int)ch == 95));
100 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharLetterOrStar()

bool isCharLetterOrStar ( char  ch)

Tels if the character is letter, star or '_'.

Parameters
ch: character to be analysed
Returns
true is letter, star or '_', false otherwise

Definition at line 130 of file string_lower_upper.cpp.

130  {
131  return (((int)ch >= 65 && (int)ch <= 90) || ((int)ch >= 97 && (int)ch <= 122) || ((int)ch == 95) || ch == '*');
132 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharLowerCase()

bool 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 154 of file string_lower_upper.cpp.

154  {
155  return (ch >= 97 && ch <= 122);
156 }

Referenced by firstToUpper(), isStrLowerCase(), strToUpper(), and testCharsType().

+ Here is the caller graph for this function:

◆ isCharNumber()

bool 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 14 of file string_lower_upper.cpp.

14  {
15  return (ch >= 48 && ch <= 57);
16 }

Referenced by isStrNumber(), and testCharsType().

+ Here is the caller graph for this function:

◆ isCharNumberDotMinusPlusE()

bool isCharNumberDotMinusPlusE ( char  ch)

Tels if the character is a figure, a '.', a -, +, e or E.

Parameters
ch: character to be analysed
Returns
true if the current char is a part of a number, false otherwise

Definition at line 60 of file string_lower_upper.cpp.

60  {
61  return ((ch >= 48 && ch <= 57) || ch == '.' || ch == '-' || ch == '+' || ch == 'e' || ch == 'E');
62 }

Referenced by isStrNumberDotMinusPlusE().

+ Here is the caller graph for this function:

◆ isCharNumberOrDot()

bool isCharNumberOrDot ( char  ch)

Tels if the character is a number or a '.'.

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

Definition at line 52 of file string_lower_upper.cpp.

52  {
53  return ((ch >= 48 && ch <= 57) || ch == '.');
54 }

Referenced by isStrNumberOrDot(), and testIsType().

+ Here is the caller graph for this function:

◆ isCharNumberOrLetter()

bool isCharNumberOrLetter ( char  ch)

Tels if the character is letter, figure or '_'.

Parameters
ch: character to be analysed
Returns
true if character is a letter, figure or '_', false otherwise

Definition at line 106 of file string_lower_upper.cpp.

106  {
107  return ((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122) || (ch == 95) || (ch >= 48 && ch <= 57));
108 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharNumberOrLetterOrDot()

bool isCharNumberOrLetterOrDot ( char  ch)

Tels if the character is a letter, number, '.' or '_'.

Parameters
ch: character to be analysed
Returns
true if it is a letter, number, '.' or '_', false otherwise

Definition at line 114 of file string_lower_upper.cpp.

114  {
115  return ((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122) || (ch == 95) || (ch >= 48 && ch <= 57) || (ch == '.'));
116 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharNumberOrLetterOrStar()

bool isCharNumberOrLetterOrStar ( char  ch)

Tels if the character is letter, number, star or '_'.

Parameters
ch: character to be analysed
Returns
true if it is letter, number, star or '_', false otherwise

Definition at line 138 of file string_lower_upper.cpp.

138  {
139  return ((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122) || (ch == 95) || (ch >= 48 && ch <= 57) || ch == '*');
140 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharNumberOrStar()

bool isCharNumberOrStar ( char  ch)

Tels if the character is number or star.

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

Definition at line 122 of file string_lower_upper.cpp.

122  {
123  return ((ch >= 48 && ch <= 57) || ch == '*');
124 }

Referenced by testCharsType().

+ Here is the caller graph for this function:

◆ isCharUpperCase()

bool 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 146 of file string_lower_upper.cpp.

146  {
147  return (ch >= 65 && ch <= 90);
148 }

Referenced by firstToLower(), isStrUpperCase(), strToLower(), strToLowerUnderscore(), and testCharsType().

+ Here is the caller graph for this function:

◆ isListStrNumber()

bool isListStrNumber ( const std::list< std::string > &  listStr)

Say if the list of std::string contains a number.

Parameters
listStr: list of std::strings to be checked
Returns
true if the list of std::string contains number, false if not

Definition at line 37 of file string_lower_upper.cpp.

37  {
38  if(listStr.size() == 0lu){return false;}
39  bool isMatch(true);
40  std::list<std::string>::const_iterator it(listStr.begin());
41  while(isMatch && it != listStr.end()){
42  isMatch &= isStrNumber(*it);
43  ++it;
44  }
45  return isMatch;
46 }

References isStrNumber().

Referenced by testIsListStrNumber().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStrLowerCase()

bool isStrLowerCase ( const std::string &  str)

Say if the given std::string is in lowercase.

Parameters
str: std::string to be checked
Returns
true if the std::string is in lowercase, false if not

Definition at line 176 of file string_lower_upper.cpp.

176  {
177  bool isLower(true);
178  size_t i(0lu);
179  while(i < str.size() && isLower){
180  isLower = isCharLowerCase(str[i]);
181  ++i;
182  }
183  return isLower;
184 }

References isCharLowerCase(), and createReleaseCurl::str.

Referenced by testIsLowerUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStrNumber()

bool isStrNumber ( const std::string &  str)

Tels if std::string contains figures.

Parameters
str: std::string to be tested
Returns
true if std::string contains only figures

Definition at line 22 of file string_lower_upper.cpp.

22  {
23  if(str.size() == 0lu){return false;}
24  bool isMatch(true);
25  long unsigned int i(0lu);
26  while(i < str.size() && isMatch){
27  isMatch = isCharNumber(str[i]);
28  ++i;
29  }
30  return isMatch;
31 }

References isCharNumber(), and createReleaseCurl::str.

Referenced by isListStrNumber(), and testIsType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStrNumberDotMinusPlusE()

bool isStrNumberDotMinusPlusE ( const std::string &  str)

Tels if std::string std::string contains figures, '.', -, +, e or E.

Parameters
str: std::string to be tested
Returns
true if std::string contains only figures, '.', -, +, e or E

Definition at line 83 of file string_lower_upper.cpp.

83  {
84  if(str.size() == 0lu){return false;}
85  bool isMatch(true);
86  long unsigned int i(0lu);
87  while(i < str.size() && isMatch){
88  isMatch = isCharNumberDotMinusPlusE(str[i]);
89  ++i;
90  }
91  return isMatch;
92 }

References isCharNumberDotMinusPlusE(), and createReleaseCurl::str.

Referenced by testIsType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStrNumberOrDot()

bool isStrNumberOrDot ( const std::string &  str)

Tels if std::string contains figures or dots.

Parameters
str: std::string to be tested
Returns
true if std::string contains only figures or dots

Definition at line 68 of file string_lower_upper.cpp.

68  {
69  if(str.size() == 0l){return false;}
70  bool isMatch(true);
71  long unsigned int i(0lu);
72  while(i < str.size() && isMatch){
73  isMatch = isCharNumberOrDot(str[i]);
74  ++i;
75  }
76  return isMatch;
77 }

References isCharNumberOrDot(), and createReleaseCurl::str.

Referenced by testIsType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStrUpperCase()

bool isStrUpperCase ( const std::string &  str)

Say if the given std::string is in uppercase.

Parameters
str: std::string to be checked
Returns
true if the std::string is in uppercase, false if not

Definition at line 162 of file string_lower_upper.cpp.

162  {
163  bool isUpper(true);
164  size_t i(0lu);
165  while(i < str.size() && isUpper){
166  isUpper = isCharUpperCase(str[i]);
167  ++i;
168  }
169  return isUpper;
170 }

References isCharUpperCase(), and createReleaseCurl::str.

Referenced by testIsLowerUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strToLower()

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

Convert std::string in lower case.

Parameters
str: std::string to be converted
Returns
lower case std::string

Definition at line 190 of file string_lower_upper.cpp.

190  {
191  std::string strOut("");
192  char currentChar;
193  long unsigned int size(str.size());
194  for(long unsigned int i(0lu); i < size; ++i){
195  currentChar = str[i];
196  if(isCharUpperCase(currentChar)){
197  strOut += currentChar + (char)32;
198  }else{
199  strOut += currentChar;
200  }
201  }
202  return strOut;
203 }

References isCharUpperCase(), and createReleaseCurl::str.

Referenced by checkResultLower().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strToLowerUnderscore()

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

Convert std::string in lower case and space in '_'.

Parameters
str: std::string to be converted
Returns
std::string in lower case and space in '_'

Definition at line 228 of file string_lower_upper.cpp.

228  {
229  std::string strOut("");
230  char currentChar;
231  long unsigned int size(str.size());
232  for(long unsigned int i(0lu); i < size; ++i){
233  currentChar = str[i];
234  if(isCharUpperCase(currentChar)){
235  strOut += currentChar + (char)32;
236  }else{
237  if(currentChar == ' ') strOut += '_';
238  else strOut += currentChar;
239  }
240  }
241  return strOut;
242 }

References isCharUpperCase(), and createReleaseCurl::str.

Referenced by checkResultLowerUnderscore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strToUpper()

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

Convert std::string in upper case.

Parameters
str: std::string to be converted
Returns
lower case std::string

Definition at line 209 of file string_lower_upper.cpp.

209  {
210  std::string strOut("");
211  char currentChar;
212  long unsigned int size(str.size());
213  for(long unsigned int i(0); i < size; ++i){
214  currentChar = str[i];
215  if(isCharLowerCase(currentChar)){
216  strOut += currentChar - (char)32;
217  }else{
218  strOut += currentChar;
219  }
220  }
221  return strOut;
222 }

References isCharLowerCase(), and createReleaseCurl::str.

Referenced by checkResultUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
isCharUpperCase
bool isCharUpperCase(char ch)
Tels if the character is upper case letter.
Definition: string_lower_upper.cpp:146
isCharLowerCase
bool isCharLowerCase(char ch)
Tels if the character is lower case letter.
Definition: string_lower_upper.cpp:154
isStrNumber
bool isStrNumber(const std::string &str)
Tels if std::string contains figures.
Definition: string_lower_upper.cpp:22
isCharNumberOrDot
bool isCharNumberOrDot(char ch)
Tels if the character is a number or a '.'.
Definition: string_lower_upper.cpp:52
createReleaseCurl.str
str
Definition: createReleaseCurl.py:128
isCharNumber
bool isCharNumber(char ch)
Tels if the character is a number or not.
Definition: string_lower_upper.cpp:14
isCharNumberDotMinusPlusE
bool isCharNumberDotMinusPlusE(char ch)
Tels if the character is a figure, a '.', a -, +, e or E.
Definition: string_lower_upper.cpp:60