LMMS
Loading...
Searching...
No Matches
fstring.h
Go to the documentation of this file.
1//------------------------------------------------------------------------
2// Project : SDK Base
3// Version : 1.0
4//
5// Category : Helpers
6// Filename : base/source/fstring.h
7// Created by : Steinberg, 2008
8// Description : String class
9//
10//-----------------------------------------------------------------------------
11// LICENSE
12// (c) 2021, Steinberg Media Technologies GmbH, All Rights Reserved
13//-----------------------------------------------------------------------------
14// Redistribution and use in source and binary forms, with or without modification,
15// are permitted provided that the following conditions are met:
16//
17// * Redistributions of source code must retain the above copyright notice,
18// this list of conditions and the following disclaimer.
19// * Redistributions in binary form must reproduce the above copyright notice,
20// this list of conditions and the following disclaimer in the documentation
21// and/or other materials provided with the distribution.
22// * Neither the name of the Steinberg Media Technologies nor the names of its
23// contributors may be used to endorse or promote products derived from this
24// software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35// OF THE POSSIBILITY OF SUCH DAMAGE.
36//-----------------------------------------------------------------------------
37
38#pragma once
39
44
45#include "base/source/fobject.h"
46
47#include <cstdarg>
48
49namespace Steinberg {
50
51class FVariant;
52class String;
53
54#ifdef UNICODE
55static const bool kWideStringDefault = true;
56#else
57static const bool kWideStringDefault = false;
58#endif
59
60static const uint16 kBomUtf16 = 0xFEFF;
61static const char8* const kBomUtf8 = "\xEF\xBB\xBF";
62static const int32 kBomUtf8Length = 3;
63
64
78
86
87//------------------------------------------------------------------------
88// Helper functions to create hash codes from string data.
89//------------------------------------------------------------------------
90extern uint32 hashString8 (const char8* s, uint32 m);
91extern uint32 hashString16 (const char16* s, uint32 m);
92inline uint32 hashString (const tchar* s, uint32 m)
93{
94#ifdef UNICODE
95 return hashString16 (s, m);
96#else
97 return hashString8 (s, m);
98#endif
99}
100
101
102//-----------------------------------------------------------------------------
115//-----------------------------------------------------------------------------
117{
118public:
119//-----------------------------------------------------------------------------
120 ConstString (const char8* str, int32 length = -1);
121 ConstString (const char16* str, int32 length = -1);
122 ConstString (const ConstString& str, int32 offset = 0, int32 length = -1);
123 ConstString (const FVariant& var);
124 ConstString ();
125 virtual ~ConstString () {}
126
127 // access -----------------------------------------------------------------
128 virtual int32 length () const {return static_cast<int32> (len);}
129 inline bool isEmpty () const {return buffer == nullptr || len == 0;}
130
131 operator const char8* () const {return text8 ();}
132 operator const char16* () const {return text16 ();}
133 inline tchar operator[] (short idx) const {return getChar (static_cast<uint32> (idx));}
134 inline tchar operator[] (long idx) const {return getChar (static_cast<uint32> (idx));}
135 inline tchar operator[] (int idx) const {return getChar (static_cast<uint32> (idx));}
136 inline tchar operator[] (unsigned short idx) const {return getChar (idx);}
137 inline tchar operator[] (unsigned long idx) const {return getChar (static_cast<uint32> (idx));}
138 inline tchar operator[] (unsigned int idx) const {return getChar (idx);}
139
140 inline virtual const char8* text8 () const;
141 inline virtual const char16* text16 () const;
142 inline virtual const tchar* text () const;
143 inline virtual const void* ptr () const {return buffer;}
144
145 inline virtual char8 getChar8 (uint32 index) const;
146 inline virtual char16 getChar16 (uint32 index) const;
147 inline tchar getChar (uint32 index) const;
148 inline tchar getCharAt (uint32 index) const;
149
150 bool testChar8 (uint32 index, char8 c) const;
151 bool testChar16 (uint32 index, char16 c) const;
152 inline bool testChar (uint32 index, char8 c) const {return testChar8 (index, c);}
153 inline bool testChar (uint32 index, char16 c) const {return testChar16 (index, c);}
154
155 bool extract (String& result, uint32 idx, int32 n = -1) const;
156 int32 copyTo8 (char8* str, uint32 idx = 0, int32 n = -1) const;
157 int32 copyTo16 (char16* str, uint32 idx = 0, int32 n = -1) const;
158 int32 copyTo (tchar* str, uint32 idx = 0, int32 n = -1) const;
159 void copyTo (IStringResult* result) const;
160 void copyTo (IString& string) const;
161
162 inline uint32 hash (uint32 tsize) const
163 {
164 return isWide ? hashString16 (buffer16, tsize) : hashString8 (buffer8, tsize) ;
165 }
166 //-------------------------------------------------------------------------
167
168 // compare ----------------------------------------------------------------
174
175 int32 compareAt (uint32 index, const ConstString& str, int32 n = -1, CompareMode m = kCaseSensitive) const;
176 int32 compare (const ConstString& str, int32 n, CompareMode m = kCaseSensitive) const;
177 int32 compare (const ConstString& str, CompareMode m = kCaseSensitive) const;
178
180
181 bool startsWith (const ConstString& str, CompareMode m = kCaseSensitive) const;
182 bool endsWith (const ConstString& str, CompareMode m = kCaseSensitive) const;
183 bool contains (const ConstString& str, CompareMode m = kCaseSensitive) const;
184
185 // static methods
186 static bool isCharSpace (char8 character);
187 static bool isCharSpace (char16 character);
188 static bool isCharAlpha (char8 character);
189 static bool isCharAlpha (char16 character);
190 static bool isCharAlphaNum (char8 character);
191 static bool isCharAlphaNum (char16 character);
192 static bool isCharDigit (char8 character);
193 static bool isCharDigit (char16 character);
194 static bool isCharAscii (char8 character);
195 static bool isCharAscii (char16 character);
196 static bool isCharUpper (char8 character);
197 static bool isCharUpper (char16 character);
198 static bool isCharLower (char8 character);
199 static bool isCharLower (char16 character);
200 //-------------------------------------------------------------------------
201
204 inline int32 findFirst (const ConstString& str, int32 n = -1, CompareMode m = kCaseSensitive, int32 endIndex = -1) const {return findNext (0, str, n, m, endIndex);}
205 inline int32 findFirst (char8 c, CompareMode m = kCaseSensitive, int32 endIndex = -1) const {return findNext (0, c, m, endIndex);}
206 inline int32 findFirst (char16 c, CompareMode m = kCaseSensitive, int32 endIndex = -1) const {return findNext (0, c, m, endIndex);}
208
210 int32 findNext (int32 startIndex, const ConstString& str, int32 n = -1, CompareMode = kCaseSensitive, int32 endIndex = -1) const;
211 int32 findNext (int32 startIndex, char8 c, CompareMode = kCaseSensitive, int32 endIndex = -1) const;
212 int32 findNext (int32 startIndex, char16 c, CompareMode = kCaseSensitive, int32 endIndex = -1) const;
214
216 int32 findPrev (int32 startIndex, const ConstString& str, int32 n = -1, CompareMode = kCaseSensitive) const;
217 int32 findPrev (int32 startIndex, char8 c, CompareMode = kCaseSensitive) const;
218 int32 findPrev (int32 startIndex, char16 c, CompareMode = kCaseSensitive) const;
220
221 inline int32 findLast (const ConstString& str, int32 n = -1, CompareMode m = kCaseSensitive) const {return findPrev (-1, str, n, m);}
222 inline int32 findLast (char8 c, CompareMode m = kCaseSensitive) const {return findPrev (-1, c, m);}
223 inline int32 findLast (char16 c, CompareMode m = kCaseSensitive) const {return findPrev (-1, c, m);}
224
228 //-------------------------------------------------------------------------
229
230 // numbers ----------------------------------------------------------------
231 bool isDigit (uint32 index) const;
232 bool scanFloat (double& value, uint32 offset = 0, bool scanToEnd = true) const;
233 bool scanInt64 (int64& value, uint32 offset = 0, bool scanToEnd = true) const;
234 bool scanUInt64 (uint64& value, uint32 offset = 0, bool scanToEnd = true) const;
235 bool scanInt32 (int32& value, uint32 offset = 0, bool scanToEnd = true) const;
236 bool scanUInt32 (uint32& value, uint32 offset = 0, bool scanToEnd = true) const;
237 bool scanHex (uint8& value, uint32 offset = 0, bool scanToEnd = true) const;
238
240 int64 getTrailingNumber (int64 fallback = 0) const;
241 int64 getNumber () const;
242
243 // static methods
244 static bool scanInt64_8 (const char8* text, int64& value, bool scanToEnd = true);
245 static bool scanInt64_16 (const char16* text, int64& value, bool scanToEnd = true);
246 static bool scanInt64 (const tchar* text, int64& value, bool scanToEnd = true);
247
248 static bool scanUInt64_8 (const char8* text, uint64& value, bool scanToEnd = true);
249 static bool scanUInt64_16 (const char16* text, uint64& value, bool scanToEnd = true);
250 static bool scanUInt64 (const tchar* text, uint64& value, bool scanToEnd = true);
251
252 static bool scanInt32_8 (const char8* text, int32& value, bool scanToEnd = true);
253 static bool scanInt32_16 (const char16* text, int32& value, bool scanToEnd = true);
254 static bool scanInt32 (const tchar* text, int32& value, bool scanToEnd = true);
255
256 static bool scanUInt32_8 (const char8* text, uint32& value, bool scanToEnd = true);
257 static bool scanUInt32_16 (const char16* text, uint32& value, bool scanToEnd = true);
258 static bool scanUInt32 (const tchar* text, uint32& value, bool scanToEnd = true);
259
260 static bool scanHex_8 (const char8* text, uint8& value, bool scanToEnd = true);
261 static bool scanHex_16 (const char16* text, uint8& value, bool scanToEnd = true);
262 static bool scanHex (const tchar* text, uint8& value, bool scanToEnd = true);
263 //-------------------------------------------------------------------------
264
265 // conversion -------------------------------------------------------------
266 void toVariant (FVariant& var) const;
267
268 static char8 toLower (char8 c);
269 static char8 toUpper (char8 c);
270 static char16 toLower (char16 c);
271 static char16 toUpper (char16 c);
272
273 static int32 multiByteToWideString (char16* dest, const char8* source, int32 wcharCount, uint32 sourceCodePage = kCP_Default);
274 static int32 wideStringToMultiByte (char8* dest, const char16* source, int32 char8Count, uint32 destCodePage = kCP_Default);
275
276 bool isWideString () const {return isWide != 0;}
277 bool isAsciiString () const;
278
280
281#if SMTG_OS_MACOS
282 virtual void* toCFStringRef (uint32 encoding = 0xFFFF, bool mutableCFString = false) const;
283#endif
284//-------------------------------------------------------------------------
285
286//-----------------------------------------------------------------------------
287protected:
288
289 union
290 {
291 void* buffer;
294 };
297};
298
299//-----------------------------------------------------------------------------
306//-----------------------------------------------------------------------------
307class String : public ConstString
308{
309public:
310
311//-----------------------------------------------------------------------------
312 String ();
313 String (const char8* str, MBCodePage codepage, int32 n = -1, bool isTerminated = true);
314 String (const char8* str, int32 n = -1, bool isTerminated = true);
315 String (const char16* str, int32 n = -1, bool isTerminated = true);
316 String (const String& str, int32 n = -1);
317 String (const ConstString& str, int32 n = -1);
318 String (const FVariant& var);
319 String (IString* str);
320 ~String ();
321
322#if SMTG_CPP11_STDLIBSUPPORT
323 String (String&& str);
324 String& operator= (String&& str);
325#endif
326
327 // access------------------------------------------------------------------
328 void updateLength ();
329 const char8* text8 () const SMTG_OVERRIDE;
330 const char16* text16 () const SMTG_OVERRIDE;
331 char8 getChar8 (uint32 index) const SMTG_OVERRIDE;
332 char16 getChar16 (uint32 index) const SMTG_OVERRIDE;
333
334 bool setChar8 (uint32 index, char8 c);
335 bool setChar16 (uint32 index, char16 c);
336 inline bool setChar (uint32 index, char8 c) {return setChar8 (index, c);}
337 inline bool setChar (uint32 index, char16 c) {return setChar16 (index, c);}
338 //-------------------------------------------------------------------------
339
340 // assignment--------------------------------------------------------------
341 String& operator= (const char8* str) {return assign (str);}
342 String& operator= (const char16* str) {return assign (str);}
343 String& operator= (const ConstString& str) {return assign (str);}
344 String& operator= (const String& str) {return assign (str);}
347
348 String& assign (const ConstString& str, int32 n = -1);
349 String& assign (const char8* str, int32 n = -1, bool isTerminated = true);
350 String& assign (const char16* str, int32 n = -1, bool isTerminated = true);
351 String& assign (char8 c, int32 n = 1);
352 String& assign (char16 c, int32 n = 1);
353 //-------------------------------------------------------------------------
354
355 // concat------------------------------------------------------------------
356 String& append (const ConstString& str, int32 n = -1);
357 String& append (const char8* str, int32 n = -1);
358 String& append (const char16* str, int32 n = -1);
359 String& append (const char8 c, int32 n = 1);
360 String& append (const char16 c, int32 n = 1);
361
362 String& insertAt (uint32 idx, const ConstString& str, int32 n = -1);
363 String& insertAt (uint32 idx, const char8* str, int32 n = -1);
364 String& insertAt (uint32 idx, const char16* str, int32 n = -1);
365 String& insertAt (uint32 idx, char8 c) {char8 str[] = {c, 0}; return insertAt (idx, str, 1);}
366 String& insertAt (uint32 idx, char16 c) {char16 str[] = {c, 0}; return insertAt (idx, str, 1);}
367
368 String& operator+= (const String& str) {return append (str);}
369 String& operator+= (const ConstString& str) {return append (str);}
370 String& operator+= (const char8* str) {return append (str);}
371 String& operator+= (const char16* str) {return append (str);}
372 String& operator+= (const char8 c) {return append (c);}
373 String& operator+= (const char16 c) {return append (c);}
374 //-------------------------------------------------------------------------
375
376 // replace-----------------------------------------------------------------
377 String& replace (uint32 idx, int32 n1, const ConstString& str, int32 n2 = -1);
378 String& replace (uint32 idx, int32 n1, const char8* str, int32 n2 = -1);
379 String& replace (uint32 idx, int32 n1, const char16* str, int32 n2 = -1);
380
381 int32 replace (const char8* toReplace, const char8* toReplaceWith, bool all = false, CompareMode m = kCaseSensitive);
382 int32 replace (const char16* toReplace, const char16* toReplaceWith, bool all = false, CompareMode m = kCaseSensitive);
383
384 bool replaceChars8 (const char8* toReplace, char8 toReplaceBy);
385 bool replaceChars16 (const char16* toReplace, char16 toReplaceBy);
386 inline bool replaceChars8 (char8 toReplace, char8 toReplaceBy) {char8 str[] = {toReplace, 0}; return replaceChars8 (str, toReplaceBy);}
387 inline bool replaceChars16 (char16 toReplace, char16 toReplaceBy) {char16 str[] = {toReplace, 0}; return replaceChars16 (str, toReplaceBy);}
388 inline bool replaceChars (char8 toReplace, char8 toReplaceBy) {return replaceChars8 (toReplace, toReplaceBy);}
389 inline bool replaceChars (char16 toReplace, char16 toReplaceBy) {return replaceChars16 (toReplace, toReplaceBy);}
390 inline bool replaceChars (const char8* toReplace, char8 toReplaceBy) {return replaceChars8 (toReplace, toReplaceBy);}
391 inline bool replaceChars (const char16* toReplace, char16 toReplaceBy) {return replaceChars16 (toReplace, toReplaceBy);}
392 //-------------------------------------------------------------------------
393
394 // remove------------------------------------------------------------------
395 String& remove (uint32 index = 0, int32 n = -1);
397 bool trim (CharGroup mode = kSpace);
399 bool removeChars8 (const char8* which);
400 bool removeChars16 (const char16* which);
401 inline bool removeChars8 (const char8 which) {char8 str[] = {which, 0}; return removeChars8 (str); }
402 inline bool removeChars16 (const char16 which) {char16 str[] = {which, 0}; return removeChars16 (str); }
403 inline bool removeChars (const char8* which) {return removeChars8 (which);}
404 inline bool removeChars (const char16* which) {return removeChars16 (which);}
405 inline bool removeChars (const char8 which) {return removeChars8 (which);}
406 inline bool removeChars (const char16 which) {return removeChars16 (which);}
407 bool removeSubString (const ConstString& subString, bool allOccurences = true);
408 //-------------------------------------------------------------------------
409
410 // print-------------------------------------------------------------------
411 String& printf (const char8* format, ...);
412 String& printf (const char16* format, ...);
413 String& vprintf (const char8* format, va_list args);
414 String& vprintf (const char16* format, va_list args);
415 //-------------------------------------------------------------------------
416
417 // numbers-----------------------------------------------------------------
419 String& printFloat (double value);
422 bool incrementTrailingNumber (uint32 width = 2, tchar separator = STR (' '), uint32 minNumber = 1, bool applyOnlyFormat = false);
423 //-------------------------------------------------------------------------
424
425 // conversion--------------------------------------------------------------
426 bool fromVariant (const FVariant& var);
427 void toVariant (FVariant& var) const;
428 bool fromAttributes (IAttributes* a, IAttrID attrID);
429 bool toAttributes (IAttributes* a, IAttrID attrID);
430
431 void swapContent (String& s);
432 void take (String& str);
433 void take (void* _buffer, bool wide);
434 void* pass ();
435 void passToVariant (FVariant& var);
436
437 void toLower (uint32 index);
438 void toLower ();
439 void toUpper (uint32 index);
440 void toUpper ();
441
442 unsigned char* toPascalString (unsigned char* buf);
443 const String& fromPascalString (const unsigned char* buf);
444
445 bool toWideString (uint32 sourceCodePage = kCP_Default);
446 bool toMultiByte (uint32 destCodePage = kCP_Default);
447
448 void fromUTF8 (const char8* utf8String);
450
451#if SMTG_OS_MACOS
452 virtual bool fromCFStringRef (const void*, uint32 encoding = 0xFFFF);
453#endif
454 //-------------------------------------------------------------------------
455
456 //-----------------------------------------------------------------------------
457protected:
458 bool resize (uint32 newSize, bool wide, bool fill = false);
459
460private:
461 void tryFreeBuffer ();
462 bool checkToMultiByte (uint32 destCodePage = kCP_Default) const; // to remove debug code from inline - const_cast inside!!!
463};
464
465// String concatenation functions.
466inline String operator+ (const ConstString& s1, const ConstString& s2) {return String (s1).append (s2);}
467inline String operator+ (const ConstString& s1, const char8* s2) {return String (s1).append (s2);}
468inline String operator+ (const ConstString& s1, const char16* s2) {return String (s1).append (s2);}
469inline String operator+ (const char8* s1, const ConstString& s2) {return String (s1).append (s2);}
470inline String operator+ (const char16* s1, const ConstString& s2) {return String (s1).append (s2);}
471inline String operator+ (const ConstString& s1, const String& s2) {return String (s1).append (s2);}
472inline String operator+ (const String& s1, const ConstString& s2) {return String (s1).append (s2);}
473inline String operator+ (const String& s1, const String& s2) {return String (s1).append (s2);}
474inline String operator+ (const String& s1, const char8* s2) {return String (s1).append (s2);}
475inline String operator+ (const String& s1, const char16* s2) {return String (s1).append (s2);}
476inline String operator+ (const char8* s1, const String& s2) {return String (s1).append (s2);}
477inline String operator+ (const char16* s1, const String& s2) {return String (s1).append (s2);}
478
479//-----------------------------------------------------------------------------
480// ConstString
481//-----------------------------------------------------------------------------
482inline const tchar* ConstString::text () const
483{
484#ifdef UNICODE
485 return text16 ();
486#else
487 return text8 ();
488#endif
489}
490
491//-----------------------------------------------------------------------------
492inline const char8* ConstString::text8 () const
493{
494 return (!isWide && buffer8) ? buffer8: kEmptyString8;
495}
496
497//-----------------------------------------------------------------------------
498inline const char16* ConstString::text16 () const
499{
500 return (isWide && buffer16) ? buffer16 : kEmptyString16;
501}
502
503//-----------------------------------------------------------------------------
505{
506 if (index < len && buffer8 && !isWide)
507 return buffer8[index];
508 return 0;
509}
510
511//-----------------------------------------------------------------------------
513{
514 if (index < len && buffer16 && isWide)
515 return buffer16[index];
516 return 0;
517}
518
519//-----------------------------------------------------------------------------
521{
522#ifdef UNICODE
523 return getChar16 (index);
524#else
525 return getChar8 (index);
526#endif
527}
528
529//-----------------------------------------------------------------------------
531{
532#ifdef UNICODE
533 if (isWide)
534 return getChar16 (index);
535#endif
536
537 return static_cast<tchar> (getChar8 (index));
538}
539
540//-----------------------------------------------------------------------------
542{
543 int64 tmp = 0;
544 scanInt64 (tmp);
545 return tmp;
546}
547
548//-----------------------------------------------------------------------------
549inline bool ConstString::scanInt32_8 (const char8* text, int32& value, bool scanToEnd)
550{
551 int64 tmp;
552 if (scanInt64_8 (text, tmp, scanToEnd))
553 {
554 value = (int32)tmp;
555 return true;
556 }
557 return false;
558}
559
560//-----------------------------------------------------------------------------
561inline bool ConstString::scanInt32_16 (const char16* text, int32& value, bool scanToEnd)
562{
563 int64 tmp;
564 if (scanInt64_16 (text, tmp, scanToEnd))
565 {
566 value = (int32)tmp;
567 return true;
568 }
569 return false;
570}
571
572//-----------------------------------------------------------------------------
573inline bool ConstString::scanInt32 (const tchar* text, int32& value, bool scanToEnd)
574{
575 int64 tmp;
576 if (scanInt64 (text, tmp, scanToEnd))
577 {
578 value = (int32)tmp;
579 return true;
580 }
581 return false;
582}
583
584//-----------------------------------------------------------------------------
585inline bool ConstString::scanUInt32_8 (const char8* text, uint32& value, bool scanToEnd)
586{
587 uint64 tmp;
588 if (scanUInt64_8 (text, tmp, scanToEnd))
589 {
590 value = (uint32)tmp;
591 return true;
592 }
593 return false;
594}
595
596//-----------------------------------------------------------------------------
597inline bool ConstString::scanUInt32_16 (const char16* text, uint32& value, bool scanToEnd)
598{
599 uint64 tmp;
600 if (scanUInt64_16 (text, tmp, scanToEnd))
601 {
602 value = (uint32)tmp;
603 return true;
604 }
605 return false;
606}
607
608//-----------------------------------------------------------------------------
609inline bool ConstString::scanUInt32 (const tchar* text, uint32& value, bool scanToEnd)
610{
611 uint64 tmp;
612 if (scanUInt64 (text, tmp, scanToEnd))
613 {
614 value = (uint32)tmp;
615 return true;
616 }
617 return false;
618}
619
620//-----------------------------------------------------------------------------
621inline const char8* String::text8 () const
622{
623 if (isWide && !isEmpty ())
624 checkToMultiByte (); // this should be avoided, since it can lead to information loss
625
626 return ConstString::text8 ();
627}
628
629//-----------------------------------------------------------------------------
630inline const char16* String::text16 () const
631{
632 if (!isWide && !isEmpty ())
633 {
634 const_cast<String&> (*this).toWideString ();
635 }
636 return ConstString::text16 ();
637}
638
639//-----------------------------------------------------------------------------
640inline char8 String::getChar8 (uint32 index) const
641{
642 if (isWide && !isEmpty ())
643 checkToMultiByte (); // this should be avoided, since it can lead to information loss
644
645 return ConstString::getChar8 (index);
646}
647
648//-----------------------------------------------------------------------------
649inline char16 String::getChar16 (uint32 index) const
650{
651 if (!isWide && !isEmpty ())
652 {
653 const_cast<String&> (*this).toWideString ();
654 }
655 return ConstString::getChar16 (index);
656}
657
658//-----------------------------------------------------------------------------
659
660
661inline bool operator< (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) < 0) ? true : false;}
662inline bool operator<= (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) <= 0) ? true : false;}
663inline bool operator> (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) > 0) ? true : false;}
664inline bool operator>= (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) >= 0) ? true : false;}
665inline bool operator== (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) == 0) ? true : false;}
666inline bool operator!= (const ConstString& s1, const ConstString& s2) {return (s1.compare (s2) != 0) ? true : false;}
667
668inline bool operator< (const ConstString& s1, const char8* s2) {return (s1.compare (s2) < 0) ? true : false;}
669inline bool operator<= (const ConstString& s1, const char8* s2) {return (s1.compare (s2) <= 0) ? true : false;}
670inline bool operator> (const ConstString& s1, const char8* s2) {return (s1.compare (s2) > 0) ? true : false;}
671inline bool operator>= (const ConstString& s1, const char8* s2) {return (s1.compare (s2) >= 0) ? true : false;}
672inline bool operator== (const ConstString& s1, const char8* s2) {return (s1.compare (s2) == 0) ? true : false;}
673inline bool operator!= (const ConstString& s1, const char8* s2) {return (s1.compare (s2) != 0) ? true : false;}
674inline bool operator< (const char8* s1, const ConstString& s2) {return (s2.compare (s1) > 0) ? true : false;}
675inline bool operator<= (const char8* s1, const ConstString& s2) {return (s2.compare (s1) >= 0) ? true : false;}
676inline bool operator> (const char8* s1, const ConstString& s2) {return (s2.compare (s1) < 0) ? true : false;}
677inline bool operator>= (const char8* s1, const ConstString& s2) {return (s2.compare (s1) <= 0) ? true : false;}
678inline bool operator== (const char8* s1, const ConstString& s2) {return (s2.compare (s1) == 0) ? true : false;}
679inline bool operator!= (const char8* s1, const ConstString& s2) {return (s2.compare (s1) != 0) ? true : false;}
680
681inline bool operator< (const ConstString& s1, const char16* s2) {return (s1.compare (s2) < 0) ? true : false;}
682inline bool operator<= (const ConstString& s1, const char16* s2) {return (s1.compare (s2) <= 0) ? true : false;}
683inline bool operator> (const ConstString& s1, const char16* s2) {return (s1.compare (s2) > 0) ? true : false;}
684inline bool operator>= (const ConstString& s1, const char16* s2) {return (s1.compare (s2) >= 0) ? true : false;}
685inline bool operator== (const ConstString& s1, const char16* s2) {return (s1.compare (s2) == 0) ? true : false;}
686inline bool operator!= (const ConstString& s1, const char16* s2) {return (s1.compare (s2) != 0) ? true : false;}
687inline bool operator< (const char16* s1, const ConstString& s2) {return (s2.compare (s1) > 0) ? true : false;}
688inline bool operator<= (const char16* s1, const ConstString& s2) {return (s2.compare (s1) >= 0) ? true : false;}
689inline bool operator> (const char16* s1, const ConstString& s2) {return (s2.compare (s1) < 0) ? true : false;}
690inline bool operator>= (const char16* s1, const ConstString& s2) {return (s2.compare (s1) <= 0) ? true : false;}
691inline bool operator== (const char16* s1, const ConstString& s2) {return (s2.compare (s1) == 0) ? true : false;}
692inline bool operator!= (const char16* s1, const ConstString& s2) {return (s2.compare (s1) != 0) ? true : false;}
693
694// The following functions will only work with European Numbers!
695// (e.g. Arabic, Tibetan, and Khmer digits are not supported)
696extern int32 strnatcmp8 (const char8* s1, const char8* s2, bool caseSensitive = true);
697extern int32 strnatcmp16 (const char16* s1, const char16* s2, bool caseSensitive = true);
698inline int32 strnatcmp (const tchar* s1, const tchar* s2, bool caseSensitive = true)
699{
700#ifdef UNICODE
701 return strnatcmp16 (s1, s2, caseSensitive);
702#else
703 return strnatcmp8 (s1, s2, caseSensitive);
704#endif
705}
706
707//-----------------------------------------------------------------------------
714//-----------------------------------------------------------------------------
715class StringObject : public FObject, public String, public IStringResult, public IString
716{
717public:
718//-----------------------------------------------------------------------------
720 StringObject (const char16* str, int32 n = -1, bool isTerminated = true) : String (str, n, isTerminated) {}
721 StringObject (const char8* str, int32 n = -1, bool isTerminated = true) : String (str, n, isTerminated) {}
722 StringObject (const StringObject& str, int32 n = -1) : String (str, n) {}
723 StringObject (const String& str, int32 n = -1) : String (str, n) {}
724 StringObject (const FVariant& var) : String (var) {}
725
726 using String::operator=;
727
728 // IStringResult ----------------------------------------------------------
729 void PLUGIN_API setText (const char8* text) SMTG_OVERRIDE;
730 //-------------------------------------------------------------------------
731
732 // IString-----------------------------------------------------------------
733 void PLUGIN_API setText8 (const char8* text) SMTG_OVERRIDE;
734 void PLUGIN_API setText16 (const char16* text) SMTG_OVERRIDE;
735
736 const char8* PLUGIN_API getText8 () SMTG_OVERRIDE;
737 const char16* PLUGIN_API getText16 () SMTG_OVERRIDE;
738
739 void PLUGIN_API take (void* s, bool _isWide) SMTG_OVERRIDE;
740 bool PLUGIN_API isWideString () const SMTG_OVERRIDE;
741 //-------------------------------------------------------------------------
742
745};
746
747//------------------------------------------------------------------------
748} // namespace Steinberg
uint8_t a
Definition Spc_Cpu.h:141
int32_t int32
Definition basics.h:89
uint32_t uint32
Definition basics.h:90
Definition fstring.h:117
static bool isCharLower(char8 character)
Definition fstring.cpp:1743
virtual const char8 * text8() const
Returns pointer to string of type char8.
Definition fstring.h:492
int32 getFirstDifferent(const ConstString &str, CompareMode=kCaseSensitive) const
Returns position of first different character.
Definition fstring.cpp:1297
int64 getTrailingNumber(int64 fallback=0) const
Returns result of scanInt64 or the fallback.
Definition fstring.cpp:1790
bool testChar16(uint32 index, char16 c) const
Definition fstring.cpp:517
bool isAsciiString() const
Checks if all characters in string are in ascii range.
Definition fstring.cpp:1819
virtual const tchar * text() const
Returns pointer to string of type tchar.
Definition fstring.h:482
virtual char8 getChar8(uint32 index) const
Returns character of type char16 at 'index'.
Definition fstring.h:504
static bool scanUInt32_16(const char16 *text, uint32 &value, bool scanToEnd=true)
Converts string of type char16 to int32 value.
Definition fstring.h:597
int32 findFirst(char8 c, CompareMode m=kCaseSensitive, int32 endIndex=-1) const
Definition fstring.h:205
static bool scanInt32_8(const char8 *text, int32 &value, bool scanToEnd=true)
Converts string of type char8 to int32 value.
Definition fstring.h:549
static bool isCharSpace(char8 character)
Returns true if character is a space.
Definition fstring.cpp:1652
static bool scanUInt64_16(const char16 *text, uint64 &value, bool scanToEnd=true)
Converts string of type char16 to uint64 value.
Definition fstring.cpp:1463
static int32 wideStringToMultiByte(char8 *dest, const char16 *source, int32 char8Count, uint32 destCodePage=kCP_Default)
If dest is zero, this returns the maximum number of bytes needed to convert source.
Definition fstring.cpp:1924
CompareMode
Definition fstring.h:170
@ kCaseSensitive
Comparison is done with regard to character's case.
Definition fstring.h:171
@ kCaseInsensitive
Comparison is done without regard to character's case.
Definition fstring.h:172
int32 findLast(const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive) const
Find last occurrence of n characters of str in this (n=-1: all).
Definition fstring.h:221
tchar getCharAt(uint32 index) const
Returns character of type tchar at 'index', no conversion!
Definition fstring.h:530
bool endsWith(const ConstString &str, CompareMode m=kCaseSensitive) const
Check if this ends with str.
Definition fstring.cpp:883
int32 naturalCompare(const ConstString &str, CompareMode mode=kCaseSensitive) const
Definition fstring.cpp:801
bool isDigit(uint32 index) const
Returns true if character at position is a digit.
Definition fstring.cpp:1755
uint32 len
Definition fstring.h:295
static bool scanHex_16(const char16 *text, uint8 &value, bool scanToEnd=true)
Converts string of type char16 to hex/unit8 value.
Definition fstring.cpp:1513
uint32 hash(uint32 tsize) const
Definition fstring.h:162
int32 findFirst(char16 c, CompareMode m=kCaseSensitive, int32 endIndex=-1) const
Definition fstring.h:206
tchar operator[](short idx) const
Returns character at 'idx'.
Definition fstring.h:133
bool testChar8(uint32 index, char8 c) const
Returns true if character is equal at position 'index'.
Definition fstring.cpp:500
bool scanInt32(int32 &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to int32 value starting at offset.
Definition fstring.cpp:1399
static bool scanHex_8(const char8 *text, uint8 &value, bool scanToEnd=true)
Converts string of type char8 to hex/unit8 value.
Definition fstring.cpp:1495
bool testChar(uint32 index, char16 c) const
Definition fstring.h:153
bool scanHex(uint8 &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to hex/uint8 value starting at offset.
Definition fstring.cpp:1387
static bool isCharUpper(char8 character)
Definition fstring.cpp:1731
bool scanUInt32(uint32 &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to uint32 value starting at offset.
Definition fstring.cpp:1411
bool extract(String &result, uint32 idx, int32 n=-1) const
Get n characters long substring starting at index (n=-1: until end).
Definition fstring.cpp:534
static char8 toLower(char8 c)
Converts to lower case.
Definition fstring.cpp:1624
static bool isCharAlphaNum(char8 character)
Returns true if character is an alphanumeric character.
Definition fstring.cpp:1695
int32 copyTo8(char8 *str, uint32 idx=0, int32 n=-1) const
Definition fstring.cpp:551
int32 countOccurences(char8 c, uint32 startIndex, CompareMode=kCaseSensitive) const
Counts occurences of c within this starting at index.
Definition fstring.cpp:1241
bool isWideString() const
Returns true if string is wide.
Definition fstring.h:276
bool startsWith(const ConstString &str, CompareMode m=kCaseSensitive) const
Check if this starts with str.
Definition fstring.cpp:834
char8 * buffer8
Definition fstring.h:292
int32 getTrailingNumberIndex(uint32 width=0) const
Returns start index of trailing number.
Definition fstring.cpp:1767
int32 copyTo(tchar *str, uint32 idx=0, int32 n=-1) const
Definition fstring.cpp:607
bool scanUInt64(uint64 &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to uint64 value starting at offset.
Definition fstring.cpp:1375
int32 findLast(char16 c, CompareMode m=kCaseSensitive) const
Definition fstring.h:223
ConstString(const char8 *str, int32 length=-1)
Assign from string of type char8 (length=-1: all).
Definition fstring.cpp:439
ConstString()
Definition fstring.cpp:492
bool isEmpty() const
Return true if string is empty.
Definition fstring.h:129
tchar getChar(uint32 index) const
Returns character of type tchar at 'index'.
Definition fstring.h:520
int64 getNumber() const
Returns result of scanInt64.
Definition fstring.h:541
static int32 multiByteToWideString(char16 *dest, const char8 *source, int32 wcharCount, uint32 sourceCodePage=kCP_Default)
If dest is zero, this returns the maximum number of bytes needed to convert source.
Definition fstring.cpp:1858
int32 findLast(char8 c, CompareMode m=kCaseSensitive) const
Definition fstring.h:222
bool contains(const ConstString &str, CompareMode m=kCaseSensitive) const
Check if this contains str.
Definition fstring.cpp:932
bool testChar(uint32 index, char8 c) const
Definition fstring.h:152
void toVariant(FVariant &var) const
Definition fstring.cpp:1806
virtual ~ConstString()
Destructor.
Definition fstring.h:125
static bool scanInt64_8(const char8 *text, int64 &value, bool scanToEnd=true)
Converts string of type char8 to int64 value.
Definition fstring.cpp:1423
static bool isCharAscii(char8 character)
Returns true if character is in ASCII range.
Definition fstring.cpp:1719
int32 findNext(int32 startIndex, const ConstString &str, int32 n=-1, CompareMode=kCaseSensitive, int32 endIndex=-1) const
Definition fstring.cpp:938
int32 findFirst(const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive, int32 endIndex=-1) const
Definition fstring.h:204
static bool scanInt64_16(const char16 *text, int64 &value, bool scanToEnd=true)
Converts string of type char16 to int64 value.
Definition fstring.cpp:1437
static bool isCharDigit(char8 character)
Returns true if character is a number.
Definition fstring.cpp:1707
static bool isCharAlpha(char8 character)
Returns true if character is an alphabetic character.
Definition fstring.cpp:1683
bool isNormalized(UnicodeNormalization=kUnicodeNormC)
On PC only kUnicodeNormC is working.
Definition fstring.cpp:2007
int32 findPrev(int32 startIndex, const ConstString &str, int32 n=-1, CompareMode=kCaseSensitive) const
Definition fstring.cpp:1173
bool scanFloat(double &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to double value starting at offset.
Definition fstring.cpp:1535
bool scanInt64(int64 &value, uint32 offset=0, bool scanToEnd=true) const
Converts string to int64 value starting at offset.
Definition fstring.cpp:1363
int32 copyTo16(char16 *str, uint32 idx=0, int32 n=-1) const
Definition fstring.cpp:579
virtual char16 getChar16(uint32 index) const
Returns character of type char8 at 'index'.
Definition fstring.h:512
static bool scanUInt64_8(const char8 *text, uint64 &value, bool scanToEnd=true)
Converts string of type char8 to uint64 value.
Definition fstring.cpp:1449
int32 compareAt(uint32 index, const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive) const
Compare n characters of str with n characters of this starting at index (return: see above).
Definition fstring.cpp:709
int32 compare(const ConstString &str, int32 n, CompareMode m=kCaseSensitive) const
Compare n characters of str with n characters of this (return: see above).
Definition fstring.cpp:651
static bool scanUInt32_8(const char8 *text, uint32 &value, bool scanToEnd=true)
Converts string of type char8 to int32 value.
Definition fstring.h:585
virtual const void * ptr() const
Returns pointer to string of type void.
Definition fstring.h:143
virtual const char16 * text16() const
Returns pointer to string of type char16.
Definition fstring.h:498
virtual int32 length() const
Return length of string.
Definition fstring.h:128
char16 * buffer16
Definition fstring.h:293
static char8 toUpper(char8 c)
Converts to upper case.
Definition fstring.cpp:1638
void * buffer
Definition fstring.h:291
uint32 isWide
Definition fstring.h:296
static bool scanInt32_16(const char16 *text, int32 &value, bool scanToEnd=true)
Converts string of type char16 to int32 value.
Definition fstring.h:561
Definition fobject.h:82
FObject()
default constructor...
Definition fobject.h:85
Definition fvariant.h:34
Definition ipersistent.h:80
Definition istringresult.h:50
Definition istringresult.h:32
Definition fstring.h:308
String & printf(const char8 *format,...)
Print formatted data into string.
Definition fstring.cpp:3314
char8 getChar8(uint32 index) const SMTG_OVERRIDE
Returns character of type char16 at 'index'.
Definition fstring.h:640
String & assign(const ConstString &str, int32 n=-1)
Assign n characters of str (-1: all).
Definition fstring.cpp:2500
CharGroup
Definition fstring.h:396
@ kNotAlphaNum
Definition fstring.h:396
@ kNotAlpha
Definition fstring.h:396
@ kSpace
Definition fstring.h:396
bool checkToMultiByte(uint32 destCodePage=kCP_Default) const
Definition fstring.cpp:2181
bool replaceChars8(const char8 *toReplace, char8 toReplaceBy)
Returns true when any replacement was done.
Definition fstring.cpp:2992
const char8 * text8() const SMTG_OVERRIDE
Returns pointer to string of type char8.
Definition fstring.h:621
void swapContent(String &s)
Swaps ownership of the strings pointed to.
Definition fstring.cpp:3633
void toUpper()
Upper case the string.
Definition fstring.cpp:3540
bool normalize(UnicodeNormalization=kUnicodeNormC)
On PC only kUnicodeNormC is working.
Definition fstring.cpp:2262
bool fromAttributes(IAttributes *a, IAttrID attrID)
Assigns string from FAttributes.
Definition fstring.cpp:3613
bool fromVariant(const FVariant &var)
Assigns string from FVariant.
Definition fstring.cpp:3573
~String()
Definition fstring.cpp:2103
String & operator+=(const String &str)
Definition fstring.h:368
bool replaceChars(const char16 *toReplace, char16 toReplaceBy)
Definition fstring.h:391
String & vprintf(const char8 *format, va_list args)
Definition fstring.cpp:3339
bool removeChars8(const char8 *which)
Remove all occurrences of each char in 'which'.
Definition fstring.cpp:3266
bool toAttributes(IAttributes *a, IAttrID attrID)
Definition fstring.cpp:3622
String()
Definition fstring.cpp:2038
bool replaceChars16(char16 toReplace, char16 toReplaceBy)
Definition fstring.h:387
bool removeChars(const char16 which)
Definition fstring.h:406
String & insertAt(uint32 idx, const ConstString &str, int32 n=-1)
Insert n characters of str at position idx (n=-1: all).
Definition fstring.cpp:2745
bool removeChars16(const char16 *which)
Remove all occurrences of each char in 'which'.
Definition fstring.cpp:3290
const String & fromPascalString(const unsigned char *buf)
Pascal string conversion.
Definition fstring.cpp:3734
void * pass()
Definition fstring.cpp:3667
bool setChar16(uint32 index, char16 c)
Definition fstring.cpp:2451
bool toWideString(uint32 sourceCodePage=kCP_Default)
Converts to wide string according to sourceCodePage.
Definition fstring.cpp:2141
bool toMultiByte(uint32 destCodePage=kCP_Default)
Definition fstring.cpp:2225
bool removeChars8(const char8 which)
Definition fstring.h:401
void take(String &str)
Take ownership of the string of 'str'.
Definition fstring.cpp:3647
String & printFloat(double value)
Definition fstring.cpp:3372
bool replaceChars(const char8 *toReplace, char8 toReplaceBy)
Definition fstring.h:390
char16 getChar16(uint32 index) const SMTG_OVERRIDE
Returns character of type char8 at 'index'.
Definition fstring.h:649
unsigned char * toPascalString(unsigned char *buf)
Pascal string conversion.
Definition fstring.cpp:3704
bool replaceChars8(char8 toReplace, char8 toReplaceBy)
Definition fstring.h:386
String & printInt64(int64 value)
Definition fstring.cpp:3357
bool replaceChars(char16 toReplace, char16 toReplaceBy)
Definition fstring.h:389
String & append(const ConstString &str, int32 n=-1)
Append n characters of str to this (n=-1: all).
Definition fstring.cpp:2597
bool removeChars(const char16 *which)
Definition fstring.h:404
String & operator=(const char8 *str)
Assign from a string of type char8.
Definition fstring.h:341
const char16 * text16() const SMTG_OVERRIDE
Returns pointer to string of type char16.
Definition fstring.h:630
bool removeChars(const char8 which)
Definition fstring.h:405
bool incrementTrailingNumber(uint32 width=2, tchar separator=STR(' '), uint32 minNumber=1, bool applyOnlyFormat=false)
Definition fstring.cpp:3424
bool removeChars(const char8 *which)
Definition fstring.h:403
bool resize(uint32 newSize, bool wide, bool fill=false)
Definition fstring.cpp:2329
void toVariant(FVariant &var) const
Definition fstring.cpp:3600
bool replaceChars(char8 toReplace, char8 toReplaceBy)
Definition fstring.h:388
String & remove(uint32 index=0, int32 n=-1)
Remove n characters from string starting at index (n=-1: until end).
Definition fstring.cpp:3053
bool setChar8(uint32 index, char8 c)
Definition fstring.cpp:2399
void fromUTF8(const char8 *utf8String)
Assigns from UTF8 string.
Definition fstring.cpp:2255
void passToVariant(FVariant &var)
Pass ownership of buffer to Variant - sets Variant ownership.
Definition fstring.cpp:3676
bool trim(CharGroup mode=kSpace)
Trim lead/trail.
Definition fstring.cpp:3129
void tryFreeBuffer()
Definition fstring.cpp:2319
String & insertAt(uint32 idx, char8 c)
Definition fstring.h:365
bool removeSubString(const ConstString &subString, bool allOccurences=true)
Definition fstring.cpp:3079
bool replaceChars16(const char16 *toReplace, char16 toReplaceBy)
Definition fstring.cpp:3019
String & insertAt(uint32 idx, char16 c)
Definition fstring.h:366
void updateLength()
Call this when the string is truncated outside (not recommended though).
Definition fstring.cpp:2132
bool setChar(uint32 index, char16 c)
Definition fstring.h:337
void toLower()
Lower case the string.
Definition fstring.cpp:3495
String & replace(uint32 idx, int32 n1, const ConstString &str, int32 n2=-1)
Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).
Definition fstring.cpp:2824
bool removeChars16(const char16 which)
Definition fstring.h:402
bool setChar(uint32 index, char8 c)
Definition fstring.h:336
void removeChars(CharGroup mode=kSpace)
Removes all of group.
Definition fstring.cpp:3192
Definition fstring.h:716
const char8 *PLUGIN_API getText8() SMTG_OVERRIDE
Definition fstring.cpp:3967
void PLUGIN_API take(void *s, bool _isWide) SMTG_OVERRIDE
Definition fstring.cpp:3979
StringObject(const FVariant &var)
Definition fstring.h:724
void PLUGIN_API setText8(const char8 *text) SMTG_OVERRIDE
Definition fstring.cpp:3955
StringObject(const StringObject &str, int32 n=-1)
Definition fstring.h:722
StringObject(const char16 *str, int32 n=-1, bool isTerminated=true)
Definition fstring.h:720
const char16 *PLUGIN_API getText16() SMTG_OVERRIDE
Definition fstring.cpp:3973
void PLUGIN_API setText(const char8 *text) SMTG_OVERRIDE
Definition fstring.cpp:3949
StringObject()
Definition fstring.h:719
StringObject(const String &str, int32 n=-1)
Definition fstring.h:723
void PLUGIN_API setText16(const char16 *text) SMTG_OVERRIDE
Definition fstring.cpp:3961
bool PLUGIN_API isWideString() const SMTG_OVERRIDE
Definition fstring.cpp:3985
StringObject(const char8 *str, int32 n=-1, bool isTerminated=true)
Definition fstring.h:721
unsigned * m
Definition inflate.c:1559
unsigned s
Definition inflate.c:1555
#define OBJ_METHODS(className, baseClass)
Definition fobject.h:339
#define FUNKNOWN_METHODS2(InterfaceName1, InterfaceName2, BaseClass)
Definition fobject.h:458
#define SMTG_OVERRIDE
Definition fplatform.h:241
#define STR(x)
Definition fstrdefs.h:39
static PuglViewHint int value
Definition pugl.h:1708
static int width
Definition pugl.h:1593
Definition baseiids.cpp:43
unsigned long long uint64
Definition ftypes.h:67
int16 char16
Definition ftypes.h:101
int int32
Definition ftypes.h:50
FIDString IAttrID
Definition ipersistent.h:62
static const char16 kEmptyString16[]
Definition fstrdefs.h:104
char char8
Definition ftypes.h:93
static const bool kWideStringDefault
Definition fstring.h:57
unsigned short uint16
Definition ftypes.h:44
int32 strnatcmp(const tchar *s1, const tchar *s2, bool caseSensitive=true)
Definition fstring.h:698
static const char8 kEmptyString8[]
Definition fstrdefs.h:103
long long int64
Definition ftypes.h:66
static const uint16 kBomUtf16
UTF16 Byte Order Mark.
Definition fstring.h:60
bool operator>=(const ConstString &s1, const ConstString &s2)
Definition fstring.h:664
int32 strnatcmp16(const char16 *s1, const char16 *s2, bool caseSensitive)
Definition fstring.cpp:3941
char16 tchar
Definition ftypes.h:105
bool operator!=(const ConstString &s1, const ConstString &s2)
Definition fstring.h:666
uint32 hashString8(const char8 *s, uint32 m)
Definition fstring.cpp:3835
MBCodePage
Definition fstring.h:66
@ kCP_MAC_ROMAN
Default Mac codepage.
Definition fstring.h:68
@ kCP_ShiftJIS
Shifted Japan Industrial Standard Encoding.
Definition fstring.h:73
@ kCP_US_ASCII
US-ASCII (7-bit).
Definition fstring.h:74
@ kCP_Default
Default ANSI codepage.
Definition fstring.h:76
@ kCP_MAC_CEE
Mac Central European Encoding.
Definition fstring.h:71
@ kCP_ANSI_WEL
West European Latin Encoding.
Definition fstring.h:70
@ kCP_ANSI
Default ANSI codepage.
Definition fstring.h:67
@ kCP_Utf8
UTF8 Encoding.
Definition fstring.h:72
unsigned char uint8
Definition ftypes.h:40
bool operator>(const ConstString &s1, const ConstString &s2)
Definition fstring.h:663
uint32 hashString(const tchar *s, uint32 m)
Definition fstring.h:92
UnicodeNormalization
Definition fstring.h:80
@ kUnicodeNormKD
Unicode normalization form KD, compatibility decomposition.
Definition fstring.h:84
@ kUnicodeNormKC
Unicode normalization form KC, compatibility composition.
Definition fstring.h:83
@ kUnicodeNormD
Unicode normalization Form D, canonical decomposition.
Definition fstring.h:82
@ kUnicodeNormC
Unicode normalization Form C, canonical composition.
Definition fstring.h:81
static const char8 *const kBomUtf8
UTF8 Byte Order Mark.
Definition fstring.h:61
uint32 hashString16(const char16 *s, uint32 m)
Definition fstring.cpp:3847
bool operator<(const ConstString &s1, const ConstString &s2)
Definition fstring.h:661
String operator+(const ConstString &s1, const ConstString &s2)
Definition fstring.h:466
static const int32 kBomUtf8Length
Definition fstring.h:62
int32 strnatcmp8(const char8 *s1, const char8 *s2, bool caseSensitive)
Definition fstring.cpp:3935
unsigned int uint32
Definition ftypes.h:51
bool operator==(const ConstString &s1, const ConstString &s2)
Definition fstring.h:665
bool operator<=(const ConstString &s1, const ConstString &s2)
Definition fstring.h:662
#define true
Definition ordinals.h:82
png_structrp int mode
Definition png.h:1139
const char * text
Definition swell-functions.h:167
int n
Definition crypt.c:458
return c
Definition crypt.c:175
int result
Definition process.c:1455
_WDL_CSTRING_PREFIX void INT_PTR const char * format
Definition wdlcstring.h:263
#define const
Definition zconf.h:137