orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
orxString.h
Go to the documentation of this file.
1/* Orx - Portable Game Engine
2 *
3 * Copyright (c) 2008- Orx-Project
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source
22 * distribution.
23 */
24
33
42
43
44#ifndef _orxSTRING_H_
45#define _orxSTRING_H_
46
47
48#include "orxInclude.h"
49
50#include "math/orxVector.h"
51#include "memory/orxMemory.h"
52
53#include <stdio.h>
54#include <stdarg.h>
55#include <string.h>
56#include <stdlib.h>
57
58#ifndef __orxWINDOWS__
59 #include <strings.h>
60#endif /* !__orxWINDOWS__ */
61
62#include "debug/orxDebug.h"
63
64#ifdef __orxMSVC__
65
66 #pragma warning(push)
67 #pragma warning(disable : 4996)
68
69 #define strtoll _strtoi64
70 #define strtoull _strtoui64
71
72#endif /* __orxMSVC__ */
73
74#define STRTO_CAST (int)
75
76
77#define orxSTRING_KC_VECTOR_START '('
78#define orxSTRING_KC_VECTOR_START_ALT '{'
79#define orxSTRING_KC_VECTOR_SEPARATOR ','
80#define orxSTRING_KC_VECTOR_END ')'
81#define orxSTRING_KC_VECTOR_END_ALT '}'
82
83
86#define orxString_ToCRC orxString_Hash
87
88
89/* *** String inlined functions *** */
90
91
96static orxINLINE const orxSTRING orxString_SkipWhiteSpaces(const orxSTRING _zString)
97{
98 const orxSTRING zResult;
99
100 /* Non null? */
101 if(_zString != orxNULL)
102 {
103 /* Skips all white spaces */
104 for(zResult = _zString; (*zResult == ' ') || (*zResult == '\t') || (*zResult == orxCHAR_CR) || (*zResult == orxCHAR_LF); zResult++)
105 ;
106
107 /* Empty? */
108 if(*zResult == orxCHAR_NULL)
109 {
110 /* Updates result */
111 zResult = orxSTRING_EMPTY;
112 }
113 }
114 else
115 {
116 /* Updates result */
117 zResult = orxNULL;
118 }
119
120 /* Done! */
121 return zResult;
122}
123
128static orxINLINE const orxSTRING orxString_SkipPath(const orxSTRING _zString)
129{
130 const orxSTRING zResult;
131
132 /* Non null? */
133 if(_zString != orxNULL)
134 {
135 const orxCHAR *pc;
136
137 /* Updates result */
138 zResult = _zString;
139
140 /* For all characters */
141 for(pc = _zString; *pc != orxCHAR_NULL; pc++)
142 {
143 /* Is a directory separator? */
145 {
146 orxCHAR cNextChar = *(pc + 1);
147
148 /* Non terminal and not a directory separator? */
149 if((cNextChar != orxCHAR_NULL) && (cNextChar != orxCHAR_DIRECTORY_SEPARATOR_LINUX) && (cNextChar != orxCHAR_DIRECTORY_SEPARATOR_WINDOWS))
150 {
151 /* Updates result */
152 zResult = pc + 1;
153 }
154 }
155 }
156 }
157 else
158 {
159 /* Updates result */
160 zResult = orxNULL;
161 }
162
163 /* Done! */
164 return zResult;
165}
166
171static orxINLINE orxU32 orxString_GetLength(const orxSTRING _zString)
172{
173 /* Checks */
174 orxASSERT(_zString != orxNULL);
175
176 /* Done! */
177 return((orxU32)strlen(_zString));
178}
179
184static orxINLINE orxBOOL orxString_IsCharacterASCII(orxU32 _u32CharacterCodePoint)
185{
186 /* Done! */
187 return((_u32CharacterCodePoint < 0x80) ? orxTRUE : orxFALSE);
188}
189
194static orxINLINE orxBOOL orxString_IsCharacterAlphaNumeric(orxU32 _u32CharacterCodePoint)
195{
196 /* Done! */
197 return(((_u32CharacterCodePoint >= 'a') && (_u32CharacterCodePoint <= 'z'))
198 || ((_u32CharacterCodePoint >= 'A') && (_u32CharacterCodePoint <= 'Z'))
199 || ((_u32CharacterCodePoint >= '0') && (_u32CharacterCodePoint <= '9'))) ? orxTRUE : orxFALSE;
200}
201
206static orxINLINE orxU32 orxString_GetUTF8CharacterLength(orxU32 _u32CharacterCodePoint)
207{
208 orxU32 u32Result;
209
210 /* 1-byte long? */
211 if(_u32CharacterCodePoint < 0x80)
212 {
213 /* Updates result */
214 u32Result = 1;
215 }
216 else if(_u32CharacterCodePoint < 0x0800)
217 {
218 /* Updates result */
219 u32Result = 2;
220 }
221 else if(_u32CharacterCodePoint < 0x00010000)
222 {
223 /* Updates result */
224 u32Result = 3;
225 }
226 else if(_u32CharacterCodePoint < 0x00110000)
227 {
228 /* Updates result */
229 u32Result = 4;
230 }
231 else
232 {
233 /* Updates result */
234 u32Result = orxU32_UNDEFINED;
235 }
236
237 /* Done! */
238 return u32Result;
239}
240
247static orxU32 orxFASTCALL orxString_PrintUTF8Character(orxSTRING _zDstString, orxU32 _u32Size, orxU32 _u32CharacterCodePoint)
248{
249 orxU32 u32Result;
250
251 /* Gets character's encoded length */
252 u32Result = orxString_GetUTF8CharacterLength(_u32CharacterCodePoint);
253
254 /* Enough room? */
255 if(u32Result <= _u32Size)
256 {
257 /* Depending on character's length */
258 switch(u32Result)
259 {
260 case 1:
261 {
262 /* Writes character */
263 *_zDstString = (orxCHAR)_u32CharacterCodePoint;
264
265 break;
266 }
267
268 case 2:
269 {
270 /* Writes first character */
271 *_zDstString++ = (orxCHAR)(0xC0 | ((_u32CharacterCodePoint & 0x07C0) >> 6));
272
273 /* Writes second character */
274 *_zDstString = (orxCHAR)(0x80 | (_u32CharacterCodePoint & 0x3F));
275
276 break;
277 }
278
279 case 3:
280 {
281 /* Writes first character */
282 *_zDstString++ = (orxCHAR)(0xE0 | ((_u32CharacterCodePoint & 0xF000) >> 12));
283
284 /* Writes second character */
285 *_zDstString++ = (orxCHAR)(0x80 | ((_u32CharacterCodePoint & 0x0FC0) >> 6));
286
287 /* Writes third character */
288 *_zDstString = (orxCHAR)(0x80 | (_u32CharacterCodePoint & 0x3F));
289
290 break;
291 }
292
293 case 4:
294 {
295 /* Writes first character */
296 *_zDstString++ = (orxCHAR)(0xF0 | ((_u32CharacterCodePoint & 0x001C0000) >> 18));
297
298 /* Writes second character */
299 *_zDstString++ = (orxCHAR)(0x80 | ((_u32CharacterCodePoint & 0x0003F000) >> 12));
300
301 /* Writes third character */
302 *_zDstString++ = (orxCHAR)(0x80 | ((_u32CharacterCodePoint & 0x00000FC0) >> 6));
303
304 /* Writes fourth character */
305 *_zDstString = (orxCHAR)(0x80 | (_u32CharacterCodePoint & 0x3F));
306
307 break;
308 }
309
310 default:
311 {
312 /* Logs message */
313 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Can't print invalid unicode character <0x%X> to string.", _u32CharacterCodePoint);
314
315 /* Updates result */
316 u32Result = orxU32_UNDEFINED;
317
318 break;
319 }
320 }
321 }
322 else
323 {
324 /* Logs message */
325 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Can't print unicode character <0x%X> to string as there isn't enough space for it.", _u32CharacterCodePoint);
326
327 /* Updates result */
328 u32Result = orxU32_UNDEFINED;
329 }
330
331 /* Done! */
332 return u32Result;
333}
334
340static orxU32 orxFASTCALL orxString_GetFirstCharacterCodePoint(const orxSTRING _zString, const orxSTRING *_pzRemaining)
341{
342 const orxU8 *pu8Byte;
343 orxU32 u32Result;
344
345 /* Checks */
346 orxASSERT(_zString != orxNULL);
347
348 /* Gets the first byte */
349 pu8Byte = (const orxU8 *)_zString;
350
351 /* ASCII? */
352 if(*pu8Byte < 0x80)
353 {
354 /* Updates result */
355 u32Result = *pu8Byte;
356 }
357 /* Invalid UTF-8 byte sequence */
358 else if(*pu8Byte < 0xC0)
359 {
360 /* Logs message */
361 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: multi-byte sequence non-leading byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
362
363 /* Updates result */
364 u32Result = orxU32_UNDEFINED;
365 }
366 /* Overlong UTF-8 2-byte sequence */
367 else if(*pu8Byte < 0xC2)
368 {
369 /* Logs message */
370 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: overlong 2-byte sequence starting with byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
371
372 /* Updates result */
373 u32Result = orxU32_UNDEFINED;
374 }
375 /* 2-byte sequence */
376 else if(*pu8Byte < 0xE0)
377 {
378 /* Updates result with first character */
379 u32Result = *pu8Byte++ & 0x1F;
380
381 /* Valid second character? */
382 if((*pu8Byte & 0xC0) == 0x80)
383 {
384 /* Updates result */
385 u32Result = (u32Result << 6) | (*pu8Byte & 0x3F);
386 }
387 else
388 {
389 /* Logs message */
390 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 2-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
391
392 /* Updates result */
393 u32Result = orxU32_UNDEFINED;
394 }
395 }
396 /* 3-byte sequence */
397 else if(*pu8Byte < 0xF0)
398 {
399 /* Updates result with first character */
400 u32Result = *pu8Byte++ & 0x0F;
401
402 /* Valid second character? */
403 if((*pu8Byte & 0xC0) == 0x80)
404 {
405 /* Updates result */
406 u32Result = (u32Result << 6) | (*pu8Byte++ & 0x3F);
407
408 /* Valid third character? */
409 if((*pu8Byte & 0xC0) == 0x80)
410 {
411 /* Updates result */
412 u32Result = (u32Result << 6) | (*pu8Byte & 0x3F);
413 }
414 else
415 {
416 /* Logs message */
417 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 3-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
418
419 /* Updates result */
420 u32Result = orxU32_UNDEFINED;
421 }
422 }
423 else
424 {
425 /* Logs message */
426 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 3-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
427
428 /* Updates result */
429 u32Result = orxU32_UNDEFINED;
430 }
431 }
432 /* 4-byte sequence */
433 else if(*pu8Byte < 0xF5)
434 {
435 /* Updates result with first character */
436 u32Result = *pu8Byte++ & 0x07;
437
438 /* Valid second character? */
439 if((*pu8Byte & 0xC0) == 0x80)
440 {
441 /* Updates result */
442 u32Result = (u32Result << 6) | (*pu8Byte++ & 0x3F);
443
444 /* Valid third character? */
445 if((*pu8Byte & 0xC0) == 0x80)
446 {
447 /* Updates result */
448 u32Result = (u32Result << 6) | (*pu8Byte++ & 0x3F);
449
450 /* Valid fourth character? */
451 if((*pu8Byte & 0xC0) == 0x80)
452 {
453 /* Updates result */
454 u32Result = (u32Result << 6) | (*pu8Byte & 0x3F);
455 }
456 else
457 {
458 /* Logs message */
459 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 4-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
460
461 /* Updates result */
462 u32Result = orxU32_UNDEFINED;
463 }
464 }
465 else
466 {
467 /* Logs message */
468 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 4-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
469
470 /* Updates result */
471 u32Result = orxU32_UNDEFINED;
472 }
473 }
474 else
475 {
476 /* Logs message */
477 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: 4-byte sequence non-trailing byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
478
479 /* Updates result */
480 u32Result = orxU32_UNDEFINED;
481 }
482 }
483 else
484 {
485 /* Logs message */
486 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF-8 string at <0x%X>: invalid out-of-bound byte '%c' (0x%2X) at index %d.", _zString, *pu8Byte, *pu8Byte, pu8Byte - (orxU8 *)_zString);
487
488 /* Updates result */
489 u32Result = orxU32_UNDEFINED;
490 }
491
492 /* Asks for remaining string? */
493 if(_pzRemaining != orxNULL)
494 {
495 /* Stores it */
496 *_pzRemaining = (*pu8Byte == orxCHAR_NULL) ? orxNULL : (orxSTRING)(pu8Byte + 1);
497 }
498
499 /* Done! */
500 return u32Result;
501}
502
507static orxINLINE orxU32 orxString_GetCharacterCount(const orxSTRING _zString)
508{
509 const orxCHAR *pc;
510 orxU32 u32Result;
511
512 /* Checks */
513 orxASSERT(_zString != orxNULL);
514
515 /* For all characters */
516 for(pc = _zString, u32Result = 0; *pc != orxCHAR_NULL; u32Result++)
517 {
518 /* Invalid current character ID? */
520 {
521 /* Updates result */
522 u32Result = orxU32_UNDEFINED;
523
524 /* Logs message */
525 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Invalid or non-UTF8 string <%s>, can't count characters.", _zString);
526
527 break;
528 }
529 }
530
531 /* Done! */
532 return u32Result;
533}
534
541static orxINLINE orxSTRING orxString_NCopy(orxSTRING _zDstString, const orxSTRING _zSrcString, orxU32 _u32CharNumber)
542{
543 /* Checks */
544 orxASSERT(_zDstString != orxNULL);
545 orxASSERT(_zSrcString != orxNULL);
546 orxASSERT(_u32CharNumber > 0);
547
548 /* Done! */
549 return(strncpy(_zDstString, _zSrcString, (size_t)_u32CharNumber));
550}
551
556static orxINLINE orxSTRING orxString_Duplicate(const orxSTRING _zSrcString)
557{
558 orxU32 u32Size;
559 orxSTRING zResult;
560
561 /* Checks */
562 orxASSERT(_zSrcString != orxNULL);
563
564 /* Gets string size in bytes */
565 u32Size = (orxString_GetLength(_zSrcString) + 1) * sizeof(orxCHAR);
566
567 /* Allocates it */
568 zResult = (orxSTRING)orxMemory_Allocate(u32Size, orxMEMORY_TYPE_TEXT);
569
570 /* Valid? */
571 if(zResult != orxNULL)
572 {
573 /* Copies source to it */
574 orxMemory_Copy(zResult, _zSrcString, u32Size);
575 }
576
577 /* Done! */
578 return zResult;
579}
580
585static orxINLINE orxSTATUS orxString_Delete(orxSTRING _zString)
586{
587 /* Checks */
588 orxASSERT(_zString != orxNULL);
589 orxASSERT(_zString != orxSTRING_EMPTY);
590
591 /* Frees its memory */
592 orxMemory_Free(_zString);
593
594 /* Done! */
595 return orxSTATUS_SUCCESS;
596}
597
603static orxINLINE orxS32 orxString_Compare(const orxSTRING _zString1, const orxSTRING _zString2)
604{
605 /* Checks */
606 orxASSERT(_zString1 != orxNULL);
607 orxASSERT(_zString2 != orxNULL);
608
609 /* Done! */
610 return(strcmp(_zString1, _zString2));
611}
612
620static orxINLINE orxS32 orxString_NCompare(const orxSTRING _zString1, const orxSTRING _zString2, orxU32 _u32CharNumber)
621{
622 /* Checks */
623 orxASSERT(_zString1 != orxNULL);
624 orxASSERT(_zString2 != orxNULL);
625
626 /* Done! */
627 return(strncmp(_zString1, _zString2, (size_t)_u32CharNumber));
628}
629
635static orxINLINE orxS32 orxString_ICompare(const orxSTRING _zString1, const orxSTRING _zString2)
636{
637 /* Checks */
638 orxASSERT(_zString1 != orxNULL);
639 orxASSERT(_zString2 != orxNULL);
640
641#ifdef __orxWINDOWS__
642
643 /* Done! */
644 return(stricmp(_zString1, _zString2));
645
646#else /* __orxWINDOWS__ */
647
648 /* Done! */
649 return(strcasecmp(_zString1, _zString2));
650
651#endif /* __orxWINDOWS__ */
652}
653
660static orxINLINE orxS32 orxString_NICompare(const orxSTRING _zString1, const orxSTRING _zString2, orxU32 _u32CharNumber)
661{
662 /* Checks */
663 orxASSERT(_zString1 != orxNULL);
664 orxASSERT(_zString2 != orxNULL);
665
666#ifdef __orxWINDOWS__
667
668 /* Done! */
669 return(strnicmp(_zString1, _zString2, (size_t)_u32CharNumber));
670
671#else /* __orxWINDOWS__ */
672
673 /* Done! */
674 return(strncasecmp(_zString1, _zString2, _u32CharNumber));
675
676#endif /* __orxWINDOWS__ */
677}
678
684static orxINLINE orxU32 orxString_GetEditDistance(const orxSTRING _zString1, const orxSTRING _zString2)
685{
686 orxU32 u32Length1, u32Length2, u32Result;
687
688 /* Checks */
689 orxASSERT(_zString1 != orxNULL);
690 orxASSERT(_zString2 != orxNULL);
691
692 /* Gets string lengths */
693 u32Length1 = orxString_GetLength(_zString1);
694 u32Length2 = orxString_GetLength(_zString2);
695
696 /* Valid? */
697 if((u32Length1 > 0) && (u32Length2 > 0))
698 {
699 orxU32 *au32PreviousRow = (orxU32 *)orxMemory_StackAllocate((u32Length2 + 1) * sizeof(orxU32));
700 orxU32 *au32CurrentRow = (orxU32 *)orxMemory_StackAllocate((u32Length2 + 1) * sizeof(orxU32));
701 orxU32 *au32NextRow = (orxU32 *)orxMemory_StackAllocate((u32Length2 + 1) * sizeof(orxU32));
702 orxU32 i, j;
703
704 /* Initializes the previous and current rows */
705 orxMemory_Zero(au32PreviousRow, (u32Length2 + 1) * sizeof(orxU32));
706 for(i = 0; i <= u32Length2; i++)
707 {
708 au32CurrentRow[i] = i;
709 }
710
711 /* For all characters in the first string */
712 for(i = 0; i < u32Length1; i++)
713 {
714 orxU32 *pu32dummy;
715
716 /* Inits the first value of the next row */
717 au32NextRow[0] = i + 1;
718
719 /* For all characters in the second string */
720 for(j = 0; j < u32Length2; j++)
721 {
722 /* Substitution? */
723 au32NextRow[j + 1] = au32CurrentRow[j] + ((_zString1[i] != _zString2[j]) ? 1 : 0);
724
725 /* Deletion? */
726 au32NextRow[j + 1] = orxMIN(au32NextRow[j + 1], au32CurrentRow[j + 1] + 1);
727
728 /* Insertion? */
729 au32NextRow[j + 1] = orxMIN(au32NextRow[j + 1], au32NextRow[j] + 1);
730
731 /* Swap? */
732 if((i > 0)
733 && (j > 0)
734 && (_zString1[i - 1] == _zString2[j])
735 && (_zString1[i] == _zString2[j - 1]))
736 {
737 au32NextRow[j + 1] = orxMIN(au32NextRow[j + 1], au32PreviousRow[j - 1] + 1);
738 }
739 }
740
741 /* Cycles the rows */
742 pu32dummy = au32PreviousRow;
743 au32PreviousRow = au32CurrentRow;
744 au32CurrentRow = au32NextRow;
745 au32NextRow = pu32dummy;
746 }
747
748 /* Updates result */
749 u32Result = au32CurrentRow[u32Length2];
750 }
751 else
752 {
753 /* Updates result */
754 u32Result = u32Length1 + u32Length2;
755 }
756
757 /* Done! */
758 return u32Result;
759}
760
766static orxINLINE orxU32 orxString_ExtractBase(const orxSTRING _zString, const orxSTRING *_pzRemaining)
767{
768 const orxSTRING zString;
769 orxU32 u32Result, u32Offset;
770
771 /* Checks */
772 orxASSERT(_zString != orxNULL);
773
774 /* Skips white spaces */
775 zString = orxString_SkipWhiteSpaces(_zString);
776
777 /* Default result and offset: decimal */
778 u32Result = 10;
779 u32Offset = 0;
780
781 /* Depending on first character */
782 switch(zString[0])
783 {
784 case '0':
785 {
786 /* Depending on second character */
787 switch(zString[1] | 0x20)
788 {
789 case 'x':
790 {
791 /* Updates result and offset: hexadecimal */
792 u32Result = 16;
793 u32Offset = 2;
794
795 break;
796 }
797
798 case 'b':
799 {
800 /* Updates result and offset: binary */
801 u32Result = 2;
802 u32Offset = 2;
803
804 break;
805 }
806
807 default:
808 {
809 /* Octal? */
810 if((zString[1] >= '0')
811 && (zString[1] <= '9'))
812 {
813 /* Updates result and offset: octal */
814 u32Result = 8;
815 u32Offset = 1;
816 }
817
818 break;
819 }
820 }
821
822 break;
823 }
824
825 case '#':
826 {
827 /* Updates result and offset: hexadecimal */
828 u32Result = 16;
829 u32Offset = 1;
830
831 break;
832 }
833
834 default:
835 {
836 break;
837 }
838 }
839
840 /* Asks for remaining string? */
841 if(_pzRemaining != orxNULL)
842 {
843 /* Stores it */
844 *_pzRemaining = zString + u32Offset;
845 }
846
847 /* Done! */
848 return u32Result;
849}
850
858static orxINLINE orxSTATUS orxString_ToS32Base(const orxSTRING _zString, orxU32 _u32Base, orxS32 *_ps32OutValue, const orxSTRING *_pzRemaining)
859{
860 orxCHAR *pcEnd;
861 orxSTATUS eResult;
862
863 /* Checks */
864 orxASSERT(_ps32OutValue != orxNULL);
865 orxASSERT(_zString != orxNULL);
866
867 /* Convert */
868 *_ps32OutValue = (orxS32)strtol(_zString, &pcEnd, STRTO_CAST _u32Base);
869
870 /* Valid conversion ? */
871 if((pcEnd != _zString) && (_zString[0] != orxCHAR_NULL))
872 {
873 /* Updates result */
874 eResult = orxSTATUS_SUCCESS;
875 }
876 else
877 {
878 /* Updates result */
879 eResult = orxSTATUS_FAILURE;
880 }
881
882 /* Asks for remaining string? */
883 if(_pzRemaining != orxNULL)
884 {
885 /* Stores it */
886 *_pzRemaining = pcEnd;
887 }
888
889 /* Done! */
890 return eResult;
891}
892
899static orxINLINE orxSTATUS orxString_ToS32(const orxSTRING _zString, orxS32 *_ps32OutValue, const orxSTRING *_pzRemaining)
900{
901 const orxSTRING zValue;
902 orxU32 u32Base;
903 orxSTATUS eResult;
904
905 /* Checks */
906 orxASSERT(_ps32OutValue != orxNULL);
907 orxASSERT(_zString != orxNULL);
908
909 /* Extracts base */
910 u32Base = orxString_ExtractBase(_zString, &zValue);
911
912 /* Gets value */
913 eResult = orxString_ToS32Base(zValue, u32Base, _ps32OutValue, _pzRemaining);
914
915 /* Done! */
916 return eResult;
917}
918
926static orxINLINE orxSTATUS orxString_ToU32Base(const orxSTRING _zString, orxU32 _u32Base, orxU32 *_pu32OutValue, const orxSTRING *_pzRemaining)
927{
928 orxCHAR *pcEnd;
929 orxSTATUS eResult;
930
931 /* Checks */
932 orxASSERT(_pu32OutValue != orxNULL);
933 orxASSERT(_zString != orxNULL);
934
935 /* Convert */
936 *_pu32OutValue = (orxU32)strtoul(_zString, &pcEnd, STRTO_CAST _u32Base);
937
938 /* Valid conversion ? */
939 if((pcEnd != _zString) && (_zString[0] != orxCHAR_NULL))
940 {
941 /* Updates result */
942 eResult = orxSTATUS_SUCCESS;
943 }
944 else
945 {
946 /* Updates result */
947 eResult = orxSTATUS_FAILURE;
948 }
949
950 /* Asks for remaining string? */
951 if(_pzRemaining != orxNULL)
952 {
953 /* Stores it */
954 *_pzRemaining = pcEnd;
955 }
956
957 /* Done! */
958 return eResult;
959}
960
967static orxINLINE orxSTATUS orxString_ToU32(const orxSTRING _zString, orxU32 *_pu32OutValue, const orxSTRING *_pzRemaining)
968{
969 const orxSTRING zValue;
970 orxU32 u32Base;
971 orxSTATUS eResult;
972
973 /* Checks */
974 orxASSERT(_pu32OutValue != orxNULL);
975 orxASSERT(_zString != orxNULL);
976
977 /* Extracts base */
978 u32Base = orxString_ExtractBase(_zString, &zValue);
979
980 /* Gets value */
981 eResult = orxString_ToU32Base(zValue, u32Base, _pu32OutValue, _pzRemaining);
982
983 /* Done! */
984 return eResult;
985}
986
994static orxINLINE orxSTATUS orxString_ToS64Base(const orxSTRING _zString, orxU32 _u32Base, orxS64 *_ps64OutValue, const orxSTRING *_pzRemaining)
995{
996 orxCHAR *pcEnd;
997 orxSTATUS eResult;
998
999 /* Checks */
1000 orxASSERT(_ps64OutValue != orxNULL);
1001 orxASSERT(_zString != orxNULL);
1002
1003 /* Convert */
1004 *_ps64OutValue = (orxS64)strtoll(_zString, &pcEnd, STRTO_CAST _u32Base);
1005
1006 /* Valid conversion ? */
1007 if((pcEnd != _zString) && (_zString[0] != orxCHAR_NULL))
1008 {
1009 /* Updates result */
1010 eResult = orxSTATUS_SUCCESS;
1011 }
1012 else
1013 {
1014 /* Updates result */
1015 eResult = orxSTATUS_FAILURE;
1016 }
1017
1018 /* Asks for remaining string? */
1019 if(_pzRemaining != orxNULL)
1020 {
1021 /* Stores it */
1022 *_pzRemaining = pcEnd;
1023 }
1024
1025 /* Done! */
1026 return eResult;
1027}
1028
1035static orxINLINE orxSTATUS orxString_ToS64(const orxSTRING _zString, orxS64 *_ps64OutValue, const orxSTRING *_pzRemaining)
1036{
1037 const orxSTRING zValue;
1038 orxU32 u32Base;
1039 orxSTATUS eResult;
1040
1041 /* Checks */
1042 orxASSERT(_ps64OutValue != orxNULL);
1043 orxASSERT(_zString != orxNULL);
1044
1045 /* Extracts base */
1046 u32Base = orxString_ExtractBase(_zString, &zValue);
1047
1048 /* Gets signed value */
1049 eResult = orxString_ToS64Base(zValue, u32Base, _ps64OutValue, _pzRemaining);
1050
1051 /* Done! */
1052 return eResult;
1053}
1054
1062static orxINLINE orxSTATUS orxString_ToU64Base(const orxSTRING _zString, orxU32 _u32Base, orxU64 *_pu64OutValue, const orxSTRING *_pzRemaining)
1063{
1064 orxCHAR *pcEnd;
1065 orxSTATUS eResult;
1066
1067 /* Checks */
1068 orxASSERT(_pu64OutValue != orxNULL);
1069 orxASSERT(_zString != orxNULL);
1070
1071 /* Convert */
1072 *_pu64OutValue = (orxU64)strtoull(_zString, &pcEnd, STRTO_CAST _u32Base);
1073
1074 /* Valid conversion ? */
1075 if((pcEnd != _zString) && (_zString[0] != orxCHAR_NULL))
1076 {
1077 /* Updates result */
1078 eResult = orxSTATUS_SUCCESS;
1079 }
1080 else
1081 {
1082 /* Updates result */
1083 eResult = orxSTATUS_FAILURE;
1084 }
1085
1086 /* Asks for remaining string? */
1087 if(_pzRemaining != orxNULL)
1088 {
1089 /* Stores it */
1090 *_pzRemaining = pcEnd;
1091 }
1092
1093 /* Done! */
1094 return eResult;
1095}
1096
1103static orxINLINE orxSTATUS orxString_ToU64(const orxSTRING _zString, orxU64 *_pu64OutValue, const orxSTRING *_pzRemaining)
1104{
1105 const orxSTRING zValue;
1106 orxU32 u32Base;
1107 orxSTATUS eResult;
1108
1109 /* Checks */
1110 orxASSERT(_pu64OutValue != orxNULL);
1111 orxASSERT(_zString != orxNULL);
1112
1113 /* Extracts base */
1114 u32Base = orxString_ExtractBase(_zString, &zValue);
1115
1116 /* Gets signed value */
1117 eResult = orxString_ToU64Base(zValue, u32Base, _pu64OutValue, _pzRemaining);
1118
1119 /* Done! */
1120 return eResult;
1121}
1122
1129static orxINLINE orxSTATUS orxString_ToFloat(const orxSTRING _zString, orxFLOAT *_pfOutValue, const orxSTRING *_pzRemaining)
1130{
1131 orxCHAR *pcEnd;
1132 orxSTATUS eResult;
1133
1134 /* Checks */
1135 orxASSERT(_pfOutValue != orxNULL);
1136 orxASSERT(_zString != orxNULL);
1137
1138 /* Linux / Mac / iOS / Android / MSVC? */
1139#if defined(__orxLINUX__) || defined(__orxMAC__) || defined (__orxIOS__) || defined(__orxMSVC__) || defined(__orxANDROID__)
1140
1141 /* Converts it */
1142 *_pfOutValue = (orxFLOAT)strtod(_zString, &pcEnd);
1143
1144#else /* __orxLINUX__ || __orxMAC__ || __orxIOS__ || __orxMSVC__ || __orxANDROID__ */
1145
1146 /* Converts it */
1147 *_pfOutValue = strtof(_zString, &pcEnd);
1148
1149#endif /* __orxLINUX__ || __orxMAC__ || __orxIOS__ || __orxMSVC__ || __orxANDROID__ */
1150
1151 /* Valid conversion ? */
1152 if((pcEnd != _zString) && (_zString[0] != orxCHAR_NULL))
1153 {
1154 /* Updates result */
1155 eResult = orxSTATUS_SUCCESS;
1156 }
1157 else
1158 {
1159 /* Updates result */
1160 eResult = orxSTATUS_FAILURE;
1161 }
1162
1163 /* Asks for remaining string? */
1164 if(_pzRemaining != orxNULL)
1165 {
1166 /* Stores it */
1167 *_pzRemaining = pcEnd;
1168 }
1169
1170 /* Done! */
1171 return eResult;
1172}
1173
1180static orxINLINE orxSTATUS orxString_ToVector(const orxSTRING _zString, orxVECTOR *_pvOutValue, const orxSTRING *_pzRemaining)
1181{
1182 orxVECTOR stValue;
1183 const orxSTRING zString;
1184 orxSTATUS eResult = orxSTATUS_FAILURE;
1185
1186 /* Checks */
1187 orxASSERT(_pvOutValue != orxNULL);
1188 orxASSERT(_zString != orxNULL);
1189
1190 /* Skips all white spaces */
1191 zString = orxString_SkipWhiteSpaces(_zString);
1192
1193 /* Is a vector start character? */
1194 if((*zString == orxSTRING_KC_VECTOR_START)
1195 || (*zString == orxSTRING_KC_VECTOR_START_ALT))
1196 {
1197 orxCHAR cEndMarker;
1198
1199 /* Gets end marker */
1201
1202 /* Skips all white spaces */
1203 zString = orxString_SkipWhiteSpaces(zString + 1);
1204
1205 /* Gets X value */
1206 if(orxString_ToFloat(zString, &(stValue.fX), &zString) != orxSTATUS_FAILURE)
1207 {
1208 /* Skips all white spaces */
1209 zString = orxString_SkipWhiteSpaces(zString);
1210
1211 /* Is a vector separator character? */
1212 if(*zString == orxSTRING_KC_VECTOR_SEPARATOR)
1213 {
1214 /* Skips all white spaces */
1215 zString = orxString_SkipWhiteSpaces(zString + 1);
1216
1217 /* Gets Y value */
1218 if(orxString_ToFloat(zString, &(stValue.fY), &zString) != orxSTATUS_FAILURE)
1219 {
1220 /* Skips all white spaces */
1221 zString = orxString_SkipWhiteSpaces(zString);
1222
1223 /* Is a vector separator character? */
1224 if(*zString == orxSTRING_KC_VECTOR_SEPARATOR)
1225 {
1226 /* Skips all white spaces */
1227 zString = orxString_SkipWhiteSpaces(zString + 1);
1228
1229 /* Gets Z value */
1230 if(orxString_ToFloat(zString, &(stValue.fZ), &zString) != orxSTATUS_FAILURE)
1231 {
1232 /* Skips all white spaces */
1233 zString = orxString_SkipWhiteSpaces(zString);
1234
1235 /* Has a valid end marker? */
1236 if(*zString == cEndMarker)
1237 {
1238 /* Updates result */
1239 eResult = orxSTATUS_SUCCESS;
1240 }
1241 }
1242 }
1243 /* Has a valid end marker? */
1244 else if(*zString == cEndMarker)
1245 {
1246 /* Clears Z component */
1247 stValue.fZ = orxFLOAT_0;
1248
1249 /* Updates result */
1250 eResult = orxSTATUS_SUCCESS;
1251 }
1252 }
1253 }
1254 }
1255 }
1256
1257 /* Valid? */
1258 if(eResult != orxSTATUS_FAILURE)
1259 {
1260 /* Updates vector */
1261 orxVector_Copy(_pvOutValue, &stValue);
1262
1263 /* Asks for remaining string? */
1264 if(_pzRemaining != orxNULL)
1265 {
1266 /* Stores it */
1267 *_pzRemaining = zString + 1;
1268 }
1269 }
1270
1271 /* Done! */
1272 return eResult;
1273}
1274
1281static orxINLINE orxSTATUS orxString_ToBool(const orxSTRING _zString, orxBOOL *_pbOutValue, const orxSTRING *_pzRemaining)
1282{
1283 orxS32 s32Value;
1284 orxSTATUS eResult;
1285
1286 /* Checks */
1287 orxASSERT(_pbOutValue != orxNULL);
1288 orxASSERT(_zString != orxNULL);
1289
1290 /* Tries numeric value */
1291 eResult = orxString_ToS32Base(_zString, 10, &s32Value, _pzRemaining);
1292
1293 /* Valid? */
1294 if(eResult != orxSTATUS_FAILURE)
1295 {
1296 /* Updates boolean */
1297 *_pbOutValue = (s32Value != 0) ? orxTRUE : orxFALSE;
1298 }
1299 else
1300 {
1301 orxU32 u32Length;
1302
1303 /* Gets length of false */
1305
1306 /* Is false? */
1307 if(orxString_NICompare(_zString, orxSTRING_FALSE, u32Length) == 0)
1308 {
1309 /* Updates boolean */
1310 *_pbOutValue = orxFALSE;
1311
1312 /* Has remaining? */
1313 if(_pzRemaining != orxNULL)
1314 {
1315 /* Updates it */
1316 *_pzRemaining += u32Length;
1317 }
1318
1319 /* Updates result */
1320 eResult = orxSTATUS_SUCCESS;
1321 }
1322 else
1323 {
1324 /* Gets length of true */
1326
1327 /* Is true? */
1328 if(orxString_NICompare(_zString, orxSTRING_TRUE, u32Length) == 0)
1329 {
1330 /* Updates boolean */
1331 *_pbOutValue = orxTRUE;
1332
1333 /* Has remaining? */
1334 if(_pzRemaining != orxNULL)
1335 {
1336 /* Updates it */
1337 *_pzRemaining += u32Length;
1338 }
1339
1340 /* Updates result */
1341 eResult = orxSTATUS_SUCCESS;
1342 }
1343 }
1344 }
1345
1346 /* Done! */
1347 return eResult;
1348}
1349
1354static orxINLINE orxSTRING orxString_LowerCase(orxSTRING _zString)
1355{
1356 orxCHAR *pc;
1357
1358 /* Checks */
1359 orxASSERT(_zString != orxNULL);
1360
1361 /* Converts the whole string */
1362 for(pc = _zString; *pc != orxCHAR_NULL; pc++)
1363 {
1364 /* Needs to be converted? */
1365 if((*pc >= 'A') && (*pc <= 'Z'))
1366 {
1367 /* Lower case */
1368 *pc |= 0x20;
1369 }
1370 }
1371
1372 /* Done! */
1373 return _zString;
1374}
1375
1380static orxINLINE orxSTRING orxString_UpperCase(orxSTRING _zString)
1381{
1382 orxCHAR *pc;
1383
1384 /* Checks */
1385 orxASSERT(_zString != orxNULL);
1386
1387 /* Converts the whole string */
1388 for(pc = _zString; *pc != orxCHAR_NULL; pc++)
1389 {
1390 /* Needs to be converted? */
1391 if((*pc >= 'a') && (*pc <= 'z'))
1392 {
1393 /* Upper case */
1394 *pc &= ~0x20;
1395 }
1396 }
1397
1398 /* Done! */
1399 return _zString;
1400}
1401
1407static orxINLINE const orxSTRING orxString_SearchString(const orxSTRING _zString1, const orxSTRING _zString2)
1408{
1409 /* Checks */
1410 orxASSERT(_zString1 != orxNULL);
1411 orxASSERT(_zString2 != orxNULL);
1412
1413 /* Done! */
1414 return(strstr(_zString1, _zString2));
1415}
1416
1422static orxINLINE const orxSTRING orxString_SearchChar(const orxSTRING _zString, orxCHAR _cChar)
1423{
1424 /* Checks */
1425 orxASSERT(_zString != orxNULL);
1426
1427 /* Done! */
1428 return(strchr(_zString, _cChar));
1429}
1430
1437static orxINLINE orxS32 orxString_SearchCharIndex(const orxSTRING _zString, orxCHAR _cChar, orxS32 _s32Position)
1438{
1439 orxS32 s32Index, s32Result = -1;
1440 const orxCHAR *pc;
1441
1442 /* Checks */
1443 orxASSERT(_zString != orxNULL);
1444 orxASSERT(_s32Position <= (orxS32)orxString_GetLength(_zString));
1445
1446 /* For all characters */
1447 for(s32Index = _s32Position, pc = _zString + s32Index; *pc != orxCHAR_NULL; pc++, s32Index++)
1448 {
1449 /* Found? */
1450 if(*pc == _cChar)
1451 {
1452 /* Updates result */
1453 s32Result = s32Index;
1454
1455 break;
1456 }
1457 }
1458
1459 /* Done! */
1460 return s32Result;
1461}
1462
1469static orxINLINE orxS32 orxCDECL orxString_NPrint(orxSTRING _zDstString, orxU32 _u32CharNumber, const orxSTRING _zSrcString, ...)
1470{
1471 va_list stArgs;
1472 orxS32 s32Result;
1473
1474 /* Checks */
1475 orxASSERT(_zDstString != orxNULL);
1476 orxASSERT(_zSrcString != orxNULL);
1477 orxASSERT(_u32CharNumber > 0);
1478
1479 /* Gets variable arguments & prints the string */
1480 va_start(stArgs, _zSrcString);
1481 s32Result = vsnprintf(_zDstString, (size_t)_u32CharNumber, _zSrcString, stArgs);
1482 va_end(stArgs);
1483
1484 /* Overflow? */
1485 if(s32Result <= 0)
1486 {
1487 /* Updates result */
1488 s32Result = (orxS32)_u32CharNumber - 1;
1489 }
1490 else
1491 {
1492 /* Clamps result */
1493 s32Result = orxCLAMP(s32Result, 0, (orxS32)_u32CharNumber - 1);
1494 }
1495
1496 /* Enforces terminating null character */
1497 _zDstString[s32Result] = orxCHAR_NULL;
1498
1499 /* Done! */
1500 return s32Result;
1501}
1502
1508static orxINLINE orxS32 orxCDECL orxString_Scan(const orxSTRING _zString, const orxSTRING _zFormat, ...)
1509{
1510 va_list stArgs;
1511 orxS32 s32Result;
1512
1513 /* Checks */
1514 orxASSERT(_zString != orxNULL);
1515
1516 /* Gets variable arguments & scans the string */
1517 va_start(stArgs, _zFormat);
1518 s32Result = vsscanf(_zString, _zFormat, stArgs);
1519 va_end(stArgs);
1520
1521 /* Clamps result */
1522 s32Result = orxMAX(s32Result, 0);
1523
1524 /* Done! */
1525 return s32Result;
1526}
1527
1532static orxINLINE const orxSTRING orxString_GetExtension(const orxSTRING _zFileName)
1533{
1534 orxS32 s32Index, s32NextIndex;
1535 const orxSTRING zResult;
1536
1537 /* Checks */
1538 orxASSERT(_zFileName != orxNULL);
1539
1540 /* Finds last '.' */
1541 for(s32Index = orxString_SearchCharIndex(_zFileName, '.', 0);
1542 (s32Index >= 0) && ((s32NextIndex = orxString_SearchCharIndex(_zFileName, '.', s32Index + 1)) > 0);
1543 s32Index = s32NextIndex);
1544
1545 /* Updates result */
1546 zResult = (s32Index >= 0) ? _zFileName + s32Index + 1 : orxSTRING_EMPTY;
1547
1548 /* Done! */
1549 return zResult;
1550}
1551
1552/* *** String module functions *** */
1553
1556extern orxDLLAPI void orxFASTCALL orxString_Setup();
1557
1562
1565extern orxDLLAPI void orxFASTCALL orxString_Exit();
1566
1567
1573extern orxDLLAPI orxSTRINGID orxFASTCALL orxString_NHash(const orxSTRING _zString, orxU32 _u32CharNumber);
1574
1579extern orxDLLAPI orxSTRINGID orxFASTCALL orxString_Hash(const orxSTRING _zString);
1580
1585extern orxDLLAPI orxSTRINGID orxFASTCALL orxString_GetID(const orxSTRING _zString);
1586
1591extern orxDLLAPI const orxSTRING orxFASTCALL orxString_GetFromID(orxSTRINGID _stID);
1592
1597extern orxDLLAPI const orxSTRING orxFASTCALL orxString_Store(const orxSTRING _zString);
1598
1603extern orxDLLAPI orxSTATUS orxFASTCALL orxString_Erase(orxSTRINGID _stID);
1604
1605
1606#ifdef __orxMSVC__
1607
1608 #pragma warning(pop)
1609
1610 #undef strtoll
1611 #undef strtoull
1612
1613#endif /* __orxMSVC__ */
1614
1615#undef STRTO_CAST
1616
1617#endif /* _orxSTRING_H_ */
1618
#define orxASSERT(TEST,...)
Definition orxDebug.h:378
#define orxDEBUG_PRINT(LEVEL, STRING,...)
Definition orxDebug.h:344
@ orxDEBUG_LEVEL_SYSTEM
Definition orxDebug.h:102
#define orxDLLAPI
Definition orxDecl.h:381
#define orxMIN(A, B)
Definition orxMath.h:83
#define orxCLAMP(V, MIN, MAX)
Definition orxMath.h:98
#define orxMAX(A, B)
Definition orxMath.h:90
orxDLLAPI void orxFASTCALL orxMemory_Free(void *_pMem)
#define orxMemory_StackAllocate(x)
Definition orxMemory.h:89
static orxINLINE void * orxMemory_Zero(void *_pDest, orxU32 _u32Size)
Definition orxMemory.h:227
static orxINLINE void * orxMemory_Copy(void *_pDest, const void *_pSrc, orxU32 _u32Size)
Definition orxMemory.h:165
orxDLLAPI void *orxFASTCALL orxMemory_Allocate(orxU32 _u32Size, orxMEMORY_TYPE _eMemType)
@ orxMEMORY_TYPE_TEXT
Definition orxMemory.h:103
static orxINLINE orxSTRING orxString_UpperCase(orxSTRING _zString)
Definition orxString.h:1380
orxDLLAPI orxSTRINGID orxFASTCALL orxString_Hash(const orxSTRING _zString)
static orxINLINE orxSTATUS orxString_ToS64Base(const orxSTRING _zString, orxU32 _u32Base, orxS64 *_ps64OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:994
static orxINLINE orxSTATUS orxString_ToS32(const orxSTRING _zString, orxS32 *_ps32OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:899
static orxINLINE orxBOOL orxString_IsCharacterAlphaNumeric(orxU32 _u32CharacterCodePoint)
Definition orxString.h:194
static orxINLINE orxSTATUS orxString_Delete(orxSTRING _zString)
Definition orxString.h:585
static orxINLINE orxS32 orxString_SearchCharIndex(const orxSTRING _zString, orxCHAR _cChar, orxS32 _s32Position)
Definition orxString.h:1437
static orxINLINE const orxSTRING orxString_GetExtension(const orxSTRING _zFileName)
Definition orxString.h:1532
orxDLLAPI orxSTRINGID orxFASTCALL orxString_GetID(const orxSTRING _zString)
static orxINLINE orxSTATUS orxString_ToS32Base(const orxSTRING _zString, orxU32 _u32Base, orxS32 *_ps32OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:858
orxDLLAPI void orxFASTCALL orxString_Exit()
static orxINLINE orxU32 orxString_GetLength(const orxSTRING _zString)
Definition orxString.h:171
static orxINLINE orxSTATUS orxString_ToFloat(const orxSTRING _zString, orxFLOAT *_pfOutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1129
orxDLLAPI void orxFASTCALL orxString_Setup()
#define orxSTRING_KC_VECTOR_START
Definition orxString.h:77
static orxINLINE orxU32 orxString_ExtractBase(const orxSTRING _zString, const orxSTRING *_pzRemaining)
Definition orxString.h:766
static orxINLINE orxSTATUS orxString_ToBool(const orxSTRING _zString, orxBOOL *_pbOutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1281
static orxINLINE orxSTRING orxString_LowerCase(orxSTRING _zString)
Definition orxString.h:1354
#define orxSTRING_KC_VECTOR_SEPARATOR
Definition orxString.h:79
orxDLLAPI const orxSTRING orxFASTCALL orxString_GetFromID(orxSTRINGID _stID)
orxDLLAPI orxSTATUS orxFASTCALL orxString_Init()
static orxU32 orxFASTCALL orxString_PrintUTF8Character(orxSTRING _zDstString, orxU32 _u32Size, orxU32 _u32CharacterCodePoint)
Definition orxString.h:247
static orxU32 orxFASTCALL orxString_GetFirstCharacterCodePoint(const orxSTRING _zString, const orxSTRING *_pzRemaining)
Definition orxString.h:340
static orxINLINE orxSTRING orxString_NCopy(orxSTRING _zDstString, const orxSTRING _zSrcString, orxU32 _u32CharNumber)
Definition orxString.h:541
static orxINLINE orxS32 orxString_NICompare(const orxSTRING _zString1, const orxSTRING _zString2, orxU32 _u32CharNumber)
Definition orxString.h:660
static orxINLINE orxU32 orxString_GetCharacterCount(const orxSTRING _zString)
Definition orxString.h:507
static orxINLINE orxSTATUS orxString_ToS64(const orxSTRING _zString, orxS64 *_ps64OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1035
orxDLLAPI orxSTATUS orxFASTCALL orxString_Erase(orxSTRINGID _stID)
static orxINLINE orxS32 orxCDECL orxString_NPrint(orxSTRING _zDstString, orxU32 _u32CharNumber, const orxSTRING _zSrcString,...)
Definition orxString.h:1469
static orxINLINE orxSTATUS orxString_ToU32Base(const orxSTRING _zString, orxU32 _u32Base, orxU32 *_pu32OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:926
static orxINLINE const orxSTRING orxString_SkipWhiteSpaces(const orxSTRING _zString)
Definition orxString.h:96
static orxINLINE orxU32 orxString_GetEditDistance(const orxSTRING _zString1, const orxSTRING _zString2)
Definition orxString.h:684
orxDLLAPI const orxSTRING orxFASTCALL orxString_Store(const orxSTRING _zString)
static orxINLINE orxS32 orxString_ICompare(const orxSTRING _zString1, const orxSTRING _zString2)
Definition orxString.h:635
orxDLLAPI orxSTRINGID orxFASTCALL orxString_NHash(const orxSTRING _zString, orxU32 _u32CharNumber)
#define orxSTRING_KC_VECTOR_END_ALT
Definition orxString.h:81
static orxINLINE orxU32 orxString_GetUTF8CharacterLength(orxU32 _u32CharacterCodePoint)
Definition orxString.h:206
static orxINLINE orxSTATUS orxString_ToU32(const orxSTRING _zString, orxU32 *_pu32OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:967
#define orxSTRING_KC_VECTOR_START_ALT
Definition orxString.h:78
#define STRTO_CAST
Definition orxString.h:74
static orxINLINE orxSTRING orxString_Duplicate(const orxSTRING _zSrcString)
Definition orxString.h:556
#define orxSTRING_KC_VECTOR_END
Definition orxString.h:80
static orxINLINE orxSTATUS orxString_ToVector(const orxSTRING _zString, orxVECTOR *_pvOutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1180
static orxINLINE const orxSTRING orxString_SearchChar(const orxSTRING _zString, orxCHAR _cChar)
Definition orxString.h:1422
static orxINLINE orxS32 orxString_NCompare(const orxSTRING _zString1, const orxSTRING _zString2, orxU32 _u32CharNumber)
Definition orxString.h:620
static orxINLINE const orxSTRING orxString_SearchString(const orxSTRING _zString1, const orxSTRING _zString2)
Definition orxString.h:1407
static orxINLINE const orxSTRING orxString_SkipPath(const orxSTRING _zString)
Definition orxString.h:128
static orxINLINE orxS32 orxCDECL orxString_Scan(const orxSTRING _zString, const orxSTRING _zFormat,...)
Definition orxString.h:1508
static orxINLINE orxBOOL orxString_IsCharacterASCII(orxU32 _u32CharacterCodePoint)
Definition orxString.h:184
static orxINLINE orxS32 orxString_Compare(const orxSTRING _zString1, const orxSTRING _zString2)
Definition orxString.h:603
static orxINLINE orxSTATUS orxString_ToU64Base(const orxSTRING _zString, orxU32 _u32Base, orxU64 *_pu64OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1062
static orxINLINE orxSTATUS orxString_ToU64(const orxSTRING _zString, orxU64 *_pu64OutValue, const orxSTRING *_pzRemaining)
Definition orxString.h:1103
orxSTATUS
Definition orxType.h:270
orxDLLAPI const orxSTRING orxSTRING_TRUE
#define orxFALSE
Definition orxType.h:210
#define orxCHAR_DIRECTORY_SEPARATOR_WINDOWS
Definition orxType.h:254
#define orxCHAR_CR
Definition orxType.h:241
#define orxTRUE
Definition orxType.h:211
orxDLLAPI const orxSTRING orxSTRING_FALSE
#define orxCHAR_LF
Definition orxType.h:242
#define orxCHAR_NULL
Definition orxType.h:240
static const orxFLOAT orxFLOAT_0
Definition orxType.h:215
orxDLLAPI const orxSTRING orxSTRING_EMPTY
#define orxCHAR_DIRECTORY_SEPARATOR_LINUX
Definition orxType.h:255
static const orxU32 orxU32_UNDEFINED
Definition orxType.h:227
@ orxSTATUS_SUCCESS
Definition orxType.h:272
@ orxSTATUS_FAILURE
Definition orxType.h:271
static orxINLINE orxVECTOR * orxVector_Copy(orxVECTOR *_pvDst, const orxVECTOR *_pvSrc)
Definition orxVector.h:135
orxFLOAT fY
Definition orxVector.h:77
orxFLOAT fX
Definition orxVector.h:69
orxFLOAT fZ
Definition orxVector.h:85

Generated for orx by doxygen 1.8.11