/
CachedTexts.pas
34660 lines (31945 loc) · 855 KB
/
CachedTexts.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit CachedTexts;
{******************************************************************************}
{ Copyright (c) Dmitry Mozulyov }
{ }
{ Permission is hereby granted, free of charge, to any person obtaining a copy }
{ of this software and associated documentation files (the "Software"), to deal}
{ in the Software without restriction, including without limitation the rights }
{ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell }
{ copies of the Software, and to permit persons to whom the Software is }
{ furnished to do so, subject to the following conditions: }
{ }
{ The above copyright notice and this permission notice shall be included in }
{ all copies or substantial portions of the Software. }
{ }
{ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR }
{ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, }
{ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE }
{ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER }
{ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,}
{ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN }
{ THE SOFTWARE. }
{ }
{ email: softforyou@inbox.ru }
{ skype: dimandevil }
{ repository: https://github.com/d-mozulyov/CachedTexts }
{ }
{ see also: }
{ https://github.com/d-mozulyov/UniConv }
{ https://github.com/d-mozulyov/CachedBuffers }
{******************************************************************************}
// compiler directives
{$ifdef FPC}
{$MODE DELPHIUNICODE}
{$ASMMODE INTEL}
{$define INLINESUPPORT}
{$define INLINESUPPORTSIMPLE}
{$define OPERATORSUPPORT}
{$define STATICSUPPORT}
{$define GENERICSUPPORT}
{$define ANSISTRSUPPORT}
{$define SHORTSTRSUPPORT}
{$define WIDESTRSUPPORT}
{$ifdef MSWINDOWS}
{$define WIDESTRLENSHIFT}
{$endif}
{$define INTERNALCODEPAGE}
{$ifdef CPU386}
{$define CPUX86}
{$endif}
{$ifdef CPUX86_64}
{$define CPUX64}
{$endif}
{$if Defined(CPUARM) or Defined(UNIX)}
{$define POSIX}
{$ifend}
{$else}
{$if CompilerVersion >= 24}
{$LEGACYIFEND ON}
{$ifend}
{$if CompilerVersion >= 15}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CAST OFF}
{$WARN SYMBOL_DEPRECATED OFF}
{$ifend}
{$if CompilerVersion >= 20}
{$define INLINESUPPORT}
{$ifend}
{$if CompilerVersion >= 17}
{$define INLINESUPPORTSIMPLE}
{$ifend}
{$if CompilerVersion >= 18}
{$define OPERATORSUPPORT}
{$ifend}
{$if CompilerVersion >= 18.5}
{$define STATICSUPPORT}
{$ifend}
{$if CompilerVersion >= 20}
{$define GENERICSUPPORT}
{$define SYSARRAYSUPPORT}
{$ifend}
{$if CompilerVersion < 23}
{$define CPUX86}
{$ifend}
{$if CompilerVersion >= 23}
{$define UNITSCOPENAMES}
{$define RETURNADDRESS}
{$ifend}
{$if CompilerVersion >= 21}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$define EXTENDEDRTTI}
{$ifend}
{$if CompilerVersion >= 33}
{$define MANAGEDRECORDS}
{$ifend}
{$if (not Defined(NEXTGEN)) or (CompilerVersion >= 31)}
{$define ANSISTRSUPPORT}
{$ifend}
{$ifNdef NEXTGEN}
{$define SHORTSTRSUPPORT}
{$endif}
{$if Defined(MSWINDOWS) or (Defined(MACOS) and not Defined(IOS))}
{$define WIDESTRSUPPORT}
{$ifend}
{$if Defined(MSWINDOWS) or (Defined(WIDESTRSUPPORT) and (CompilerVersion <= 21))}
{$define WIDESTRLENSHIFT}
{$ifend}
{$if Defined(ANSISTRSUPPORT) and (CompilerVersion >= 20)}
{$define INTERNALCODEPAGE}
{$ifend}
{$if Defined(NEXTGEN)}
{$POINTERMATH ON}
{$ifend}
{$endif}
{$U-}{$V+}{$B-}{$X+}{$T+}{$P+}{$H+}{$J-}{$Z1}{$A4}
{$O+}{$R-}{$I-}{$Q-}{$W-}
{$ifdef CPUX86}
{$if not Defined(NEXTGEN)}
{$define CPUX86ASM}
{$define CPUINTELASM}
{$ifend}
{$define CPUINTEL}
{$endif}
{$ifdef CPUX64}
{$if (not Defined(POSIX)) or Defined(FPC)}
{$define CPUX64ASM}
{$define CPUINTELASM}
{$ifend}
{$define CPUINTEL}
{$endif}
{$if Defined(CPUINTEL) and Defined(POSIX)}
{$ifdef CPUX86}
{$define POSIXINTEL32}
{$else}
{$define POSIXINTEL64}
{$endif}
{$ifend}
{$if Defined(CPUX64) or Defined(CPUARM64)}
{$define LARGEINT}
{$else}
{$define SMALLINT}
{$ifend}
{$ifdef KOL_MCK}
{$define KOL}
{$endif}
{$ifdef POSIX}
{$undef CPUX86ASM}
{$undef CPUX64ASM}
{$undef CPUINTELASM}
{$endif}
interface
uses {$ifdef UNITSCOPENAMES}System.Types, System.SysConst{$else}Types, SysConst{$endif},
{$ifdef MSWINDOWS}{$ifdef UNITSCOPENAMES}Winapi.Windows{$else}Windows{$endif},{$endif}
{$ifdef POSIX}
{$ifdef FPC}
{$else}
Posix.String_, Posix.SysStat, Posix.Unistd,
{$endif}
{$endif}
{$ifdef KOL}
KOL, err
{$else}
{$ifdef UNITSCOPENAMES}System.SysUtils{$else}SysUtils{$endif}
{$endif},
CachedBuffers, UniConv;
type
// RTL types
{$ifdef FPC}
PUInt64 = ^UInt64;
PBoolean = ^Boolean;
PString = ^string;
{$else}
{$if CompilerVersion < 16}
UInt64 = Int64;
PUInt64 = ^UInt64;
{$ifend}
{$if CompilerVersion < 21}
NativeInt = Integer;
NativeUInt = Cardinal;
{$ifend}
{$if CompilerVersion < 22}
PNativeInt = ^NativeInt;
PNativeUInt = ^NativeUInt;
{$ifend}
PWord = ^Word;
{$endif}
{$if not Defined(FPC) and (CompilerVersion < 20)}
TDate = type TDateTime;
TTime = type TDateTime;
{$ifend}
PDate = ^TDate;
PTime = ^TTime;
{$if SizeOf(Extended) >= 10}
{$define EXTENDEDSUPPORT}
{$ifend}
TBytes = {$ifdef SYSARRAYSUPPORT}TArray<Byte>{$else}array of Byte{$endif};
PBytes = ^TBytes;
{$if Defined(KOL)}
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
{$elseif Defined(FPC)}
TFloatFormat = Low(SysUtils.TFloatFormat)..High(SysUtils.TFloatFormat);
{$ifend}
PFloatFormat = ^TFloatFormat;
// exception class
ECachedText = class(Exception)
{$ifdef KOL}
constructor Create(const Msg: string);
constructor CreateFmt(const Msg: string; const Args: array of const);
constructor CreateRes(Ident: NativeUInt); overload;
constructor CreateRes(ResStringRec: PResStringRec); overload;
constructor CreateResFmt(Ident: NativeUInt; const Args: array of const); overload;
constructor CreateResFmt(ResStringRec: PResStringRec; const Args: array of const); overload;
{$endif}
end;
// CachedBuffers types
ICachedObject = CachedBuffers.ICachedObject;
TCachedObject = CachedBuffers.TCachedObject;
TCachedObjectClass = CachedBuffers.TCachedObjectClass;
ECachedBuffer = CachedBuffers.ECachedBuffer;
TCachedBufferMemory = CachedBuffers.TCachedBufferMemory;
PCachedBufferMemory = CachedBuffers.PCachedBufferMemory;
TCachedBufferKind = CachedBuffers.TCachedBufferKind;
TCachedBufferCallback = CachedBuffers.TCachedBufferCallback;
TCachedBufferProgress = CachedBuffers.TCachedBufferProgress;
TCachedBuffer = CachedBuffers.TCachedBuffer;
TCachedBufferClass = CachedBuffers.TCachedBuffer;
TCachedReader = CachedBuffers.TCachedReader;
TCachedWriter = CachedBuffers.TCachedWriter;
TCachedReReader = CachedBuffers.TCachedReReader;
TCachedReWriter = CachedBuffers.TCachedReWriter;
TCachedFileReader = CachedBuffers.TCachedFileReader;
TCachedFileWriter = CachedBuffers.TCachedFileWriter;
TCachedMemoryReader = CachedBuffers.TCachedMemoryReader;
TCachedMemoryWriter = CachedBuffers.TCachedMemoryWriter;
{$ifdef MSWINDOWS}
TCachedResourceReader = CachedBuffers.TCachedResourceReader;
{$endif}
// UniConv types
{$if Defined(NEXTGEN) and (CompilerVersion >= 31)}
{$POINTERMATH ON}
{$ifend}
AnsiChar = UniConv.AnsiChar;
PAnsiChar = UniConv.PAnsiChar;
UTF8Char = UniConv.UTF8Char;
PUTF8Char = UniConv.PUTF8Char;
WideChar = UniConv.WideChar;
PWideChar = UniConv.PWideChar;
UnicodeChar = UniConv.UnicodeChar;
PUnicodeChar = UniConv.PUnicodeChar;
UCS4Char = UniConv.UCS4Char;
PUCS4Char = UniConv.PUCS4Char;
ShortString = UniConv.ShortString;
PShortString = UniConv.PShortString;
AnsiString = UniConv.AnsiString;
PAnsiString = UniConv.PAnsiString;
UTF8String = UniConv.UTF8String;
PUTF8String = UniConv.PUTF8String;
RawByteString = UniConv.RawByteString;
PRawByteString = UniConv.PRawByteString;
WideString = UniConv.WideString;
PWideString = UniConv.PWideString;
UnicodeString = UniConv.UnicodeString;
PUnicodeString = UniConv.PUnicodeString;
UCS4String = UniConv.UCS4String;
PUCS4String = UniConv.PUCS4String;
TCharCase = UniConv.TCharCase;
PCharCase = UniConv.PCharCase;
TBOM = UniConv.TBOM;
PBOM = UniConv.PBOM;
PUniConvContext = UniConv.PUniConvContext;
TUniConvContext = UniConv.TUniConvContext;
PUniConvSBCS = UniConv.PUniConvSBCS;
TUniConvSBCS = UniConv.TUniConvSBCS;
TUniConvCompareOptions = UniConv.TUniConvCompareOptions;
PUniConvCompareOptions = UniConv.PUniConvCompareOptions;
const
// UniConv constants
ccOriginal = UniConv.ccOriginal;
ccLower = UniConv.ccLower;
ccUpper = UniConv.ccUpper;
bomNone = UniConv.bomNone;
bomUTF8 = UniConv.bomUTF8;
bomUTF16 = UniConv.bomUTF16;
bomUTF16BE = UniConv.bomUTF16BE;
bomUTF32 = UniConv.bomUTF32;
bomUTF32BE = UniConv.bomUTF32BE;
bomUCS2143 = UniConv.bomUCS2143;
bomUCS3412 = UniConv.bomUCS3412;
bomUTF1 = UniConv.bomUTF1;
bomUTF7 = UniConv.bomUTF7;
bomUTFEBCDIC = UniConv.bomUTFEBCDIC;
bomSCSU = UniConv.bomSCSU;
bomBOCU1 = UniConv.bomBOCU1;
bomGB18030 = UniConv.bomGB18030;
CODEPAGE_UTF7 = UniConv.CODEPAGE_UTF7;
CODEPAGE_UTF8 = UniConv.CODEPAGE_UTF8;
CODEPAGE_UTF16 = UniConv.CODEPAGE_UTF16;
CODEPAGE_UTF16BE = UniConv.CODEPAGE_UTF16BE;
CODEPAGE_UTF32 = UniConv.CODEPAGE_UTF32;
CODEPAGE_UTF32BE = UniConv.CODEPAGE_UTF32BE;
CODEPAGE_UCS2143 = UniConv.CODEPAGE_UCS2143;
CODEPAGE_UCS3412 = UniConv.CODEPAGE_UCS3412;
CODEPAGE_UTF1 = UniConv.CODEPAGE_UTF1;
CODEPAGE_UTFEBCDIC = UniConv.CODEPAGE_UTFEBCDIC;
CODEPAGE_SCSU = UniConv.CODEPAGE_SCSU;
CODEPAGE_BOCU1 = UniConv.CODEPAGE_BOCU1;
CODEPAGE_USERDEFINED = UniConv.CODEPAGE_USERDEFINED;
CODEPAGE_RAWDATA = UniConv.CODEPAGE_RAWDATA;
UNKNOWN_CHARACTER = UniConv.UNKNOWN_CHARACTER;
MAXIMUM_CHARACTER = UniConv.MAXIMUM_CHARACTER;
var
// UniConv "constants"
CODEPAGE_DEFAULT: Word;
DEFAULT_UNICONV_SBCS: PUniConvSBCS;
DEFAULT_UNICONV_SBCS_INDEX: NativeUInt;
type
PCachedStringKind = ^TCachedStringKind;
TCachedStringKind = (csNone, csByte, csUTF16, csUTF32);
PByteString = ^ByteString;
PUTF16String = ^UTF16String;
PUTF32String = ^UTF32String;
ECachedString = class({$ifdef KOL}Exception{$else}EConvertError{$endif})
public
constructor Create(const ResStringRec: PResStringRec); overload;
constructor Create(const ResStringRec: PResStringRec; const Value: PByteString); overload;
constructor Create(const ResStringRec: PResStringRec; const Value: PUTF16String); overload;
constructor Create(const ResStringRec: PResStringRec; const Value: PUTF32String); overload;
end;
PtrString = record
Chars: Pointer;
Length: NativeUInt;
end;
PPtrString = PtrString;
CachedString = record
Chars: Pointer;
Length: NativeUInt;
case Integer of
0: (Flags: Cardinal);
1: (Ascii, References: Boolean; Tag: Byte; SBCSIndex: ShortInt);
2: (NativeFlags: NativeUInt);
end;
PCachedString = ^CachedString;
TCachedEncoding = record
case Integer of
0: (Flags: Cardinal);
1: (CodePage: Word; StringKind: TCachedStringKind; SBCSIndex: ShortInt);
2: (NativeFlags: NativeUInt);
end;
PCachedEncoding = ^TCachedEncoding;
TDigitsRec = packed record
Ascii: array[0..31] of Byte;
Buffer: array[0..15] of Byte;
Quads: array[0..4] of Cardinal;
end;
PDigitsRec = ^TDigitsRec;
{ ByteString record }
ByteString = {$ifdef OPERATORSUPPORT}record{$else}object{$endif}
private
FChars: PAnsiChar;
FLength: NativeUInt;
F: packed record
case Integer of
0: (Flags: Cardinal);
1: (Ascii, References: Boolean; Tag: Byte; SBCSIndex: ShortInt);
2: (NativeFlags: NativeUInt);
end;
function GetEmpty: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetEmpty(Value: Boolean); {$ifdef INLINESUPPORT}inline;{$endif}
function GetSBCS: PUniConvSBCS; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetSBCS(Value: PUniConvSBCS); {$ifdef INLINESUPPORT}inline;{$endif}
function GetUTF8: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetUTF8(Value: Boolean); {$ifdef INLINESUPPORT}inline;{$endif}
function GetEncoding: Word; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetEncoding(CodePage: Word);
function _TrimLeft(S: PByte; L: NativeUInt): Boolean;
function _TrimRight(S: PByte; H: NativeUInt): Boolean;
function _Trim(S: PByte; H: NativeUInt): Boolean;
function _HashIgnoreCaseAscii: Cardinal;
function _HashIgnoreCaseUTF8: Cardinal;
function _HashIgnoreCase(NF: NativeUInt): Cardinal;
function _PosIgnoreCaseUTF8(const S: ByteString; const From: NativeUInt): NativeInt;
function _PosIgnoreCase(const S: ByteString; const From: NativeUInt): NativeInt;
function _GetBool(S: PByte; L: NativeUInt): Boolean;
function _GetHex(S: PByte; L: NativeInt): Integer;
function _GetInt(S: PByte; L: NativeInt): Integer;
function _GetInt_19(S: PByte; L: NativeUInt): NativeInt;
function _GetHex64(S: PByte; L: NativeInt): Int64;
function _GetInt64(S: PByte; L: NativeInt): Int64;
function _GetFloat(S: PByte; L: NativeUInt): Extended;
function _GetDateTime(out Value: TDateTime; DT: NativeUInt): Boolean;
function _GetDateTimeException(DT: NativeUInt): ECachedString;
function _CompareByteString(const S: PByteString; const IgnoreCase: Boolean): NativeInt;
function _CompareUTF16String(const S: PUTF16String; const IgnoreCase: Boolean): NativeInt;
public
property Chars: PAnsiChar read FChars write FChars;
property Length: NativeUInt read FLength write FLength;
property Empty: Boolean read GetEmpty write SetEmpty;
property Ascii: Boolean read F.Ascii write F.Ascii;
property References: Boolean read F.References write F.References;
property Tag: Byte read F.Tag write F.Tag;
property Flags: Cardinal read F.Flags write F.Flags;
property SBCSIndex: ShortInt read F.SBCSIndex write F.SBCSIndex;
property SBCS: PUniConvSBCS read GetSBCS write SetSBCS;
property UTF8: Boolean read GetUTF8 write SetUTF8;
property Encoding: Word read GetEncoding write SetEncoding;
procedure Assign(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure Assign(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}); overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
procedure Assign(const S: UTF8String); overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$else}
procedure AssignUTF8(const S: UTF8String);
{$endif}
procedure Assign(const S: ShortString; const CodePage: Word = 0); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure Assign(const S: TBytes; const CodePage: Word = 0); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure Delete(const From, Count: NativeUInt); {$ifdef INLINESUPPORT}inline;{$endif}
function DetermineAscii: Boolean;
function TrimLeft: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function TrimRight: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function Trim: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function SubString(const From, Count: NativeUInt): ByteString; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function SubString(const Count: NativeUInt): ByteString; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Skip(const Count: NativeUInt): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function Hash: Cardinal;
function HashIgnoreCase: Cardinal; {$ifNdef CPUINTELASM}inline;{$endif}
function CharPos(const C: AnsiChar; const From: NativeUInt = 0): NativeInt;
function CharPosIgnoreCase(const C: AnsiChar; const From: NativeUInt = 0): NativeInt;
function Pos(const S: ByteString; const From: NativeUInt = 0): NativeInt; overload;
function Pos(const AChars: PAnsiChar; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Pos(const S: AnsiString; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const S: ByteString; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const AChars: PAnsiChar; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const S: AnsiString; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
public
function ToBoolean: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToBooleanDef(const Default: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToBoolean(out Value: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHexDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInteger: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToIntegerDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInteger(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinal: Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinalDef(const Default: Cardinal): Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToCardinal(out Value: Cardinal): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInt64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64: UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64Def(const Default: UInt64): UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToUInt64(out Value: UInt64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloat: Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloatDef(const Default: Extended): Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Single): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Double): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$if (not Defined(FPC)) or Defined(EXTENDEDSUPPORT)}
function TryToFloat(out Value: Extended): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifend}
function ToDate: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToDate(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToTime: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToTimeDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToTime(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateTime: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateTimeDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToDateTime(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
public
procedure ToAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToLowerAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToUpperAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToLowerAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToUpperAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToUTF8String(var S: UTF8String); overload;
procedure ToLowerUTF8String(var S: UTF8String); overload;
procedure ToUpperUTF8String(var S: UTF8String); overload;
procedure ToUTF8ShortString(var S: ShortString);
procedure ToLowerUTF8ShortString(var S: ShortString);
procedure ToUpperUTF8ShortString(var S: ShortString);
procedure ToWideString(var S: WideString); overload;
procedure ToLowerWideString(var S: WideString); overload;
procedure ToUpperWideString(var S: WideString); overload;
procedure ToUnicodeString(var S: UnicodeString); overload;
procedure ToLowerUnicodeString(var S: UnicodeString); overload;
procedure ToUpperUnicodeString(var S: UnicodeString); overload;
procedure ToString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure ToLowerString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure ToUpperString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
function ToAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
{$ifdef OPERATORSUPPORT}
class operator Implicit(const a: ByteString): AnsiString; {$ifNdef CPUINTELASM}inline;{$endif}
class operator Implicit(const a: ByteString): WideString; {$ifNdef CPUINTELASM}inline;{$endif}
{$ifdef UNICODE}
class operator Implicit(const a: ByteString): UTF8String; {$ifNdef CPUINTELASM}inline;{$endif}
class operator Implicit(const a: ByteString): UnicodeString; {$ifNdef CPUINTELASM}inline;{$endif}
{$endif}
{$endif}
public
function Equal(const S: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: ByteString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: ByteString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
function Equal(const S: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: UTF8String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: UTF8String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const S: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: UnicodeString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: UnicodeString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$else .AmbiguousOverloadedFix}
function EqualUTF8(const S: UTF8String): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualUTF8IgnoreCase(const S: UTF8String): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareUTF8(const S: UTF8String): NativeInt; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareUTF8IgnoreCase(const S: UTF8String): NativeInt; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
function Equal(const S: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: WideString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: WideString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): Boolean; overload;
function EqualIgnoreCase(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): Boolean; overload;
function Compare(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): NativeInt; overload;
function CompareIgnoreCase(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): NativeInt; overload;
function Equal(const AChars: PUnicodeChar; const ALength: NativeUInt): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const AChars: PUnicodeChar; const ALength: NativeUInt): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const AChars: PUnicodeChar; const ALength: NativeUInt): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const AChars: PUnicodeChar; const ALength: NativeUInt): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef OPERATORSUPPORT}
class operator Equal(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: ByteString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: ByteString; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: ByteString; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
class operator Equal(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: ByteString; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: ByteString; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
class operator Equal(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: AnsiString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: WideString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
class operator Equal(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF8String; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UnicodeString; const b: ByteString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
{$endif}
end;
TByteCharArray = array[0..High(Integer) div SizeOf(Byte) - 1] of Byte;
PByteCharArray = ^TByteCharArray;
{ UTF16String record }
UTF16String = {$ifdef OPERATORSUPPORT}record{$else}object{$endif}
private
FChars: PUnicodeChar;
FLength: NativeUInt;
F: packed record
case Integer of
0: (Flags: Cardinal);
1: (Ascii, References: Boolean; Tag: Byte);
2: (NativeFlags: NativeUInt);
end;
function GetEmpty: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetEmpty(Value: Boolean); {$ifdef INLINESUPPORT}inline;{$endif}
function _TrimLeft(S: PWord; L: NativeUInt): Boolean;
function _TrimRight(S: PWord; H: NativeUInt): Boolean;
function _Trim(S: PWord; H: NativeUInt): Boolean;
function _HashIgnoreCaseAscii: Cardinal;
function _HashIgnoreCase: Cardinal;
function _GetBool(S: PWord; L: NativeUInt): Boolean;
function _GetHex(S: PWord; L: NativeInt): Integer;
function _GetInt(S: PWord; L: NativeInt): Integer;
function _GetInt_19(S: PWord; L: NativeUInt): NativeInt;
function _GetHex64(S: PWord; L: NativeInt): Int64;
function _GetInt64(S: PWord; L: NativeInt): Int64;
function _GetFloat(S: PWord; L: NativeUInt): Extended;
function _GetDateTime(out Value: TDateTime; DT: NativeUInt): Boolean;
function _GetDateTimeException(DT: NativeUInt): ECachedString;
function _CompareUTF16String(const S: PUTF16String; const IgnoreCase: Boolean): NativeInt;
public
property Chars: PUnicodeChar read FChars write FChars;
property Length: NativeUInt read FLength write FLength;
property Empty: Boolean read GetEmpty write SetEmpty;
property Ascii: Boolean read F.Ascii write F.Ascii;
property References: Boolean read F.References write F.References;
property Tag: Byte read F.Tag write F.Tag;
property Flags: Cardinal read F.Flags write F.Flags;
procedure Assign(const AChars: PUnicodeChar; const ALength: NativeUInt); overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef MSWINDOWS}
procedure Assign(const S: WideString); overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
{$ifdef UNICODE}
procedure Assign(const S: UnicodeString); overload; inline;
{$endif}
procedure Delete(const From, Count: NativeUInt); {$ifdef INLINESUPPORT}inline;{$endif}
function DetermineAscii: Boolean;
function TrimLeft: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function TrimRight: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function Trim: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function SubString(const From, Count: NativeUInt): UTF16String; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function SubString(const Count: NativeUInt): UTF16String; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Skip(const Count: NativeUInt): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function Hash: Cardinal;
function HashIgnoreCase: Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function CharPos(const C: UnicodeChar; const From: NativeUInt = 0): NativeInt;
function CharPosIgnoreCase(const C: UnicodeChar; const From: NativeUInt = 0): NativeInt;
function Pos(const S: UTF16String; const From: NativeUInt = 0): NativeInt; overload;
function Pos(const AChars: PUnicodeChar; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Pos(const S: UnicodeString; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const S: UTF16String; const From: NativeUInt = 0): NativeInt; overload;
function PosIgnoreCase(const AChars: PUnicodeChar; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const S: UnicodeString; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
public
function ToBoolean: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToBooleanDef(const Default: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToBoolean(out Value: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHexDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInteger: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToIntegerDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInteger(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinal: Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinalDef(const Default: Cardinal): Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToCardinal(out Value: Cardinal): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInt64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64: UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64Def(const Default: UInt64): UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToUInt64(out Value: UInt64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloat: Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloatDef(const Default: Extended): Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Single): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Double): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$if (not Defined(FPC)) or Defined(EXTENDEDSUPPORT)}
function TryToFloat(out Value: Extended): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifend}
function ToDate: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToDate(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToTime: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToTimeDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToTime(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateTime: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateTimeDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToDateTime(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
public
procedure ToAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToLowerAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToUpperAnsiString(var S: AnsiString; const CodePage: Word = 0); overload;
procedure ToAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToLowerAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToUpperAnsiShortString(var S: ShortString; const CodePage: Word = 0);
procedure ToUTF8String(var S: UTF8String); overload;
procedure ToLowerUTF8String(var S: UTF8String); overload;
procedure ToUpperUTF8String(var S: UTF8String); overload;
procedure ToUTF8ShortString(var S: ShortString);
procedure ToLowerUTF8ShortString(var S: ShortString);
procedure ToUpperUTF8ShortString(var S: ShortString);
procedure ToWideString(var S: WideString); overload;
procedure ToLowerWideString(var S: WideString); overload;
procedure ToUpperWideString(var S: WideString); overload;
procedure ToUnicodeString(var S: UnicodeString); overload;
procedure ToLowerUnicodeString(var S: UnicodeString); overload;
procedure ToUpperUnicodeString(var S: UnicodeString); overload;
procedure ToString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure ToLowerString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure ToUpperString(var S: string); overload; {$ifdef INLINESUPPORT}inline;{$endif}
function ToAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperAnsiString: AnsiString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperUTF8String: UTF8String; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperWideString: WideString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperUnicodeString: UnicodeString; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToLowerString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
function ToUpperString: string; overload; {$ifNdef CPUINTELASM}inline;{$endif}
{$ifdef OPERATORSUPPORT}
class operator Implicit(const a: UTF16String): AnsiString; {$ifNdef CPUINTELASM}inline;{$endif}
class operator Implicit(const a: UTF16String): WideString; {$ifNdef CPUINTELASM}inline;{$endif}
{$ifdef UNICODE}
class operator Implicit(const a: UTF16String): UTF8String; {$ifNdef CPUINTELASM}inline;{$endif}
class operator Implicit(const a: UTF16String): UnicodeString; {$ifNdef CPUINTELASM}inline;{$endif}
{$endif}
{$endif}
public
function Equal(const S: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: UTF16String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: UTF16String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: AnsiString{$ifNdef INTERNALCODEPAGE}; const CodePage: Word = 0{$endif}): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
function Equal(const S: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: UTF8String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: UTF8String): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const S: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: UnicodeString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: UnicodeString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$else .AmbiguousOverloadedFix}
function EqualUTF8(const S: UTF8String): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualUTF8IgnoreCase(const S: UTF8String): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareUTF8(const S: UTF8String): NativeInt; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareUTF8IgnoreCase(const S: UTF8String): NativeInt; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
function Equal(const S: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const S: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const S: WideString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const S: WideString): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Equal(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): Boolean; overload;
function EqualIgnoreCase(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): Boolean; overload;
function Compare(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): NativeInt; overload;
function CompareIgnoreCase(const AChars: PAnsiChar{/PUTF8Char}; const ALength: NativeUInt; const CodePage: Word): NativeInt; overload;
function Equal(const AChars: PUnicodeChar; const ALength: NativeUInt): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function EqualIgnoreCase(const AChars: PUnicodeChar; const ALength: NativeUInt): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Compare(const AChars: PUnicodeChar; const ALength: NativeUInt): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function CompareIgnoreCase(const AChars: PUnicodeChar; const ALength: NativeUInt): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef OPERATORSUPPORT}
class operator Equal(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF16String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF16String; const b: AnsiString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF16String; const b: WideString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
class operator Equal(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF16String; const b: UTF8String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF16String; const b: UnicodeString): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
class operator Equal(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: AnsiString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: WideString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifdef UNICODE}
class operator Equal(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UTF8String; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator Equal(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator NotEqual(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThan(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator GreaterThanOrEqual(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThan(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
class operator LessThanOrEqual(const a: UnicodeString; const b: UTF16String): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$endif}
{$endif}
end;
TUTF16CharArray = array[0..High(Integer) div SizeOf(Word) - 1] of Word;
PUTF16CharArray = ^TUTF16CharArray;
{ UTF32String record }
UTF32String = {$ifdef OPERATORSUPPORT}record{$else}object{$endif}
private
FChars: PUCS4Char;
FLength: NativeUInt;
F: packed record
case Integer of
0: (Flags: Cardinal);
1: (Ascii, References: Boolean; Tag: Byte);
2: (NativeFlags: NativeUInt);
end;
function GetEmpty: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
procedure SetEmpty(Value: Boolean); {$ifdef INLINESUPPORT}inline;{$endif}
function _TrimLeft(S: PCardinal; L: NativeUInt): Boolean;
function _TrimRight(S: PCardinal; H: NativeUInt): Boolean;
function _Trim(S: PCardinal; H: NativeUInt): Boolean;
function _HashIgnoreCaseAscii: Cardinal;
function _HashIgnoreCase: Cardinal;
function _GetBool(S: PCardinal; L: NativeUInt): Boolean;
function _GetHex(S: PCardinal; L: NativeInt): Integer;
function _GetInt(S: PCardinal; L: NativeInt): Integer;
function _GetInt_19(S: PCardinal; L: NativeUInt): NativeInt;
function _GetHex64(S: PCardinal; L: NativeInt): Int64;
function _GetInt64(S: PCardinal; L: NativeInt): Int64;
function _GetFloat(S: PCardinal; L: NativeUInt): Extended;
function _GetDateTime(out Value: TDateTime; DT: NativeUInt): Boolean;
function _GetDateTimeException(DT: NativeUInt): ECachedString;
function _CompareByteString(const S: PByteString; const IgnoreCase: Boolean): NativeInt;
function _CompareUTF16String(const S: PUTF16String; const IgnoreCase: Boolean): NativeInt;
function _CompareUTF32String(const S: PUTF32String; const IgnoreCase: Boolean): NativeInt;
public
property Chars: PUCS4Char read FChars write FChars;
property Length: NativeUInt read FLength write FLength;
property Empty: Boolean read GetEmpty write SetEmpty;
property Ascii: Boolean read F.Ascii write F.Ascii;
property References: Boolean read F.References write F.References;
property Tag: Byte read F.Tag write F.Tag;
property Flags: Cardinal read F.Flags write F.Flags;
procedure Assign(const AChars: PUCS4Char; const ALength: NativeUInt); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure Assign(const S: UCS4String; const NullTerminated: Boolean = True); overload; {$ifdef INLINESUPPORT}inline;{$endif}
procedure Delete(const From, Count: NativeUInt); {$ifdef INLINESUPPORT}inline;{$endif}
function DetermineAscii: Boolean;
function TrimLeft: Boolean;
function TrimRight: Boolean;
function Trim: Boolean;
function SubString(const From, Count: NativeUInt): UTF32String; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function SubString(const Count: NativeUInt): UTF32String; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Skip(const Count: NativeUInt): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function Hash: Cardinal;
function HashIgnoreCase: Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function CharPos(const C: UCS4Char; const From: NativeUInt = 0): NativeInt;
function CharPosIgnoreCase(const C: UCS4Char; const From: NativeUInt = 0): NativeInt;
function Pos(const S: UTF32String; const From: NativeUInt = 0): NativeInt; overload;
function Pos(const AChars: PUCS4Char; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function Pos(const S: UCS4String; const From: NativeUInt = 0): NativeInt; overload;
function PosIgnoreCase(const S: UTF32String; const From: NativeUInt = 0): NativeInt; overload;
function PosIgnoreCase(const AChars: PUCS4Char; const ALength: NativeUInt; const From: NativeUInt = 0): NativeInt; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function PosIgnoreCase(const S: UCS4String; const From: NativeUInt = 0): NativeInt; overload;
public
function ToBoolean: Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToBooleanDef(const Default: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToBoolean(out Value: Boolean): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHexDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInteger: Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function ToIntegerDef(const Default: Integer): Integer; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInteger(out Value: Integer): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinal: Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function ToCardinalDef(const Default: Cardinal): Cardinal; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToCardinal(out Value: Cardinal): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToHex64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToHex64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64: Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToInt64Def(const Default: Int64): Int64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToInt64(out Value: Int64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64: UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function ToUInt64Def(const Default: UInt64): UInt64; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToUInt64(out Value: UInt64): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloat: Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function ToFloatDef(const Default: Extended): Extended; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Single): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToFloat(out Value: Double): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$if (not Defined(FPC)) or Defined(EXTENDEDSUPPORT)}
function TryToFloat(out Value: Extended): Boolean; overload; {$ifdef INLINESUPPORT}inline;{$endif}
{$ifend}
function ToDate: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function ToDateDef(const Default: TDateTime): TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}
function TryToDate(out Value: TDateTime): Boolean; {$ifdef INLINESUPPORT}inline;{$endif}
function ToTime: TDateTime; {$ifdef INLINESUPPORT}inline;{$endif}