00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SHEEP_MISC_STRINGUTILS_H
00024 #define SHEEP_MISC_STRINGUTILS_H
00025
00026 #include "config.h"
00027
00028 #include <cctype>
00029 #include <cstring>
00030 #include <sstream>
00031 #include <string>
00032
00033 namespace sheep {
00034
00035 class StringUtils {
00036 public:
00037
00038
00039 static std::string ToLower(const std::string &s);
00040 static std::string ToUpper(const std::string &s);
00041
00042
00043 static int CompareNoCase(const std::string &s1, const std::string &s2);
00044
00045 struct ConversionErrorException {};
00046
00047 template<typename T>
00048 static T FromString(const std::string &s)
00049 throw(ConversionErrorException);
00050
00051 template<typename T>
00052 static std::string ToString(const T &t);
00053
00054
00055
00056
00057 static char *Replicate(const char *s);
00058
00059
00060
00061
00062
00063
00064
00065 static std::string NormalizePath(const std::string &s);
00066
00067 static std::string GetPath(const std::string &s);
00068 static std::string GetFilename(const std::string &s);
00069
00070 static std::string GetExtension(const std::string &s);
00071 static std::string RemoveExtension(const std::string &s);
00072 };
00073
00074 #include "stringutils.inl"
00075
00076 }
00077
00078 #endif // !SHEEP_MISC_STRINGUTILS_H