Преглед на файлове

Fix for Mantis #30734: Implement Delphi-compatible functions StrToUInt64(), StrToUInt64Def and TryStrToUInt64 as inline forwarders to the existing respective QWord functions

git-svn-id: trunk@34710 -
svenbarth преди 8 години
родител
ревизия
63f0c7a2c3
променени са 2 файла, в които са добавени 18 реда и са изтрити 0 реда
  1. 15 0
      rtl/objpas/sysutils/sysstr.inc
  2. 3 0
      rtl/objpas/sysutils/sysstrh.inc

+ 15 - 0
rtl/objpas/sysutils/sysstr.inc

@@ -928,6 +928,11 @@ begin
   if Error <> 0 then raise EConvertError.createfmt(SInvalidInteger,[S]);
 end;
 
+function StrToUInt64(const s: string): UInt64;
+begin
+  result:=StrToQWord(s);
+end;
+
 function StrToDWord(const s: string): DWord;
 var Error: word;
 begin
@@ -949,6 +954,11 @@ begin
   TryStrToQWord:=Error=0
 end;
 
+function TryStrToUInt64(const s: string; Out u: UInt64): boolean;
+begin
+  result:=TryStrToQWord(s,u);
+end;
+
 {   StrToIntDef converts the string S to an integer value,
     Default is returned in case S does not represent a valid integer value  }
 
@@ -989,6 +999,11 @@ begin
   if Error <> 0 then result := Default;
 end;
 
+function StrToUInt64Def(const S: string; Default: UInt64): UInt64;
+begin
+  result:=StrToQWordDef(S,Default);
+end;
+
 {   LoadStr returns the string resource Ident.   }
 
 function LoadStr(Ident: integer): string;

+ 3 - 0
rtl/objpas/sysutils/sysstrh.inc

@@ -122,14 +122,17 @@ function StrToInt(const s: string): Longint;
 function StrToDWord(const s: string): DWord;
 function StrToInt64(const s: string): int64;
 function StrToQWord(const s: string): QWord;
+function StrToUInt64(const s: string): UInt64; inline;
 function TryStrToInt(const s: string; Out i : Longint) : boolean;
 function TryStrToDWord(const s: string; Out D : DWord) : boolean;
 function TryStrToInt64(const s: string; Out i : int64) : boolean;
 function TryStrToQWord(const s: string; Out Q : QWord) : boolean;
+function TryStrToUInt64(const s: string; Out u : UInt64) : boolean; inline;
 function StrToIntDef(const S: string; Default: Longint): Longint;
 function StrToDWordDef(const S: string; Default: DWord): DWord;
 function StrToInt64Def(const S: string; Default: int64): int64;
 function StrToQWordDef(const S: string; Default: QWord): QWord;
+function StrToUInt64Def(const S: string; Default: UInt64): UInt64; inline;
 function LoadStr(Ident: integer): string;
 // function FmtLoadStr(Ident: integer; const Args: array of const): string;
 Function Format (Const Fmt : String; const Args : Array of const) : String;