00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2005 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Magnus Norddahl 00027 */ 00028 00029 #ifndef header_string_help 00030 #define header_string_help 00031 00032 #include <vector> 00033 00034 class CL_StringHelp 00035 { 00037 public: 00038 static std::vector<CL_String> split_text(const CL_String &text, const CL_String &split_string); 00039 00040 static int compare(const CL_StringA &a, const CL_StringA &b, bool case_insensitive = false); 00041 00042 static int compare(const CL_StringW &a, const CL_StringW &b, bool case_insensitive = false); 00043 00044 static CL_String text_to_upper(const CL_String &s); 00045 00046 static CL_StringA local8_to_upper(const CL_StringA &s); 00047 00048 static CL_StringW ucs2_to_upper(const CL_StringW &s); 00049 00050 static CL_String text_to_lower(const CL_String &s); 00051 00052 static CL_StringA local8_to_lower(const CL_StringA &s); 00053 00054 static CL_StringW ucs2_to_lower(const CL_StringW &s); 00055 00056 static CL_String float_to_text(float value); 00057 00058 static CL_StringA float_to_local8(float value); 00059 00060 static CL_StringW float_to_ucs2(float value); 00061 00062 static float text_to_float(const CL_String &value); 00063 00064 static float local8_to_float(const CL_StringA &value); 00065 00066 static float ucs2_to_float(const CL_StringW &value); 00067 00068 static CL_String double_to_text(double value); 00069 00070 static CL_StringA double_to_local8(double value); 00071 00072 static CL_StringW double_to_ucs2(double value); 00073 00074 static double text_to_double(const CL_String &value); 00075 00076 static double local8_to_double(const CL_StringA &value); 00077 00078 static double ucs2_to_double(const CL_StringW &value); 00079 00080 static CL_String int_to_text(int value); 00081 00082 static CL_StringA int_to_local8(int value); 00083 00084 static CL_StringW int_to_ucs2(int value); 00085 00086 static int text_to_int(const CL_String &value); 00087 00088 static int local8_to_int(const CL_StringA &value); 00089 00090 static int ucs2_to_int(const CL_StringW &value); 00091 00092 static CL_StringA text_to_local8(const CL_String &text); 00093 00094 static CL_StringA text_to_utf8(const CL_String &text); 00095 00096 static CL_StringA ucs2_to_latin1(const CL_StringW &ucs2); 00097 00098 static CL_StringA ucs2_to_latin9(const CL_StringW &ucs2); 00099 00100 static CL_StringA ucs2_to_local8(const CL_StringW &ucs2); 00101 00102 static CL_StringA ucs2_to_utf8(const CL_StringW &ucs2); 00103 00104 static CL_String local8_to_text(const CL_StringA &local8); 00105 00106 static CL_String ucs2_to_text(const CL_StringW &ucs2); 00107 00108 static CL_StringW latin1_to_ucs2(const CL_StringA &latin1); 00109 00110 static CL_StringW latin9_to_ucs2(const CL_StringA &latin9); 00111 00112 static CL_StringW local8_to_ucs2(const CL_StringA &local8); 00113 00114 static CL_StringW utf8_to_ucs2(const CL_StringA &utf8); 00115 00116 static CL_String utf8_to_text(const CL_StringA &utf8); 00117 00119 private: 00120 static const char trailing_bytes_for_utf8[256]; 00121 00122 static const unsigned char bitmask_leadbyte_for_utf8[6]; 00123 }; 00124 00125 #endif
1.4.1