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 #include <xercesc/framework/MemBufFormatTarget.hpp>
00016 #include <xercesc/framework/XMLFormatter.hpp>
00017
00018 using std::string;
00019 using std::map;
00020 using std::less;
00021
00022 LIBEPP_NICBR_NS_BEGIN
00023
00025 class StrUtil
00026 {
00027 public:
00029
00036 static string parse(const string &text,
00037 const map < string, string, less<string> > &to_parse,
00038 string tag_begin, string tag_end);
00039
00041
00047 static int gsub(string &buffer, const char *pat, const char *drp);
00048
00050
00055 template<class kind>
00056 static inline string to_string(const char* format, const kind &number)
00057 {
00058
00059 const int _NUMBER_SIZE = 128;
00060 char *p;
00061
00062 p = new char[_NUMBER_SIZE];
00063 snprintf(p, (_NUMBER_SIZE - 1), format, number);
00064 string s(p);
00065
00066 delete [] p;
00067 return s;
00068 }
00069
00077 static int iso88591_to_utf8(const string &iso88591, string &utf8);
00078
00087 static int utf8_to_iso88591(const string &utf8, string &iso88591);
00088
00090
00094 string xml_beautifier(const string &input_txt);
00095
00097
00102 static string esc_xml_markup(const string &input_txt);
00103 };
00104
00105 LIBEPP_NICBR_NS_END
00106 #endif //__STRUTIL_H__