soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
sstring-i.h
1#ifndef __SSTRING_I__H__
2#define __SSTRING_I__H__
3
4#include <windows.h>
5#include <utilities-def.h>
6
7SNSBEGIN
8
9#undef INTERFACE
10#define INTERFACE IStringA
11DECLARE_INTERFACE(IStringA)
12{
13 /**
14 * @brief Gets the length of the string.
15 * @return The length of the string.
16 */
17 STDMETHOD_(int, GetLength)() SCONST PURE;
18
19 /**
20 * @brief Checks if the string is empty.
21 * @return TRUE if the string is empty, FALSE otherwise.
22 */
23 STDMETHOD_(BOOL, IsEmpty)(CTHIS) SCONST PURE;
24
25 /**
26 * @brief Empties the string.
27 */
28 STDMETHOD_(void, Empty)(THIS) PURE;
29
30 /**
31 * @brief Gets the character at the specified index.
32 * @param nIndex Index of the character.
33 * @return The character at the specified index.
34 */
35 STDMETHOD_(char, GetAt)(CTHIS_ int nIndex) SCONST PURE;
36
37 /**
38 * @brief Sets the character at the specified index.
39 * @param nIndex Index of the character.
40 * @param ch Character to set.
41 */
42 STDMETHOD_(void, SetAt)(THIS_ int nIndex, char ch) PURE;
43
44 /**
45 * @brief Gets a C-style string representation of the string.
46 * @return Pointer to the C-style string.
47 */
48 STDMETHOD_(const char *, c_str)(CTHIS) SCONST PURE;
49
50 /**
51 * @brief Compares the string with another string.
52 * @param psz String to compare with.
53 * @return 0 if equal, < 0 if less, > 0 if greater.
54 */
55 STDMETHOD_(int, Compare)(CTHIS_ const char* psz) SCONST PURE;
56
57 /**
58 * @brief Compares the string with another string, ignoring case.
59 * @param psz String to compare with.
60 * @return 0 if equal, < 0 if less, > 0 if greater.
61 */
62 STDMETHOD_(int, CompareNoCase)(CTHIS_ const char* psz) SCONST PURE;
63
64 /**
65 * @brief Trims leading and trailing whitespace from the string.
66 */
67 STDMETHOD_(void, TrimBlank)(THIS) PURE;
68
69 /**
70 * @brief Inserts a character at the specified index.
71 * @param nIndex Index to insert at.
72 * @param ch Character to insert.
73 * @return The new length of the string.
74 */
75 STDMETHOD_(int, InsertChar)(THIS_ int nIndex, char ch) PURE;
76
77 /**
78 * @brief Inserts a substring at the specified index.
79 * @param nIndex Index to insert at.
80 * @param psz Substring to insert.
81 * @return The new length of the string.
82 */
83 STDMETHOD_(int, Insert)(THIS_ int nIndex, const char* psz) PURE;
84
85 /**
86 * @brief Deletes a substring from the specified index.
87 * @param nIndex Index to start deletion.
88 * @param nCount Number of characters to delete.
89 * @return The new length of the string.
90 */
91 STDMETHOD_(int, Delete)(THIS_ int nIndex, int nCount) PURE;
92
93 /**
94 * @brief Replaces all occurrences of a character with another character.
95 * @param chOld Character to replace.
96 * @param chNew Character to replace with.
97 * @return The number of replacements made.
98 */
99 STDMETHOD_(int, ReplaceChar)(THIS_ char chOld, char chNew) PURE;
100
101 /**
102 * @brief Replaces all occurrences of a substring with another substring.
103 * @param pszOld Substring to replace.
104 * @param pszNew Substring to replace with.
105 * @return The number of replacements made.
106 */
107 STDMETHOD_(int, Replace)(THIS_ const char* pszOld, const char* pszNew) PURE;
108
109 /**
110 * @brief Removes all occurrences of a character.
111 * @param chRemove Character to remove.
112 * @return The number of characters removed.
113 */
114 STDMETHOD_(int, Remove)(THIS_ char chRemove) PURE;
115
116 /**
117 * @brief Finds the first occurrence of a character.
118 * @param ch Character to find.
119 * @param nStart Starting index for the search.
120 * @return Index of the first occurrence, or -1 if not found.
121 */
122 STDMETHOD_(int, FindChar)(CTHIS_ char ch, int nStart DEF_VAL(0)) SCONST PURE;
123
124 /**
125 * @brief Finds the last occurrence of a character.
126 * @param ch Character to find.
127 * @return Index of the last occurrence, or -1 if not found.
128 */
129 STDMETHOD_(int, ReverseFind)(CTHIS_ char ch) SCONST PURE;
130
131 /**
132 * @brief Finds the first occurrence of a substring.
133 * @param pszSub Substring to find.
134 * @param nStart Starting index for the search.
135 * @return Index of the first occurrence, or -1 if not found.
136 */
137 STDMETHOD_(int, Find)(CTHIS_ const char* pszSub, int nStart DEF_VAL(0)) SCONST PURE;
138
139 /**
140 * @brief Gets a modifiable buffer for the string.
141 * @param nMinBufLength Minimum buffer length.
142 * @return Pointer to the buffer.
143 */
144 STDMETHOD_(char*, GetBuffer)(THIS_ int nMinBufLength DEF_VAL(-1)) PURE;
145
146 /**
147 * @brief Releases the buffer and sets the new length of the string.
148 * @param nNewLength New length of the string.
149 */
150 STDMETHOD_(void, ReleaseBuffer)(THIS_ int nNewLength DEF_VAL(-1)) PURE;
151
152 /**
153 * @brief Gets a buffer with the specified length.
154 * @param nNewLength New length of the buffer.
155 * @return Pointer to the buffer.
156 */
157 STDMETHOD_(char*, GetBufferSetLength)(THIS_ int nNewLength) PURE;
158
159 /**
160 * @brief Sets the length of the string.
161 * @param nLength New length of the string.
162 */
163 STDMETHOD_(void, SetLength)(THIS_ int nLength) PURE;
164
165 /**
166 * @brief Copies the contents of another string.
167 * @param src Source string.
168 */
169 STDMETHOD_(void, Copy)(THIS_ const IStringA * src) PURE;
170
171 /**
172 * @brief Assigns a C-style string to the string.
173 * @param src C-style string to assign.
174 */
175 STDMETHOD_(void, Assign)(THIS_ LPCSTR src) PURE;
176
177 /**
178 * @brief Assigns a substring of a C-style string to the string.
179 * @param src C-style string to assign.
180 * @param nLen Length of the substring.
181 */
182 STDMETHOD_(void, Assign2)(THIS_ LPCSTR src, int nLen DEF_VAL(-1)) PURE;
183
184 /**
185 * @brief Gets private data associated with the string.
186 * @return Pointer to private data.
187 */
188 STDMETHOD_(LPVOID, GetPrivData)(CTHIS) SCONST PURE;
189
190 /**
191 * @brief Converts the string to uppercase.
192 */
193 STDMETHOD_(void, ToUpper)(THIS) PURE;
194
195 /**
196 * @brief Converts the string to lowercase.
197 */
198 STDMETHOD_(void, ToLower)(THIS) PURE;
199
200 /**
201 * @brief Trims trailing characters from the string.
202 * @param chTarget Character to trim.
203 */
204 STDMETHOD_(void, TrimRight)(THIS_ char chTarget DEF_VAL(VK_SPACE)) PURE;
205
206 /**
207 * @brief Trims leading characters from the string.
208 * @param chTarget Character to trim.
209 */
210 STDMETHOD_(void, TrimLeft)(THIS_ char chTarget DEF_VAL(VK_SPACE)) PURE;
211
212 /**
213 * @brief Trims leading and trailing characters from the string.
214 * @param chTarget Character to trim.
215 */
216 STDMETHOD_(void, Trim)(THIS_ char chTarget DEF_VAL(VK_SPACE)) PURE;
217
218 /**
219 * @brief Appends a character to the string.
220 * @param ch Character to append.
221 */
222 STDMETHOD_(void, AppendChar)(THIS_ char ch) PURE;
223
224 /**
225 * @brief Appends a substring to the string.
226 * @param pszStr Substring to append.
227 * @param nLen Length of the substring.
228 */
229 STDMETHOD_(void, AppendStr)(THIS_ const char *pszStr, int nLen DEF_VAL(-1)) PURE;
230
231 /**
232 * @brief Releases the string.
233 */
234 STDMETHOD_(void, Release)(THIS) PURE;
235
236 /**
237 * @brief Converts the string to an unsigned integer.
238 * @return The unsigned integer value.
239 */
240 STDMETHOD_(UINT, ToUint)(CTHIS) SCONST PURE;
241
242 /**
243 * @brief Converts the string to a long integer.
244 * @return The long integer value.
245 */
246 STDMETHOD_(long, ToLong)(CTHIS) SCONST PURE;
247
248 /**
249 * @brief Converts the string to an integer.
250 * @return The integer value.
251 */
252 STDMETHOD_(int, ToInt)(CTHIS) SCONST PURE;
253
254 /**
255 * @brief Converts the string to a float.
256 * @return The float value.
257 */
258 STDMETHOD_(float, ToFloat)(CTHIS) SCONST PURE;
259
260 /**
261 * @brief Converts the string to a double.
262 * @return The double value.
263 */
264 STDMETHOD_(double, ToDouble)(CTHIS) SCONST PURE;
265
266 /**
267 * @brief Converts the string to a boolean.
268 * @return The boolean value.
269 */
270 STDMETHOD_(BOOL, ToBool)(CTHIS) SCONST PURE;
271};
272
273#undef INTERFACE
274#define INTERFACE IStringW
275DECLARE_INTERFACE(IStringW)
276{
277 /**
278 * @brief Gets the length of the string.
279 * @return The length of the string.
280 */
281 STDMETHOD_(int, GetLength)(CTHIS) SCONST PURE;
282
283 /**
284 * @brief Checks if the string is empty.
285 * @return TRUE if the string is empty, FALSE otherwise.
286 */
287 STDMETHOD_(BOOL, IsEmpty)(CTHIS) SCONST PURE;
288
289 /**
290 * @brief Empties the string.
291 */
292 STDMETHOD_(void, Empty)(THIS) PURE;
293
294 /**
295 * @brief Gets the character at the specified index.
296 * @param nIndex Index of the character.
297 * @return The character at the specified index.
298 */
299 STDMETHOD_(wchar_t, GetAt)(CTHIS_ int nIndex) SCONST PURE;
300
301 /**
302 * @brief Sets the character at the specified index.
303 * @param nIndex Index of the character.
304 * @param ch Character to set.
305 */
306 STDMETHOD_(void, SetAt)(THIS_ int nIndex, wchar_t ch) PURE;
307
308 /**
309 * @brief Gets a C-style string representation of the string.
310 * @return Pointer to the C-style string.
311 */
312 STDMETHOD_(const wchar_t *, c_str)(CTHIS) SCONST PURE;
313
314 /**
315 * @brief Compares the string with another string.
316 * @param psz String to compare with.
317 * @return 0 if equal, < 0 if less, > 0 if greater.
318 */
319 STDMETHOD_(int, Compare)(CTHIS_ const wchar_t* psz) SCONST PURE;
320
321 /**
322 * @brief Compares the string with another string, ignoring case.
323 * @param psz String to compare with.
324 * @return 0 if equal, < 0 if less, > 0 if greater.
325 */
326 STDMETHOD_(int, CompareNoCase)(CTHIS_ const wchar_t* psz) SCONST PURE;
327
328 /**
329 * @brief Trims leading and trailing whitespace from the string.
330 */
331 STDMETHOD_(void, TrimBlank)(THIS) PURE;
332
333 /**
334 * @brief Inserts a character at the specified index.
335 * @param nIndex Index to insert at.
336 * @param ch Character to insert.
337 * @return The new length of the string.
338 */
339 STDMETHOD_(int, InsertChar)(THIS_ int nIndex, wchar_t ch) PURE;
340
341 /**
342 * @brief Inserts a substring at the specified index.
343 * @param nIndex Index to insert at.
344 * @param psz Substring to insert.
345 * @return The new length of the string.
346 */
347 STDMETHOD_(int, Insert)(THIS_ int nIndex, const wchar_t* psz) PURE;
348
349 /**
350 * @brief Deletes a substring from the specified index.
351 * @param nIndex Index to start deletion.
352 * @param nCount Number of characters to delete.
353 * @return The new length of the string.
354 */
355 STDMETHOD_(int, Delete)(THIS_ int nIndex, int nCount) PURE;
356
357 /**
358 * @brief Replaces all occurrences of a character with another character.
359 * @param chOld Character to replace.
360 * @param chNew Character to replace with.
361 * @return The number of replacements made.
362 */
363 STDMETHOD_(int, ReplaceChar)(THIS_ wchar_t chOld, wchar_t chNew) PURE;
364
365 /**
366 * @brief Replaces all occurrences of a substring with another substring.
367 * @param pszOld Substring to replace.
368 * @param pszNew Substring to replace with.
369 * @return The number of replacements made.
370 */
371 STDMETHOD_(int, Replace)(THIS_ const wchar_t* pszOld, const wchar_t* pszNew) PURE;
372
373 /**
374 * @brief Removes all occurrences of a character.
375 * @param chRemove Character to remove.
376 * @return The number of characters removed.
377 */
378 STDMETHOD_(int, Remove)(THIS_ wchar_t chRemove) PURE;
379
380 /**
381 * @brief Finds the first occurrence of a character.
382 * @param ch Character to find.
383 * @param nStart Starting index for the search.
384 * @return Index of the first occurrence, or -1 if not found.
385 */
386 STDMETHOD_(int, FindChar)(CTHIS_ wchar_t ch, int nStart DEF_VAL(0)) SCONST PURE;
387
388 /**
389 * @brief Finds the last occurrence of a character.
390 * @param ch Character to find.
391 * @return Index of the last occurrence, or -1 if not found.
392 */
393 STDMETHOD_(int, ReverseFind)(CTHIS_ wchar_t ch) SCONST PURE;
394
395 /**
396 * @brief Finds the first occurrence of a substring.
397 * @param pszSub Substring to find.
398 * @param nStart Starting index for the search.
399 * @return Index of the first occurrence, or -1 if not found.
400 */
401 STDMETHOD_(int, Find)(CTHIS_ const wchar_t* pszSub, int nStart DEF_VAL(0)) SCONST PURE;
402
403 /**
404 * @brief Gets a modifiable buffer for the string.
405 * @param nMinBufLength Minimum buffer length.
406 * @return Pointer to the buffer.
407 */
408 STDMETHOD_(wchar_t*, GetBuffer)(THIS_ int nMinBufLength DEF_VAL(-1)) PURE;
409
410 /**
411 * @brief Releases the buffer and sets the new length of the string.
412 * @param nNewLength New length of the string.
413 */
414 STDMETHOD_(void, ReleaseBuffer)(THIS_ int nNewLength DEF_VAL(-1)) PURE;
415
416 /**
417 * @brief Gets a buffer with the specified length.
418 * @param nNewLength New length of the buffer.
419 * @return Pointer to the buffer.
420 */
421 STDMETHOD_(wchar_t*, GetBufferSetLength)(THIS_ int nNewLength) PURE;
422
423 /**
424 * @brief Sets the length of the string.
425 * @param nLength New length of the string.
426 */
427 STDMETHOD_(void, SetLength)(THIS_ int nLength) PURE;
428
429 /**
430 * @brief Copies the contents of another string.
431 * @param src Source string.
432 */
433 STDMETHOD_(void, Copy)(THIS_ const IStringW * src) PURE;
434
435 /**
436 * @brief Assigns a C-style string to the string.
437 * @param src C-style string to assign.
438 */
439 STDMETHOD_(void, Assign)(THIS_ LPCWSTR src) PURE;
440
441 /**
442 * @brief Assigns a substring of a C-style string to the string.
443 * @param src C-style string to assign.
444 * @param nLen Length of the substring.
445 */
446 STDMETHOD_(void, Assign2)(THIS_ LPCWSTR src, int nLen DEF_VAL(-1)) PURE;
447
448 /**
449 * @brief Gets private data associated with the string.
450 * @return Pointer to private data.
451 */
452 STDMETHOD_(LPVOID, GetPrivData)(CTHIS) SCONST PURE;
453
454 /**
455 * @brief Converts the string to uppercase.
456 */
457 STDMETHOD_(void, ToUpper)(THIS) PURE;
458
459 /**
460 * @brief Converts the string to lowercase.
461 */
462 STDMETHOD_(void, ToLower)(THIS) PURE;
463
464 /**
465 * @brief Trims trailing characters from the string.
466 * @param chTarget Character to trim.
467 */
468 STDMETHOD_(void, TrimRight)(THIS_ wchar_t chTarget DEF_VAL(VK_SPACE)) PURE;
469
470 /**
471 * @brief Trims leading characters from the string.
472 * @param chTarget Character to trim.
473 */
474 STDMETHOD_(void, TrimLeft)(THIS_ wchar_t chTarget DEF_VAL(VK_SPACE)) PURE;
475
476 /**
477 * @brief Trims leading and trailing characters from the string.
478 * @param chTarget Character to trim.
479 */
480 STDMETHOD_(void, Trim)(THIS_ wchar_t chTarget DEF_VAL(VK_SPACE)) PURE;
481
482 /**
483 * @brief Appends a character to the string.
484 * @param ch Character to append.
485 */
486 STDMETHOD_(void, AppendChar)(THIS_ wchar_t ch) PURE;
487
488 /**
489 * @brief Appends a substring to the string.
490 * @param pszStr Substring to append.
491 * @param nLen Length of the substring.
492 */
493 STDMETHOD_(void, AppendStr)(THIS_ const wchar_t *pszStr, int nLen DEF_VAL(-1)) PURE;
494
495 /**
496 * @brief Releases the string.
497 */
498 STDMETHOD_(void, Release)(THIS) PURE;
499
500 /**
501 * @brief Converts the string to an unsigned integer.
502 * @return The unsigned integer value.
503 */
504 STDMETHOD_(UINT, ToUint)(CTHIS) SCONST PURE;
505
506 /**
507 * @brief Converts the string to a long integer.
508 * @return The long integer value.
509 */
510 STDMETHOD_(long, ToLong)(CTHIS) SCONST PURE;
511
512 /**
513 * @brief Converts the string to an integer.
514 * @return The integer value.
515 */
516 STDMETHOD_(int, ToInt)(CTHIS) SCONST PURE;
517
518 /**
519 * @brief Converts the string to a float.
520 * @return The float value.
521 */
522 STDMETHOD_(float, ToFloat)(CTHIS) SCONST PURE;
523
524 /**
525 * @brief Converts the string to a double.
526 * @return The double value.
527 */
528 STDMETHOD_(double, ToDouble)(CTHIS) SCONST PURE;
529
530 /**
531 * @brief Converts the string to a boolean.
532 * @return The boolean value.
533 */
534 STDMETHOD_(BOOL, ToBool)(CTHIS) SCONST PURE;
535};
536
537#ifdef _UNICODE
538#define IStringT IStringW
539#else
540#define IStringT IStringA
541#endif
542
543SNSEND
544#endif // __SSTRING_I__H__