|
@@ -45,7 +45,11 @@ procedure ParseCSSValues(const s: String; css: TStrings);
|
|
procedure GetCssAbsBoundsRect(Css: TStrings; var r: TRect);
|
|
procedure GetCssAbsBoundsRect(Css: TStrings; var r: TRect);
|
|
function CssValInt(const s: String; Def: integer): Integer;
|
|
function CssValInt(const s: String; Def: integer): Integer;
|
|
|
|
|
|
-function ScanNumberC(const buf: string; var idx: Integer; var numberText: string): Boolean;
|
|
|
|
|
|
+type
|
|
|
|
+ TCNumberFormat = (nfError, nfInteger, nfHex, nfFloat);
|
|
|
|
+
|
|
|
|
+function ScanNumberC(const buf: string; var idx: Integer;
|
|
|
|
+ var numberText: string): TCNumberFormat;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
@@ -233,11 +237,13 @@ begin
|
|
Result:=Copy(s, i, index-i);
|
|
Result:=Copy(s, i, index-i);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function ScanNumberC(const buf: string; var idx: Integer; var numberText: string): Boolean;
|
|
|
|
|
|
+function ScanNumberC(const buf: string; var idx: Integer; var numberText: string): TCNumberFormat;
|
|
var
|
|
var
|
|
ch : char;
|
|
ch : char;
|
|
|
|
+ sec : string;
|
|
begin
|
|
begin
|
|
- Result := false;
|
|
|
|
|
|
+ Result := nfError;
|
|
|
|
+
|
|
if buf[idx] in SignChars then begin
|
|
if buf[idx] in SignChars then begin
|
|
ch:=buf[idx];
|
|
ch:=buf[idx];
|
|
inc(idx);
|
|
inc(idx);
|
|
@@ -247,14 +253,23 @@ begin
|
|
if (idx<length(buf)) and (buf[idx]='0') and (buf[idx+1]='x') then begin
|
|
if (idx<length(buf)) and (buf[idx]='0') and (buf[idx+1]='x') then begin
|
|
inc(idx,2);
|
|
inc(idx,2);
|
|
numberText:='0x'+ScanWhile(buf, idx, HexChars);
|
|
numberText:='0x'+ScanWhile(buf, idx, HexChars);
|
|
- end else
|
|
|
|
|
|
+ Result := nfHex;
|
|
|
|
+ end else begin
|
|
numberText:=ScanWhile(buf, idx, NumericChars);
|
|
numberText:=ScanWhile(buf, idx, NumericChars);
|
|
|
|
+ if ((idx<=length(buf)) and (buf[idx]='.')) then begin
|
|
|
|
+ inc(idx);
|
|
|
|
+ sec := ScanWhile(buf, idx, NumericChars);
|
|
|
|
+ if (sec = '') then Exit;
|
|
|
|
+ numberText:=NumberText+'.'+sec;
|
|
|
|
+ Result := nfFloat;
|
|
|
|
+ end else
|
|
|
|
+ Result := nfInteger;
|
|
|
|
+ end;
|
|
|
|
|
|
if (ch<>#0) then begin
|
|
if (ch<>#0) then begin
|
|
if (numberText = '') then Exit;
|
|
if (numberText = '') then Exit;
|
|
numberText:=ch+numberText;
|
|
numberText:=ch+numberText;
|
|
end;
|
|
end;
|
|
- Result := true;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
end.
|
|
end.
|