Pārlūkot izejas kodu

* Patch for "formatsettings" overloads of currency functions, mantis 15067

git-svn-id: trunk@14162 -
marco 15 gadi atpakaļ
vecāks
revīzija
5163b44ac6
2 mainītis faili ar 29 papildinājumiem un 0 dzēšanām
  1. 25 0
      rtl/objpas/sysutils/sysstr.inc
  2. 4 0
      rtl/objpas/sysutils/sysstrh.inc

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

@@ -1691,6 +1691,13 @@ begin
   Result:=FloatToStrF(Value,ffGeneral,-1,0);
 end;
 
+
+Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
+begin
+  Result:=FloatToStrF(Value,ffGeneral,-1,0,FormatSettings);
+end;  
+
+
 function StrToCurr(const S: string): Currency;
 begin
   if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
@@ -1698,18 +1705,36 @@ begin
 end;
 
 
+function StrToCurr(const S: string; Const FormatSettings: TFormatSettings): Currency; 
+begin
+  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
+    Raise EConvertError.createfmt(SInValidFLoat,[S]);
+end;
+
+
 Function TryStrToCurr(Const S : String; Out Value: Currency): Boolean;
 Begin
   Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency);
 End;
 
 
+function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings: TFormatSettings): Boolean;       
+Begin
+  Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency,FormatSettings);
+End;  
+
+
 function StrToCurrDef(const S: string; Default : Currency): Currency;
 begin
   if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
     Result:=Default;
 end;
 
+function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;  
+begin
+  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
+    Result:=Default;
+end; 
 {$endif FPUNONE}
 
 function AnsiDequotedStr(const S: string; AQuote: Char): string;

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

@@ -195,9 +195,13 @@ Function FloattoCurr (Const Value : Extended) : Currency;
 function TryFloatToCurr(const Value: Extended; var AResult: Currency): Boolean;
 
 Function CurrToStr(Value: Currency): string;
+Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
 function StrToCurr(const S: string): Currency;
+function StrToCurr(const S: string; Const FormatSettings: TFormatSettings): Currency;  
 function TryStrToCurr(const S: string;Out Value : Currency): Boolean;
+function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings: TFormatSettings): Boolean;       
 function StrToCurrDef(const S: string; Default : Currency): Currency;
+function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;  
 
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar; FormatSettings : TFormatSettings): Integer;
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;