QStringHandler.hh

Go to the documentation of this file.
00001 
00002 #ifndef _Q_STRING_HANDLER_HH_
00003 #define _Q_STRING_HANDLER_HH_
00004 
00005 #include <string>
00006 #include <list>
00007 
00014 namespace QStringHandler
00015 {
00017    inline std::string& SwallowSpaces(std::string& s)
00018    { return s.erase(0, s.find_first_not_of("\t ")); }
00019 
00021    inline std::string& RSwallowSpaces(std::string& s)
00022    { return s.erase(s.find_last_not_of("\t ") + 1, std::string::npos); }
00023 
00025    inline std::string& DoubleSwallowSpaces(std::string& s)
00026    { SwallowSpaces(s); return RSwallowSpaces(s); }
00027 
00032    void Escape(std::string& text, char toBeEscaped);
00033 
00038    void UnEscape(std::string& text, char escaped);
00039 
00044    void Replace(std::string& text, char oldChar, char newChar);
00045 
00057    size_t Split(std::string             source,
00058                 std::list<std::string>& splitted,
00059                 char                    separtator);
00060 
00076    bool StringToInt(std::string in, int &out, bool strictCheck);
00077    
00079    inline bool StringToInt(const std::string& in, int& out)
00080    { return StringToInt(in, out, true); }
00081 
00091    bool StringToBool(std::string in, bool &out);
00092    
00100    bool StringToDouble(std::string in, double &out, bool strictCheck);
00101 
00103    inline bool StringToDouble(const std::string& in, double& out)
00104    { return StringToDouble(in, out, true); }
00105 
00114    bool StringToChar(const std::string& in, char& out);
00115 
00116 
00118    std::string IntToString(int val);
00119 
00121    std::string BoolToString(bool val);
00122 
00132    std::string DoubleToString(double val, int nDigits = 4);
00133 
00139    std::string IntToHexString(int value);
00140    
00141 };
00142 #endif

Generated on Tue Nov 16 10:49:55 2010 for CUORE Software by  doxygen 1.5.6