00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00025 #ifndef STRINGADAPTER_H_
00026 #define STRINGADAPTER_H_
00027
00028 #include <string>
00029 #include <sstream>
00030
00031
00032 namespace makefile
00033 {
00040 class MAKEIMPEX StringAdapter : public std::string
00041 {
00042 void use_narrow(const wchar_t* ws)
00043 {
00044 std::ostringstream ostr;
00045 for(const wchar_t* i = ws; *i; i++)
00046 {
00047 ostr.put(ostr.narrow(*i, '?'));
00048 }
00049 assign(ostr.str());
00050 }
00051 public:
00052 StringAdapter(std::wstring& ws)
00053 {
00054 use_narrow(ws.c_str());
00055 }
00056 StringAdapter(const std::string& s)
00057 : std::string(s)
00058 {}
00059 StringAdapter(const wchar_t* ws)
00060 {
00061 use_narrow(ws);
00062 }
00063 StringAdapter(const char* s)
00064 : std::string(s)
00065 {}
00066 virtual ~StringAdapter()
00067 {
00068 }
00069 };
00070
00071 }
00072
00073 #endif