#include "../tool/string_tools.h"
#include <sstream>
Include dependency graph for string_tools.cpp:
Go to the source code of this file.
Functions | |
bool | str2long (const std::string &txt, long &valeur) |
bool | str2int (const std::string &txt, int &valeur) |
bool | str2double (const std::string &txt, double &valeur) |
bool | str2bool (const std::string &str, bool &value) |
std::string | double2str (double x) |
std::string | long2str (long x) |
std::string | ulong2str (ulong x) |
std::string | bol2str (bool x) |
std::string bol2str | ( | bool | x | ) |
Definition at line 88 of file string_tools.cpp.
00089 { 00090 std::ostringstream ss; 00091 if(x) 00092 ss << "true"; 00093 else 00094 ss << "false"; 00095 return ss.str(); 00096 }
std::string double2str | ( | double | x | ) |
std::string long2str | ( | long | x | ) |
bool str2bool | ( | const std::string & | str, | |
bool & | value | |||
) |
Definition at line 49 of file string_tools.cpp.
00050 { 00051 // Try to convert str to a boolean value 00052 // return true and set the value on succeed 00053 // return if false its not a boolean 00054 if(str=="1" || str=="true" || str=="on") 00055 { 00056 value = true; 00057 return true; 00058 } 00059 if(str=="0" || str=="false" || str=="off") 00060 { 00061 value = false; 00062 return true; 00063 } 00064 return false; 00065 }
Here is the caller graph for this function:
bool str2double | ( | const std::string & | txt, | |
double & | valeur | |||
) |
bool str2int | ( | const std::string & | txt, | |
int & | valeur | |||
) |
bool str2long | ( | const std::string & | txt, | |
long & | valeur | |||
) |
std::string ulong2str | ( | ulong | x | ) |