ZenLib

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Ztring.h
Go to the documentation of this file.
1 /* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2 *
3 * Use of this source code is governed by a zlib-style license that can
4 * be found in the License.txt file in the root of the source tree.
5 */
6
7 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 //
9 // More methods for std::(w)string
10 //
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
13 //---------------------------------------------------------------------------
14 #ifndef ZenLib_ZtringH
15 #define ZenLib_ZtringH
16 //---------------------------------------------------------------------------
17
18 //---------------------------------------------------------------------------
19 #include "ZenLib/Utils.h"
20 #include <string>
21 #include <sstream>
22 //---------------------------------------------------------------------------
23
24 namespace ZenLib
25 {
26
27 //---------------------------------------------------------------------------
28 typedef std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> > tstring;
29 //---------------------------------------------------------------------------
30
31 //---------------------------------------------------------------------------
32 /// @brief Options for Ztring methods
33 enum ztring_t
34 {
35 Ztring_Nothing,
36 Ztring_Rounded = 1, ///< if >.5, upper, else lower
37 Ztring_CaseSensitive = 2, ///< Case sensitive ("A" and "a" are different)
38 Ztring_AddLastItem = 4, ///< if Begin is found and End is not found, return between Begin and end of string
39 Ztring_Recursive = 8, ///< Do all strings
40 Ztring_NoZero = 16 ///> Doesn't keep Zero in the float number
41 };
42
43 //---------------------------------------------------------------------------
44
45 //***************************************************************************
46 /// @brief String manipulation (based on std::(w)string)
47 //***************************************************************************
48
49 class Ztring : public tstring //for details about undocumented methods see http://www.sgi.com/tech/stl/basic_string.html
50 {
51 public :
52 //Constructor/destructor
53 Ztring () : tstring(){}
54 Ztring (const tstring& str) : tstring(str){}
55 Ztring (const tstring& str, size_type pos, size_type n=npos) : tstring(str, pos, n){}
56 Ztring (const Char* s, size_type n) : tstring(s, n){}
57 Ztring (const Char* s) : tstring(s){}
58 Ztring (size_type n, Char c) : tstring(n, c){}
59 #ifdef UNICODE
60 Ztring (const char* S) : tstring(){From_UTF8(S);}
61 Ztring (const char* S, size_type n) : tstring(){From_UTF8(S, 0, n);}
62 #endif //UNICODE
63
64 //Operators
65 ///Same as [], but resize the string if Pos doesn't exist yet
66 Char &operator () (size_type Pos);
67
68 //Assign
69 bool Assign_FromFile (const Ztring &FileName);
70
71 //Conversions - From
72 #ifndef WSTRING_MISSING
73 /// @brief convert an Unicode encoded string into Ztring
74 Ztring& From_Unicode (const std::wstring &S) {return From_Unicode(S.c_str());}
75 #endif //WSTRING_MISSING
76 /// @brief convert an Unicode encoded wchar_t into Ztring
77 Ztring& From_Unicode (const wchar_t S);
78 /// @brief convert an Unicode encoded string into Ztring
79 Ztring& From_Unicode (const wchar_t *S);
80 /// @brief convert an Unicode encoded string into Ztring
81 Ztring& From_Unicode (const wchar_t *S, size_type Start, size_type Length);
82 /// @brief convert an Unicode encoded string into Ztring
83 Ztring& From_Unicode (const wchar_t *S, size_type Length) {return From_Unicode(S, 0, Length);}
84 /// @brief convert an UTF-8 encoded string into Ztring
85 Ztring& From_UTF8 (const std::string &S) {return From_UTF8(S.c_str());}
86 /// @brief convert an UTF-8 encoded string into Ztring
87 Ztring& From_UTF8 (const char *S);
88 /// @brief convert an UTF-8 encoded string into Ztring
89 Ztring& From_UTF8 (const char *S, size_type Start, size_type Length);
90 /// @brief convert an UTF-8 encoded string into Ztring
91 Ztring& From_UTF8 (const char *S, size_type Length) {return From_UTF8(S, 0, Length);}
92 /// @brief convert an UTF-16 encoded string into Ztring
93 Ztring& From_UTF16 (const char *S);
94 /// @brief convert an UTF-16 encoded string into Ztring
95 Ztring& From_UTF16 (const char *S, size_type Start, size_type Length);
96 /// @brief convert an UTF-16 encoded string into Ztring
97 Ztring& From_UTF16 (const char *S, size_type Length) {return From_UTF16(S, 0, Length);}
98 /// @brief convert an UTF-16BE encoded string into Ztring
99 Ztring& From_UTF16BE (const char *S);
100 /// @brief convert an UTF-16BE encoded string into Ztring
101 Ztring& From_UTF16BE (const char *S, size_type Start, size_type Length);
102 /// @brief convert an UTF-16BE encoded string into Ztring
103 Ztring& From_UTF16BE (const char *S, size_type Length) {return From_UTF16BE(S, 0, Length);}
104 /// @brief convert an UTF-16LE encoded string into Ztring
105 Ztring& From_UTF16LE (const char *S);
106 /// @brief convert an UTF-16LE encoded string into Ztring
107 Ztring& From_UTF16LE (const char *S, size_type Start, size_type Length);
108 /// @brief convert an UTF-16LE encoded string into Ztring
109 Ztring& From_UTF16LE (const char *S, size_type Length) {return From_UTF16LE(S, 0, Length);}
110 /// @brief convert an Locael encoded string into Ztring
111 Ztring& From_Local (const std::string &S) {return From_Local(S.c_str());}
112 /// @brief convert an Local encoded string into Ztring
113 Ztring& From_Local (const char *S);
114 /// @brief convert an Local encoded string into Ztring
115 Ztring& From_Local (const char *S, size_type Start, size_type Length);
116 /// @brief convert an Local encoded string into Ztring
117 Ztring& From_Local (const char *S, size_type Length) {return From_Local(S, 0, Length);}
118
119 /// @brief convert an ISO-8859-1 encoded string into Ztring
120 Ztring& From_ISO_8859_1 (const char *S);
121 /// @brief convert an ISO-8859-1 encoded string into Ztring
122 Ztring& From_ISO_8859_1 (const char *S, size_type Start, size_type Length);
123 /// @brief convert an ISO-8859-1 encoded string into Ztring
124 Ztring& From_ISO_8859_1 (const char *S, size_type Length) {return From_ISO_8859_1(S, 0, Length);}
125
126 /// @brief convert an ISO-8859-2 encoded string into Ztring
127 Ztring& From_ISO_8859_2 (const char *S);
128 /// @brief convert an ISO-8859-1 encoded string into Ztring
129 Ztring& From_ISO_8859_2 (const char *S, size_type Start, size_type Length);
130 /// @brief convert an ISO-8859-1 encoded string into Ztring
131 Ztring& From_ISO_8859_2 (const char *S, size_type Length) {return From_ISO_8859_2(S, 0, Length);}
132
133 /// @brief convert an 16 byte GUID into Ztring
134 Ztring& From_GUID (const int128u S);
135 /// @brief convert an 16 byte UUID into Ztring
136 Ztring& From_UUID (const int128u S);
137 /// @brief convert an 4 Character Code into Ztring
138 Ztring& From_CC4 (const char *S) {return From_Local(S, 0, 4);}
139 /// @brief convert an 4 Character Code into Ztring
140 Ztring& From_CC4 (const int8u *S) {return From_Local((const char*)S, 0, 4);}
141 /// @brief convert an 4 Character Code into Ztring
142 Ztring& From_CC4 (const int32u S);
143 /// @brief convert an 2 Character Code into Ztring
144 Ztring& From_CC3 (const char *S) {return From_Local(S, 0, 3);}
145 /// @brief convert an 4 Character Code into Ztring
146 Ztring& From_CC3 (const int8u *S) {return From_Local((const char*)S, 0, 3);}
147 /// @brief convert an 4 Character Code into Ztring
148 Ztring& From_CC3 (const int32u S);
149 /// @brief convert an 2 Character Code into Ztring
150 Ztring& From_CC2 (const char *S) {return From_CC2(ZenLib::CC2(S));}
151 /// @brief convert an 2 Character Code into Ztring
152 Ztring& From_CC2 (const int8u *S) {return From_CC2(ZenLib::CC2(S));}
153 /// @brief convert an 2 Character Code into Ztring
154 Ztring& From_CC2 (const int16u S);
155 /// @brief convert an 1 Character Code into Ztring
156 Ztring& From_CC1 (const char *S) {return From_CC1(ZenLib::CC1(S));}
157 /// @brief convert an 1 Character Code into Ztring
158 Ztring& From_CC1 (const int8u *S) {return From_CC1(ZenLib::CC1(S));}
159 /// @brief convert an 1 Character Code into Ztring
160 Ztring& From_CC1 (const int8u S);
161 /// @brief convert number into Ztring
162 Ztring& From_Number (const int8s, int8u Radix=10);
163 /// @brief convert number into Ztring
164 Ztring& From_Number (const int8u, int8u Radix=10);
165 /// @brief convert number into Ztring
166 Ztring& From_Number (const int16s, int8u Radix=10);
167 /// @brief convert number into Ztring
168 Ztring& From_Number (const int16u, int8u Radix=10);
169 /// @brief convert number into Ztring
170 Ztring& From_Number (const int32s, int8u Radix=10);
171 /// @brief convert number into Ztring
172 Ztring& From_Number (const int32u, int8u Radix=10);
173 /// @brief convert number into Ztring
174 Ztring& From_Number (const int64s, int8u Radix=10);
175 /// @brief convert number into Ztring
176 Ztring& From_Number (const int64u, int8u Radix=10);
177 /// @brief convert number into Ztring
178 Ztring& From_Number (const int128u, int8u Radix=10);
179 /// @brief convert number into Ztring
180 Ztring& From_Number (const float32, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
181 /// @brief convert number into Ztring
182 Ztring& From_Number (const float64, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
183 /// @brief convert number into Ztring
184 Ztring& From_Number (const float80, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
185 #ifdef SIZE_T_IS_LONG
186 /// @brief convert number into Ztring
187 Ztring& From_Number (const size_t, int8u Radix=10);
188 #endif //SIZE_T_IS_LONG
189 /// @brief convert number (BCD coded) into Ztring
190 Ztring& From_BCD (const int8u);
191 /// @brief convert count of milliseconds into a readable and sortable string
192 Ztring& Duration_From_Milliseconds (const int64s Milliseconds);
193 /// @deprecated replaced by the int64s version
194 Ztring& Duration_From_Milliseconds (const int64u Milliseconds);
195 /// @brief convert count of seconds since 1601 into a readable and sortable string
196 Ztring& Date_From_Milliseconds_1601 (const int64u Milliseconds);
197 /// @brief convert count of seconds since 1601 into a readable and sortable string
198 Ztring& Date_From_Seconds_1601 (const int64u Seconds);
199 /// @brief convert count of seconds since 1900 into a readable and sortable string
200 Ztring& Date_From_Seconds_1900 (const int32u Seconds);
201 /// @brief convert count of seconds since 1900 into a readable and sortable string
202 Ztring& Date_From_Seconds_1900 (const int64s Seconds);
203 /// @brief convert count of seconds since 1904 into a readable and sortable string
204 Ztring& Date_From_Seconds_1904 (const int32u Seconds);
205 /// @brief convert count of seconds since 1904 into a readable and sortable string
206 Ztring& Date_From_Seconds_1904 (const int64u Seconds);
207 /// @brief convert count of seconds since 1904 into a readable and sortable string
208 Ztring& Date_From_Seconds_1904 (const int64s Seconds);
209 /// @brief convert count of seconds since 1970 into a readable and sortable string
210 Ztring& Date_From_Seconds_1970 (const int32u Seconds);
211 /// @brief convert count of seconds since 1970 into a readable and sortable string
212 Ztring& Date_From_Seconds_1970 (const int32s Seconds);
213 /// @brief convert count of seconds since 1970 into a readable and sortable string
214 Ztring& Date_From_Seconds_1970 (const int64s Seconds);
215 /// @brief convert count of seconds since 1970 into a readable and sortable string (in local time)
216 Ztring& Date_From_Seconds_1970_Local (const int32u Seconds);
217 /// @brief convert a free formated string into a readable and sortable string
218 Ztring& Date_From_String (const char* Date, size_type Value_Size=Error);
219 /// @brief convert numbers into a readable and sortable string
220 Ztring& Date_From_Numbers (const int8u Year, const int8u Month, const int8u Day, const int8u Hour, const int8u Minute, const int8u Second);
221
222 //Conversions - To
223 #ifndef WSTRING_MISSING
224 /// @brief Convert into Unicode chars
225 /// @return the string corresponding \n
226 std::wstring To_Unicode () const;
227 #endif //WSTRING_MISSING
228 /// @brief Convert into char* (UTF-8 encoded)
229 /// @return the string corresponding \n
230 std::string To_UTF8 () const;
231 /// @brief Convert into char* (Local encoded)
232 /// @return the string corresponding \n
233 std::string To_Local () const;
234 /// @brief Convert into 16 byte UUID number
235 /// @return the value corresponding \n
236 /// 0 if there is a problem
237 int128u To_UUID () const;
238 /// @brief Convert into a 4 Character Code
239 /// @return the value corresponding \n
240 /// 0 if there is a problem
241 int32u To_CC4 () const;
242 /// @brief Convert into Int (8 bits)
243 /// @return the value corresponding \n
244 /// 0 if there is a problem
245 int8s To_int8s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
246 /// @brief Convert into unsigned Int (8 bits)
247 /// @return the value corresponding
248 /// 0 if there is a problem
249 int8u To_int8u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
250 /// @brief Convert into Int (16 bits)
251 /// @return the value corresponding \n
252 /// 0 if there is a problem
253 int16s To_int16s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
254 /// @brief Convert into unsigned Int (16 bits)
255 /// @return the value corresponding
256 /// 0 if there is a problem
257 int16u To_int16u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
258 /// @brief Convert into Int (32 bits)
259 /// @return the value corresponding \n
260 /// 0 if there is a problem
261 int32s To_int32s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
262 /// @brief Convert into unsigned Int (32 bits)
263 /// @return the value corresponding
264 /// 0 if there is a problem
265 int32u To_int32u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
266 /// @brief Convert into Int (64 bits)
267 /// @return the value corresponding \n
268 /// 0 if there is a problem
269 int64s To_int64s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
270 /// @brief Convert into unsigned Int (64 bits)
271 /// @return the value corresponding \n
272 /// 0 if there is a problem
273 int64u To_int64u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
274 /// @brief Convert into unsigned Int (64 bits)
275 /// @warning only hexadecimal and no rounding are currenlty supported \n
276 /// @return the value corresponding \n
277 /// 0 if there is a problem
278 int128u To_int128u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
279 /// @brief Convert into float
280 /// @return the value corresponding \n
281 /// 0 if there is a problem
282 float32 To_float32 (ztring_t Options=Ztring_Nothing) const;
283 float64 To_float64 (ztring_t Options=Ztring_Nothing) const;
284 float80 To_float80 (ztring_t Options=Ztring_Nothing) const;
285
286 //Static versions
287 static Ztring ToZtring_From_Local(const std::string &S) {return Ztring().From_Local(S);}
288 static Ztring ToZtring_From_Local(const char *S) {return Ztring().From_Local(S);}
289 static Ztring ToZtring_From_Local(const char *S, size_type Start, size_type Length) {return Ztring().From_Local(S, Start, Length);}
290 static Ztring ToZtring_From_Local(const char *S, size_type Length) {return Ztring().From_Local(S, Length);}
291 static Ztring ToZtring_From_CC4 (const char *S) {return Ztring().From_CC4(S);}
292 static Ztring ToZtring_From_CC4 (const int8u *S) {return Ztring().From_CC4(S);}
293 static Ztring ToZtring_From_CC4 (const int32u S) {return Ztring().From_CC4(S);}
294 static Ztring ToZtring_From_CC3 (const char *S) {return Ztring().From_CC3(S);}
295 static Ztring ToZtring_From_CC3 (const int8u *S) {return Ztring().From_CC3(S);}
296 static Ztring ToZtring_From_CC3 (const int32u S) {return Ztring().From_CC3(S);}
297 static Ztring ToZtring_From_CC2 (const char *S) {return Ztring().From_CC2(S);}
298 static Ztring ToZtring_From_CC2 (const int8u *S) {return Ztring().From_CC2(S);}
299 static Ztring ToZtring_From_CC2 (const int16u S) {return Ztring().From_CC2(S);}
300 static Ztring ToZtring_From_CC1 (const char *S) {return Ztring().From_CC1(S);}
301 static Ztring ToZtring_From_CC1 (const int8u *S) {return Ztring().From_CC1(S);}
302 static Ztring ToZtring_From_CC1 (const int8u S) {return Ztring().From_CC1(S);}
303 static Ztring ToZtring (const int8s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
304 static Ztring ToZtring (const int8u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
305 static Ztring ToZtring (const int16s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
306 static Ztring ToZtring (const int16u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
307 static Ztring ToZtring (const int32s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
308 static Ztring ToZtring (const int32u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
309 static Ztring ToZtring (const int64s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
310 static Ztring ToZtring (const int64u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
311 static Ztring ToZtring (const int128u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
312 static Ztring ToZtring (const float32 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
313 static Ztring ToZtring (const float64 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
314 static Ztring ToZtring (const float80 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
315 #ifdef SIZE_T_IS_LONG
316 static Ztring ToZtring (const size_t I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
317 #endif //SIZE_T_IS_LONG
318
319 //Edition
320 /// @brief test if it is a number
321 bool IsNumber() const;
322 /// @brief convert into lowercase
323 Ztring &MakeLowerCase();
324 /// @brief convert into uppercase
325 Ztring &MakeUpperCase();
326 /// @brief Remove leading whitespaces from a string
327 Ztring &TrimLeft(Char ToTrim=__T(' '));
328 /// @brief Remove trailing whitespaces from a string
329 Ztring &TrimRight(Char ToTrim=__T(' '));
330 /// @brief Remove leading and trailing whitespaces from a string
331 Ztring &Trim(Char ToTrim=__T(' '));
332 /// @brief Quotes a string
333 Ztring &Quote(Char ToTrim=__T('\"'));
334 /// @brief return a string between two strings
335 /// @param Begin First string
336 /// @param End Second string
337 /// @param Pos Position to begin to scan string
338 /// @param Options Options for searching \n
339 /// Available : Ztring_CaseSensitive
340 /// @return The substring \n
341 /// "" if not found
342 Ztring SubString (const tstring &Begin, const tstring &End, size_type Pos=0, ztring_t Options=Ztring_Nothing) const;
343 /// @brief replace a string by another one
344 /// @param ToFind string to find
345 /// @param ToReplace string wich replace the string found
346 /// @param Pos Position to begin to scan string
347 /// @param Options Options for searching \n
348 /// Available : Ztring_CaseSensitive, Ztring_Recursive
349 /// @return The count of replacements
350 size_type FindAndReplace (const tstring &ToFind, const tstring &ReplaceBy, size_type Pos=0, ztring_t Options=Ztring_Nothing); //Remplace une chaine par une autre
351 /// @brief Count the number of occurencies of a string in the string
352 /// @param ToCount string to count
353 /// @param Options Options for count \n
354 /// Available : Ztring_CaseSensitive
355 /// @return the count
356
357 //Information
358 size_type Count (const Ztring &ToCount, ztring_t Options=Ztring_Nothing) const;
359 /// @brief compare with another string
360 /// @param ToCompare string to compare with
361 /// @param Options Options for comaparing \n
362 /// Available : Ztring_CaseSensitive
363 /// @return The result of comparasion
364 bool Compare (const Ztring &ToCompare, const Ztring &Comparator=__T("=="), ztring_t Options=Ztring_Nothing) const;
365 };
366
367 } //NameSpace
368
369 #endif
ZenLib::Ztring::TrimRight
Ztring & TrimRight(Char ToTrim=__T(' '))
Remove trailing whitespaces from a string.
ZenLib::Ztring_CaseSensitive
Case sensitive ("A" and "a" are different)
Definition: Ztring.h:37
ZenLib::Ztring::Count
size_type Count(const Ztring &ToCount, ztring_t Options=Ztring_Nothing) const
Count the number of occurencies of a string in the string.
ZenLib::Ztring::Date_From_Seconds_1970
Ztring & Date_From_Seconds_1970(const int32u Seconds)
convert count of seconds since 1970 into a readable and sortable string
ZenLib::Ztring::From_CC3
Ztring & From_CC3(const char *S)
convert an 2 Character Code into Ztring
Definition: Ztring.h:144
ZenLib::Char
char Char
Definition: Conf.h:215
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int32u I, int8u Radix=10)
Definition: Ztring.h:308
ZenLib::Ztring::Date_From_Seconds_1904
Ztring & Date_From_Seconds_1904(const int32u Seconds)
convert count of seconds since 1904 into a readable and sortable string
ZenLib::Ztring::From_CC2
Ztring & From_CC2(const int8u *S)
convert an 2 Character Code into Ztring
Definition: Ztring.h:152
ZenLib::Ztring::Date_From_Numbers
Ztring & Date_From_Numbers(const int8u Year, const int8u Month, const int8u Day, const int8u Hour, const int8u Minute, const int8u Second)
convert numbers into a readable and sortable string
ZenLib::uint128
Definition: int128u.h:39
ZenLib::Ztring::From_UTF16BE
Ztring & From_UTF16BE(const char *S)
convert an UTF-16BE encoded string into Ztring
ZenLib::Ztring::To_float80
float80 To_float80(ztring_t Options=Ztring_Nothing) const
ZenLib::Error
const std::size_t Error
Definition: Conf.h:189
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int8s I, int8u Radix=10)
Definition: Ztring.h:303
ZenLib::Ztring_Nothing
Definition: Ztring.h:35
ZenLib::Ztring::Duration_From_Milliseconds
Ztring & Duration_From_Milliseconds(const int64s Milliseconds)
convert count of milliseconds into a readable and sortable string
ZenLib::Ztring::From_ISO_8859_2
Ztring & From_ISO_8859_2(const char *S)
convert an ISO-8859-2 encoded string into Ztring
ZenLib::Ztring::To_float64
float64 To_float64(ztring_t Options=Ztring_Nothing) const
ZenLib::Ztring::From_CC2
Ztring & From_CC2(const char *S)
convert an 2 Character Code into Ztring
Definition: Ztring.h:150
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float64 F, int8u AfterComma=3)
Definition: Ztring.h:313
ZenLib::Ztring::To_CC4
int32u To_CC4() const
Convert into a 4 Character Code.
ZenLib::Ztring::Date_From_Milliseconds_1601
Ztring & Date_From_Milliseconds_1601(const int64u Milliseconds)
convert count of seconds since 1601 into a readable and sortable string
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const wchar_t *S, size_type Length)
convert an Unicode encoded string into Ztring
Definition: Ztring.h:83
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int16s I, int8u Radix=10)
Definition: Ztring.h:305
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int128u I, int8u Radix=10)
Definition: Ztring.h:311
ZenLib::Ztring::From_Local
Ztring & From_Local(const std::string &S)
convert an Locael encoded string into Ztring
Definition: Ztring.h:111
ZenLib::Ztring::From_UTF16BE
Ztring & From_UTF16BE(const char *S, size_type Length)
convert an UTF-16BE encoded string into Ztring
Definition: Ztring.h:103
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const int8u *S)
Definition: Ztring.h:295
ZenLib::Ztring::FindAndReplace
size_type FindAndReplace(const tstring &ToFind, const tstring &ReplaceBy, size_type Pos=0, ztring_t Options=Ztring_Nothing)
replace a string by another one
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S, size_type Length)
Definition: Ztring.h:290
ZenLib::Ztring::MakeLowerCase
Ztring & MakeLowerCase()
convert into lowercase
ZenLib::Ztring::MakeUpperCase
Ztring & MakeUpperCase()
convert into uppercase
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S)
Definition: Ztring.h:288
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float32 F, int8u AfterComma=3)
Definition: Ztring.h:312
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const int32u S)
Definition: Ztring.h:293
ZenLib::Ztring::To_int8u
int8u To_int8u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (8 bits)
ZenLib
Definition: BitStream.h:23
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const char *S)
Definition: Ztring.h:300
ZenLib::Ztring::To_Local
std::string To_Local() const
Convert into char* (Local encoded)
ZenLib::Ztring::From_BCD
Ztring & From_BCD(const int8u)
convert number (BCD coded) into Ztring
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const char *S)
Definition: Ztring.h:297
Utils.h
ZenLib::Ztring::TrimLeft
Ztring & TrimLeft(Char ToTrim=__T(' '))
Remove leading whitespaces from a string.
ZenLib::Ztring::From_UTF16LE
Ztring & From_UTF16LE(const char *S, size_type Length)
convert an UTF-16LE encoded string into Ztring
Definition: Ztring.h:109
ZenLib::Ztring::From_ISO_8859_1
Ztring & From_ISO_8859_1(const char *S, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
Definition: Ztring.h:124
ZenLib::Ztring_Recursive
Do all strings.
Definition: Ztring.h:39
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int64u I, int8u Radix=10)
Definition: Ztring.h:310
ZenLib::Ztring::From_CC3
Ztring & From_CC3(const int8u *S)
convert an 4 Character Code into Ztring
Definition: Ztring.h:146
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const std::string &S)
convert an UTF-8 encoded string into Ztring
Definition: Ztring.h:85
ZenLib::tstring
std::basic_string< Char, std::char_traits< Char >, std::allocator< Char > > tstring
Definition: Ztring.h:28
ZenLib::Ztring::To_UTF8
std::string To_UTF8() const
Convert into char* (UTF-8 encoded)
ZenLib::CC2
int16u CC2(const char *C)
Definition: Utils.h:262
ZenLib::Ztring::To_int32s
int32s To_int32s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (32 bits)
ZenLib::Ztring::To_float32
float32 To_float32(ztring_t Options=Ztring_Nothing) const
Convert into float.
ZenLib::Ztring::From_CC4
Ztring & From_CC4(const char *S)
convert an 4 Character Code into Ztring
Definition: Ztring.h:138
ZenLib::Ztring::Ztring
Ztring(const tstring &str, size_type pos, size_type n=npos)
Definition: Ztring.h:55
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const std::wstring &S)
convert an Unicode encoded string into Ztring
Definition: Ztring.h:74
ZenLib::ztring_t
ztring_t
Options for Ztring methods.
Definition: Ztring.h:33
ZenLib::Ztring::From_ISO_8859_1
Ztring & From_ISO_8859_1(const char *S)
convert an ISO-8859-1 encoded string into Ztring
ZenLib::Ztring::Ztring
Ztring()
Definition: Ztring.h:53
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const int8u *S)
Definition: Ztring.h:292
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const char *S, size_type Length)
convert an UTF-8 encoded string into Ztring
Definition: Ztring.h:91
ZenLib::Ztring::To_int128u
int128u To_int128u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (64 bits)
ZenLib::Ztring::From_CC1
Ztring & From_CC1(const char *S)
convert an 1 Character Code into Ztring
Definition: Ztring.h:156
ZenLib::Ztring::To_Unicode
std::wstring To_Unicode() const
Convert into Unicode chars.
ZenLib::Ztring::To_UUID
int128u To_UUID() const
Convert into 16 byte UUID number.
ZenLib::Ztring::From_UUID
Ztring & From_UUID(const int128u S)
convert an 16 byte UUID into Ztring
ZenLib::Ztring::Trim
Ztring & Trim(Char ToTrim=__T(' '))
Remove leading and trailing whitespaces from a string.
ZenLib::Ztring::Date_From_Seconds_1601
Ztring & Date_From_Seconds_1601(const int64u Seconds)
convert count of seconds since 1601 into a readable and sortable string
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S, size_type Start, size_type Length)
Definition: Ztring.h:289
ZenLib::Ztring::To_int64u
int64u To_int64u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (64 bits)
ZenLib::Ztring_NoZero
Definition: Ztring.h:40
ZenLib::Ztring::Quote
Ztring & Quote(Char ToTrim=__T('\"'))
Quotes a string.
ZenLib::Ztring::From_GUID
Ztring & From_GUID(const int128u S)
convert an 16 byte GUID into Ztring
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const int8u *S)
Definition: Ztring.h:298
ZenLib::Ztring::From_ISO_8859_2
Ztring & From_ISO_8859_2(const char *S, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
Definition: Ztring.h:131
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const int8u S)
Definition: Ztring.h:302
ZenLib::Ztring
String manipulation (based on std::(w)string)
Definition: Ztring.h:49
ZenLib::Ztring::To_int16s
int16s To_int16s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (16 bits)
ZenLib::CC1
int8u CC1(const char *C)
Definition: Utils.h:263
ZenLib::Ztring::To_int32u
int32u To_int32u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (32 bits)
ZenLib::Ztring::operator()
Char & operator()(size_type Pos)
Same as [], but resize the string if Pos doesn't exist yet.
ZenLib::Ztring::Date_From_Seconds_1970_Local
Ztring & Date_From_Seconds_1970_Local(const int32u Seconds)
convert count of seconds since 1970 into a readable and sortable string (in local time) ...
ZenLib::Ztring::To_int16u
int16u To_int16u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (16 bits)
ZenLib::Ztring::From_Number
Ztring & From_Number(const int8s, int8u Radix=10)
convert number into Ztring
__T
#define __T(__x)
Definition: Conf.h:217
ZenLib::Ztring::From_CC1
Ztring & From_CC1(const int8u *S)
convert an 1 Character Code into Ztring
Definition: Ztring.h:158
ZenLib::Ztring::From_UTF16
Ztring & From_UTF16(const char *S)
convert an UTF-16 encoded string into Ztring
ZenLib::Ztring::From_UTF16
Ztring & From_UTF16(const char *S, size_type Length)
convert an UTF-16 encoded string into Ztring
Definition: Ztring.h:97
ZenLib::Ztring::From_UTF16LE
Ztring & From_UTF16LE(const char *S)
convert an UTF-16LE encoded string into Ztring
ZenLib::Ztring::IsNumber
bool IsNumber() const
test if it is a number
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const char *S)
Definition: Ztring.h:294
ZenLib::Ztring::Ztring
Ztring(const Char *s, size_type n)
Definition: Ztring.h:56
ZenLib::Ztring::Date_From_String
Ztring & Date_From_String(const char *Date, size_type Value_Size=Error)
convert a free formated string into a readable and sortable string
ZenLib::Ztring::Assign_FromFile
bool Assign_FromFile(const Ztring &FileName)
ZenLib::Ztring::From_CC4
Ztring & From_CC4(const int8u *S)
convert an 4 Character Code into Ztring
Definition: Ztring.h:140
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float80 F, int8u AfterComma=3)
Definition: Ztring.h:314
ZenLib::Ztring::Compare
bool Compare(const Ztring &ToCompare, const Ztring &Comparator=__T("=="), ztring_t Options=Ztring_Nothing) const
compare with another string
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const int8u *S)
Definition: Ztring.h:301
ZenLib::Ztring::Ztring
Ztring(const Char *s)
Definition: Ztring.h:57
ZenLib::Ztring_AddLastItem
if Begin is found and End is not found, return between Begin and end of string
Definition: Ztring.h:38
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const int32u S)
Definition: Ztring.h:296
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const char *S)
Definition: Ztring.h:291
ZenLib::Ztring::To_int64s
int64s To_int64s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (64 bits)
ZenLib::Ztring_Rounded
if >.5, upper, else lower
Definition: Ztring.h:36
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int16u I, int8u Radix=10)
Definition: Ztring.h:306
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int8u I, int8u Radix=10)
Definition: Ztring.h:304
ZenLib::Ztring::Date_From_Seconds_1900
Ztring & Date_From_Seconds_1900(const int32u Seconds)
convert count of seconds since 1900 into a readable and sortable string
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int32s I, int8u Radix=10)
Definition: Ztring.h:307
ZenLib::Ztring::From_Local
Ztring & From_Local(const char *S, size_type Length)
convert an Local encoded string into Ztring
Definition: Ztring.h:117
ZenLib::Ztring::Ztring
Ztring(size_type n, Char c)
Definition: Ztring.h:58
ZenLib::Ztring::SubString
Ztring SubString(const tstring &Begin, const tstring &End, size_type Pos=0, ztring_t Options=Ztring_Nothing) const
return a string between two strings
ZenLib::Ztring::Ztring
Ztring(const tstring &str)
Definition: Ztring.h:54
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int64s I, int8u Radix=10)
Definition: Ztring.h:309
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const int16u S)
Definition: Ztring.h:299
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const std::string &S)
Definition: Ztring.h:287
ZenLib::Ztring::To_int8s
int8s To_int8s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (8 bits)