bes::String Namespace Reference


Functions

void lowerCh (char &c)
void upperCh (char &c)
void transformToLower (std::string &str)
void transformToUpper (std::string &str)
std::string toLower (const std::string &str)
std::string toUpper (const std::string &str)
int compare_nocase (const std::string &s, const std::string &s2)
int compare_nocase (const std::string &s, const char *s2)
int find_nocase (const std::string &s, const std::string &s2)
int find_nocase (const std::string &s, const char *s2)
unsigned int rwHash (const std::string &str)
int compare_nocase (const std::string &s, const std::string &s2)
int find_nocase (const std::string &s, const std::string &s2)
std::string toLower (const std::string &str)
std::string toUpper (const std::string &str)
unsigned int rwHash (const std::string &str)


Function Documentation

void bes::String::lowerCh ( char &  c  )  [inline]

Definition at line 35 of file String.h.

Referenced by transformToLower().

00035 { c = tolower(c); }

void bes::String::upperCh ( char &  c  )  [inline]

Definition at line 36 of file String.h.

Referenced by transformToUpper().

00036 { c = toupper(c); }

void bes::String::transformToLower ( std::string str  )  [inline]

Definition at line 38 of file String.h.

References lowerCh().

Referenced by toLower().

00038                                                  {
00039       std::for_each(str.begin(), str.end(), lowerCh);
00040     }  

void bes::String::transformToUpper ( std::string str  )  [inline]

Definition at line 41 of file String.h.

References upperCh().

Referenced by find_nocase(), and toUpper().

00041                                                  {
00042       std::for_each(str.begin(), str.end(), upperCh);
00043     }

std::string bes::String::toLower ( const std::string str  ) 

Definition at line 50 of file String.cxx.

References deljobs::string, and transformToLower().

00050                                        {
00051   std::string result(str);
00052   transformToLower(result);
00053   return result;
00054 }

std::string bes::String::toUpper ( const std::string str  ) 

Definition at line 57 of file String.cxx.

References deljobs::string, and transformToUpper().

00057                                        {
00058   std::string result(str);
00059   transformToUpper(result);
00060   return result;
00061 }

int bes::String::compare_nocase ( const std::string s,
const std::string s2 
)

Definition at line 27 of file String.cxx.

00027                                                                  {
00028   std::string::const_iterator p = s.begin();
00029   std::string::const_iterator p2 = s2.begin();
00030 
00031   while (p != s.end() && p2 != s2.end() ) {
00032     if (toupper(*p) != toupper(*p2)) 
00033       return (toupper(*p) < toupper(*p2)) ? -1 : 1;
00034     ++p;
00035     ++p2;
00036   }
00037   return (s2.size() == s.size()) ? 0 : (s.size() < s2.size()) ? -1 : 1;
00038 }

int bes::String::compare_nocase ( const std::string s,
const char *  s2 
) [inline]

Definition at line 56 of file String.h.

00056                                                                   {
00057       return strcasecmp(s.c_str(), s2);
00058     }

int bes::String::find_nocase ( const std::string s,
const std::string s2 
)

Definition at line 41 of file String.cxx.

References deljobs::string, and transformToUpper().

Referenced by find_nocase().

00041                                                               {
00042   std::string str1 = s;
00043   transformToUpper(str1);
00044   std::string str2 = s2;
00045   transformToUpper(str2);
00046   return str1.find(str2);
00047 }

int bes::String::find_nocase ( const std::string s,
const char *  s2 
) [inline]

Definition at line 63 of file String.h.

References find_nocase(), and deljobs::string.

00063                                                                {
00064       return find_nocase(s,std::string(s2));
00065     }

unsigned int bes::String::rwHash ( const std::string str  ) 

Definition at line 64 of file String.cxx.

References genRecEmupikp::i, and showlog::total.

00064                                      {
00065   const char* data = str.c_str();
00066   int length = str.size(), total=0;
00067   for ( int i=0; i<length; i++ ) total += data[i];
00068   return total;
00069 }

int bes::String::compare_nocase ( const std::string s,
const std::string s2 
)

Definition at line 27 of file String.cxx.

00027                                                                  {
00028   std::string::const_iterator p = s.begin();
00029   std::string::const_iterator p2 = s2.begin();
00030 
00031   while (p != s.end() && p2 != s2.end() ) {
00032     if (toupper(*p) != toupper(*p2)) 
00033       return (toupper(*p) < toupper(*p2)) ? -1 : 1;
00034     ++p;
00035     ++p2;
00036   }
00037   return (s2.size() == s.size()) ? 0 : (s.size() < s2.size()) ? -1 : 1;
00038 }

int bes::String::find_nocase ( const std::string s,
const std::string s2 
)

Definition at line 41 of file String.cxx.

References deljobs::string, and transformToUpper().

Referenced by find_nocase().

00041                                                               {
00042   std::string str1 = s;
00043   transformToUpper(str1);
00044   std::string str2 = s2;
00045   transformToUpper(str2);
00046   return str1.find(str2);
00047 }

std::string bes::String::toLower ( const std::string str  ) 

Definition at line 50 of file String.cxx.

References deljobs::string, and transformToLower().

00050                                        {
00051   std::string result(str);
00052   transformToLower(result);
00053   return result;
00054 }

std::string bes::String::toUpper ( const std::string str  ) 

Definition at line 57 of file String.cxx.

References deljobs::string, and transformToUpper().

00057                                        {
00058   std::string result(str);
00059   transformToUpper(result);
00060   return result;
00061 }

unsigned int bes::String::rwHash ( const std::string str  ) 

Definition at line 64 of file String.cxx.

References genRecEmupikp::i, and showlog::total.

00064                                      {
00065   const char* data = str.c_str();
00066   int length = str.size(), total=0;
00067   for ( int i=0; i<length; i++ ) total += data[i];
00068   return total;
00069 }


Generated on Tue Nov 29 23:36:23 2016 for BOSS_7.0.2 by  doxygen 1.4.7