LazReport: Delete old deprecated UTF8 functions.

git-svn-id: trunk@59229 -
This commit is contained in:
juha 2018-10-02 13:29:46 +00:00
parent 53541c694b
commit fc85354010
2 changed files with 2 additions and 110 deletions

View File

@ -103,9 +103,9 @@ var
end else
begin
if s = '' then
s := LazUTF8.UTF8Quotedstr(aStr, QuoteChar)
s := UTF8Quotedstr(aStr, QuoteChar)
else
s := s + Separator + LazUTF8.UTF8Quotedstr(aStr, QuoteChar);
s := s + Separator + UTF8Quotedstr(aStr, QuoteChar);
end;
end;

View File

@ -77,12 +77,7 @@ procedure CanvasTextRectJustify(const Canvas:TCanvas;
Trimmed: boolean);
// utf8 tools
function UTF8Desc(S:string; var Desc: string): Integer; deprecated;
function UTF8Char(S:string; index:Integer; Desc:string): TUTF8Char; deprecated;
function UTF8Range(S:string; index,count:Integer; Desc:String):string; deprecated;
function UTF8Index(index:integer; desc:string): Integer; deprecated;
function UTF8CharIn(ch:TUTF8Char; const arrstr:array of string): boolean;
function UTF8QuotedStr(s:string; Quote: TUTF8Char; desc:string=''): string; deprecated;
function PosLast(SubChr:char; const Source:string):integer;
function UTF8CountWords(const str:string; out WordCount,SpcCount,SpcSize:Integer): TArrUTF8Item;
@ -964,83 +959,6 @@ begin
result := AValue;
end;
function UTF8Desc(S: string; var Desc: string): Integer;
// create Desc as an array with Desc[i] is the size of the UTF-8 codepoint
var
i,b: Integer;
begin
i := 1;
Result := 0;
SetLength(Desc, Length(S));
while i<=Length(s) do begin
b := UTF8CodepointStrictSize(@S[i]);
inc(i,b);
inc(Result);
Desc[Result] := Char(b);
end;
Setlength(Desc, Result);
end;
function UTF8Char(S: string; index: Integer; Desc: string): TUTF8Char;
var
i,j: Integer;
begin
Result := '';
if (index<1) or (index>Length(Desc)) then begin
//Result := #$EF#$BF#$BD // replacement character
exit;
end;
i:=0; j:=1;
while i<Length(Desc) do begin
inc(i);
if i=index then begin
Move(S[j],Result[1],ord(Desc[i]));
Result[0]:=Desc[i];
break;
end;
inc(j, ord(Desc[i]));
end;
end;
function UTF8Range(S: string; index, count: Integer; Desc: String
): string;
var
c,i: Integer;
begin
result := '';
c := 0;
i := index;
while (Count>0) and (i<=Length(Desc)) do begin
c := c + ord(Desc[i]);
inc(i);
Dec(Count);
end;
i := {%H-}UTF8Index(Index, Desc);
if i>0 then begin
SetLength(Result, c);
Move(S[i],Result[1],c);
end;
end;
// this assume index is in valid range
function UTF8Index(index: integer; desc: string): Integer;
var
i,c: integer;
begin
result := 0;
c := 0;
for i:=1 to Length(Desc) do begin
inc(c);
if i=index then begin
result := c;
break;
end;
c := c + ord(Desc[i]) - 1;
end;
end;
function UTF8CharIn(ch:TUTF8Char; const arrstr: array of string): boolean;
var
i: Integer;
@ -1053,32 +971,6 @@ begin
end;
end;
// converted from FPC AnsiQuotedStr()
function UTF8QuotedStr(s: string; Quote: TUTF8Char; desc:string=''): string;
var
i, j, count: integer;
begin
result := '' + Quote;
if desc='' then
count := {%H-}UTF8Desc(s, desc)
else
count := length(s);
i := 0;
j := 0;
while i < count do begin
i := i + 1;
if {%H-}UTF8Char(s,i,desc) = Quote then begin
result := result + {%H-}UTF8Range(S, 1 + j, i - j, desc) + Quote;
j := i;
end;
end;
if i <> j then
result := result + {%H-}UTF8Range(S, 1 + j, i - j, desc);
result := result + Quote;
end ;
function PosLast(SubChr: char; const Source: string): integer;
var
i:integer;