00001
00002
00007 #ifndef __STRUTIL_H__
00008 #define __STRUTIL_H__
00009
00010 #include <string>
00011 #include <map>
00012
00013 #include "libepp_nicbr.H"
00014
00015 using std::string;
00016 using std::map;
00017 using std::less;
00018
00019 LIBEPP_NICBR_NS_BEGIN
00020
00022 class StrUtil
00023 {
00024 public:
00026
00033 static string parse(const string &text,
00034 const map < string, string, less<string> > &to_parse,
00035 string tag_begin, string tag_end);
00036
00038
00044 static int gsub(string &buffer, const char *pat, const char *drp);
00045
00047
00052 template<class kind>
00053 static inline string to_string(const char* format, const kind &number)
00054 {
00055
00056 const int _NUMBER_SIZE = 128;
00057 char *p;
00058
00059 p = new char[_NUMBER_SIZE];
00060 snprintf(p, (_NUMBER_SIZE - 1), format, number);
00061 string s(p);
00062
00063 delete [] p;
00064 return s;
00065 }
00066
00074 static int iso88591_to_utf8(const string &iso88591, string &utf8);
00075
00084 static int utf8_to_iso88591(const string &utf8, string &iso88591);
00085
00087
00091 string xml_beautifier(const string &input_txt);
00092 };
00093
00094 LIBEPP_NICBR_NS_END
00095 #endif //__STRUTIL_H__