UtilString.hxx

Go to the documentation of this file.
00001 /**
00002  * \class UtilString
00003  *
00004  * \ingroup Util
00005  *
00006  * \brief A collection of useful string utilities besides what's
00007  * normally available.
00008  *
00009  * \author (last to touch it) $Author: finch $
00010  *
00011  * \version $Revision: 1.1 $
00012  *
00013  * \date $Date: 2011/01/18 05:49:20 $
00014  *
00015  * Contact: messier@huhepl.harvard.edu
00016  *
00017  * Created on: Fri Apr 15 10:17:43 2005
00018  *
00019  * $Id: UtilString.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $
00020  *
00021  */
00022 #ifndef UTILSTRING_H
00023 #define UTILSTRING_H
00024 #ifndef VECTOR
00025 #include <vector>
00026 #define VECTOR
00027 #endif
00028 #ifndef STRING
00029 #include <string>
00030 #define STRING
00031 #endif
00032 #include <sstream>
00033 
00034 
00035 namespace UtilString
00036 {
00037   bool atob(const char* s);
00038   bool atob(const char* s, bool& isvalid);
00039   int  cmp_nocase(const std::string& s1, const std::string& s2);
00040   int  cmp_wildcard(const std::string& s, const std::string& w);
00041   void MakePrintable(const char* in,
00042                      std::string& out);
00043   void StringTok(std::vector<std::string>& ls,
00044                  const std::string& str,
00045                  const std::string& tok);
00046   bool IsBool(const char* s);
00047   bool IsInt(const char* s);
00048   bool IsFloat(const char* s);
00049 
00050   std::string ToLower(const std::string& str);
00051   std::string ToUpper(const std::string& str);
00052   //Has to be inline, won't work otherwise
00053   template <class T>
00054   std::string ToString(const T& t, std::ios_base & (*f)(std::ios_base&) = std::dec) {
00055     std::ostringstream oss;
00056     oss << f << t;
00057     return oss.str();
00058   }
00059 }
00060 
00061 #endif // UTILSTRING_H
00062 ////////////////////////////////////////////////////////////////////////

Generated on 11 Aug 2013 for SKDatabase by  doxygen 1.6.1