00001 /* 00002 * Copyright (C) 2001-2010 Jacek Sieka, arnetheduck on gmail point com 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef ADCHPP_TEXT_H 00020 #define ADCHPP_TEXT_H 00021 00022 namespace adchpp { 00023 00036 class Text { 00037 typedef std::string string; 00038 typedef std::wstring wstring; 00039 00040 public: 00041 static const string& acpToUtf8(const string& str, string& tmp) throw(); 00042 ADCHPP_DLL static string acpToUtf8(const string& str) throw(); 00043 00044 static const wstring& acpToWide(const string& str, wstring& tmp) throw(); 00045 ADCHPP_DLL static wstring acpToWide(const string& str) throw(); 00046 00047 static const string& utf8ToAcp(const string& str, string& tmp) throw(); 00048 ADCHPP_DLL static string utf8ToAcp(const string& str) throw(); 00049 00050 static const wstring& utf8ToWide(const string& str, wstring& tmp) throw(); 00051 ADCHPP_DLL static wstring utf8ToWide(const string& str) throw(); 00052 00053 static const string& wideToAcp(const wstring& str, string& tmp) throw(); 00054 ADCHPP_DLL static string wideToAcp(const wstring& str) throw(); 00055 00056 static const string& wideToUtf8(const wstring& str, string& tmp) throw(); 00057 ADCHPP_DLL static string wideToUtf8(const wstring& str) throw(); 00058 00059 ADCHPP_DLL static bool validateUtf8(const string& str) throw(); 00060 00061 private: 00062 static int utf8ToWc(const char* str, wchar_t& c); 00063 static void wcToUtf8(wchar_t c, string& str); 00064 }; 00065 00066 } // namespace dcpp 00067 00068 #endif