@@ -38,13 +38,17 @@ TDataValidatorContext<T: IInterface> = class(TInterfacedObject, IDataValidator
38
38
function Contains (const AValueContains: string; const ACaseSensitive: Boolean = False): T; overload;
39
39
function IsAlpha (const ALocaleLanguage: TDataValidatorLocaleLanguage = tl_en_US): T;
40
40
function IsAlphaNumeric (const ALocaleLanguage: TDataValidatorLocaleLanguage = tl_en_US): T;
41
+ function IsAscii (): T;
42
+ function IsBase32 (): T;
43
+ function IsBase58 (): T;
41
44
function IsBase64 (): T;
42
45
function IsBetween (const AValueA: Integer; const AValueB: Integer): T; overload;
43
46
function IsBetween (const AValueA: Int64; const AValueB: Int64): T; overload;
44
47
function IsBetween (const AValueA: Double; const AValueB: Double): T; overload;
45
48
function IsBetween (const AValueA: Extended; const AValueB: Extended): T; overload;
46
49
function IsBetween (const AValueA: Single; const AValueB: Single): T; overload;
47
50
function IsBetween (const AValueA: UInt64; const AValueB: UInt64): T; overload;
51
+ function IsBoolean (): T;
48
52
function IsBTCAddress (): T;
49
53
function IsCEP (): T;
50
54
function IsCNPJ (): T;
@@ -63,19 +67,27 @@ TDataValidatorContext<T: IInterface> = class(TInterfacedObject, IDataValidator
63
67
function IsEthereumAddress (): T;
64
68
function IsGreaterThan (const AValueGreaterThan: Integer): T;
65
69
function IsHexadecimal (): T;
70
+ function IsHexColor (): T;
66
71
function IsInteger (): T;
67
72
function IsIP (): T;
73
+ function IsISO8601 (): T;
68
74
function IsJSON (): T;
69
75
function IsLength (const AMin: Integer; const AMax: Integer): T;
70
76
function IsLessThan (const AValueLessThan: Integer): T;
77
+ function IsLocale (): T;
71
78
function IsLowercase (): T;
72
79
function IsMACAddress (): T;
80
+ function IsMagnetURI (): T;
73
81
function IsMD5 (): T;
82
+ function IsMimeType (): T;
74
83
function IsNegative (): T;
75
84
function IsNumeric (): T;
85
+ function IsOctal (): T;
86
+ function IsOptional (): T;
87
+ function IsPassportNumber (const ALocaleLanguage: TDataValidatorLocaleLanguage = tl_en_US): T;
76
88
function IsPhoneNumber (const ALocaleLanguage: TDataValidatorLocaleLanguage = tl_en_US): T;
77
89
function IsPositive (): T;
78
- function IsOptional (): T;
90
+ function IsRGBColor (): T;
79
91
function IsSSN (): T;
80
92
function IsTime (const AJSONISO8601ReturnUTC: Boolean = True): T;
81
93
function IsTimeBetween (const AValueA: TTime; const AValueB: TTime; const AJSONISO8601ReturnUTC: Boolean = True): T;
@@ -163,8 +175,12 @@ implementation
163
175
Validator.Custom,
164
176
Validator.IsAlpha,
165
177
Validator.IsAlphaNumeric,
178
+ Validator.IsAscii,
179
+ Validator.IsBase32,
180
+ Validator.IsBase58,
166
181
Validator.IsBase64,
167
182
Validator.IsBetween,
183
+ Validator.IsBoolean,
168
184
Validator.IsBTCAddress,
169
185
Validator.IsCEP,
170
186
Validator.IsCNPJ,
@@ -183,18 +199,26 @@ implementation
183
199
Validator.IsPhoneNumber,
184
200
Validator.IsGreaterThan,
185
201
Validator.IsHexadecimal,
202
+ Validator.IsHexColor,
186
203
Validator.IsInteger,
187
204
Validator.IsIP,
205
+ Validator.IsISO8601,
188
206
Validator.IsJSON,
189
207
Validator.IsLength,
190
208
Validator.IsLessThan,
209
+ Validator.IsLocale,
191
210
Validator.IsLowercase,
192
211
Validator.IsMACAddress,
212
+ Validator.IsMagnetURI,
193
213
Validator.IsMD5,
214
+ Validator.IsMimeType,
194
215
Validator.IsNegative,
195
216
Validator.IsNumeric,
217
+ Validator.IsOctal,
196
218
Validator.IsOptional,
219
+ Validator.IsPassportNumber,
197
220
Validator.IsPositive,
221
+ Validator.IsRGBColor,
198
222
Validator.IsSSN,
199
223
Validator.IsTime,
200
224
Validator.IsTimeBetween,
@@ -300,6 +324,21 @@ function TDataValidatorContext<T>.IsAlphaNumeric(const ALocaleLanguage: TDataVal
300
324
Result := Add(TValidatorIsAlphaNumeric.Create(' Value is not alphanumeric!' ), ALocaleLanguage);
301
325
end ;
302
326
327
+ function TDataValidatorContext <T>.IsAscii: T;
328
+ begin
329
+ Result := Add(TValidatorIsAscii.Create(' Value is not ascii!' ));
330
+ end ;
331
+
332
+ function TDataValidatorContext <T>.IsBase32: T;
333
+ begin
334
+ Result := Add(TValidatorIsBase32.Create(' Value is not base32!' ));
335
+ end ;
336
+
337
+ function TDataValidatorContext <T>.IsBase58: T;
338
+ begin
339
+ Result := Add(TValidatorIsBase58.Create(' Value is not base58!' ));
340
+ end ;
341
+
303
342
function TDataValidatorContext <T>.IsBase64: T;
304
343
begin
305
344
Result := Add(TValidatorIsBase64.Create(' Value is not base64!' ));
@@ -335,6 +374,11 @@ function TDataValidatorContext<T>.IsBetween(const AValueA, AValueB: UInt64): T;
335
374
Result := Add(TValidatorIsBetween.Create(AValueA, AValueB, Format(' Value is not between %s and %s!' , [VarToStr(AValueA), VarToStr(AValueB)])));
336
375
end ;
337
376
377
+ function TDataValidatorContext <T>.IsBoolean: T;
378
+ begin
379
+ Result := Add(TValidatorIsBoolean.Create(' Value is not boolean!' ));
380
+ end ;
381
+
338
382
function TDataValidatorContext <T>.IsBTCAddress: T;
339
383
begin
340
384
Result := Add(TValidatorIsBTCAddress.Create(' Value is not BTC (Bitcoin) Adddress!' ));
@@ -432,6 +476,11 @@ function TDataValidatorContext<T>.IsHexadecimal: T;
432
476
Result := Add(TValidatorIsHexadecimal.Create(' Value is not hexadecimal!' ));
433
477
end ;
434
478
479
+ function TDataValidatorContext <T>.IsHexColor: T;
480
+ begin
481
+ Result := Add(TValidatorIsHexColor.Create(' Value is not HexColor!' ));
482
+ end ;
483
+
435
484
function TDataValidatorContext <T>.IsInteger: T;
436
485
begin
437
486
Result := Add(TValidatorIsInteger.Create(' Value is not integer!' ));
@@ -442,6 +491,11 @@ function TDataValidatorContext<T>.IsIP: T;
442
491
Result := Add(TValidatorIsIP.Create(' Value is not IP (Internet Protocol)!' ));
443
492
end ;
444
493
494
+ function TDataValidatorContext <T>.IsISO8601: T;
495
+ begin
496
+ Result := Add(TValidatorIsISO8601.Create(' Value is not in the format ISO8601!' ));
497
+ end ;
498
+
445
499
function TDataValidatorContext <T>.IsJSON: T;
446
500
begin
447
501
Result := Add(TValidatorIsJSON.Create(' Value is not JSON (JavaScript Object Notation)!' ));
@@ -457,6 +511,11 @@ function TDataValidatorContext<T>.IsLessThan(const AValueLessThan: Integer): T;
457
511
Result := Add(TValidatorIsLessThan.Create(AValueLessThan, Format(' Value is not less than %d!' , [AValueLessThan])));
458
512
end ;
459
513
514
+ function TDataValidatorContext <T>.IsLocale: T;
515
+ begin
516
+ Result := Add(TValidatorIsLocale.Create(' Value is not locale!' ));
517
+ end ;
518
+
460
519
function TDataValidatorContext <T>.IsLowercase: T;
461
520
begin
462
521
Result := Add(TValidatorIsLowercase.Create(' Value is not lowercase!' ));
@@ -467,11 +526,21 @@ function TDataValidatorContext<T>.IsMACAddress: T;
467
526
Result := Add(TValidatorIsMACAddress.Create(' Value is not MAC (Media Access Control) address!' ));
468
527
end ;
469
528
529
+ function TDataValidatorContext <T>.IsMagnetURI: T;
530
+ begin
531
+ Result := Add(TValidatorIsMagnetURI.Create(' Value is not Magnet URI!' ));
532
+ end ;
533
+
470
534
function TDataValidatorContext <T>.IsMD5: T;
471
535
begin
472
536
Result := Add(TValidatorIsMD5.Create(' Value is not MD5!' ));
473
537
end ;
474
538
539
+ function TDataValidatorContext <T>.IsMimeType: T;
540
+ begin
541
+ Result := Add(TValidatorIsMimeType.Create(' Value is not MimeType!' ));
542
+ end ;
543
+
475
544
function TDataValidatorContext <T>.IsNegative: T;
476
545
begin
477
546
Result := Add(TValidatorIsNegative.Create(' Value is not negative!' ));
@@ -482,11 +551,21 @@ function TDataValidatorContext<T>.IsNumeric: T;
482
551
Result := Add(TValidatorIsNumeric.Create(' Value is not numeric!' ));
483
552
end ;
484
553
554
+ function TDataValidatorContext <T>.IsOctal: T;
555
+ begin
556
+ Result := Add(TValidatorIsOctal.Create(' Value not is octal!' ));
557
+ end ;
558
+
485
559
function TDataValidatorContext <T>.IsOptional: T;
486
560
begin
487
561
Result := Add(TValidatorIsOptional.Create(' Value is optional!' ));
488
562
end ;
489
563
564
+ function TDataValidatorContext <T>.IsPassportNumber(const ALocaleLanguage: TDataValidatorLocaleLanguage): T;
565
+ begin
566
+ Result := Add(TValidatorIsPassportNumber.Create(' Value is not passport number!' ), ALocaleLanguage);
567
+ end ;
568
+
490
569
function TDataValidatorContext <T>.IsPhoneNumber(const ALocaleLanguage: TDataValidatorLocaleLanguage): T;
491
570
begin
492
571
Result := Add(TValidatorIsPhoneNumber.Create(' Value is not phone number!' ), ALocaleLanguage);
@@ -497,6 +576,11 @@ function TDataValidatorContext<T>.IsPositive: T;
497
576
Result := Add(TValidatorIsPositive.Create(' Value is not positive!' ));
498
577
end ;
499
578
579
+ function TDataValidatorContext <T>.IsRGBColor: T;
580
+ begin
581
+ Result := Add(TValidatorIsRGBColor.Create(' Value is not RGB Color (Red, Green, Blue)!' ));
582
+ end ;
583
+
500
584
function TDataValidatorContext <T>.IsSSN: T;
501
585
begin
502
586
Result := Add(TValidatorIsSSN.Create(' Value is not SSN (Social Security Number)!' ));
@@ -574,7 +658,7 @@ function TDataValidatorContext<T>.IsZero: T;
574
658
575
659
function TDataValidatorContext <T>.RegexIsMatch(const ARegex: string): T;
576
660
begin
577
- Result := Add(TValidatorRegexIsMatch.Create(ARegex, ' Value is not match!' ));
661
+ Result := Add(TValidatorRegexIsMatch.Create(ARegex, ' Value not match!' ));
578
662
end ;
579
663
580
664
function TDataValidatorContext <T>.&Not : T;
0 commit comments