Changeset 303 for branches/highdpi/Packages/CevoComponents/StringTables.pas
- Timestamp:
- Mar 9, 2021, 9:19:49 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/StringTables.pas
r210 r303 19 19 function GetHandle(const Item: string): integer; 20 20 function LookupByHandle(Handle: integer; Index: integer = -1): string; 21 function Lookup(const Item: string; Index: integer = -1): string;21 function Lookup(const Item: string; Index: Integer = -1): string; 22 22 function Search(const Content: string; var Handle, Index: integer): boolean; 23 23 end; 24 24 25 25 26 implementation … … 70 71 s: string; 71 72 begin 72 if Index < 0 then 73 if Index < 0 then begin 73 74 if Handle < 0 then begin 74 75 Result := ''; … … 86 87 end; 87 88 Result := S; 88 end else 89 if (Handle + Index + 1) >= Lines.Count then begin 90 Result := ''; 91 Exit; 92 end else Result := Lines[Handle + Index + 1]; 89 end; 90 end else 91 if (Handle + Index + 1) >= Lines.Count then begin 92 Result := ''; 93 Exit; 94 end else Result := Lines[Handle + Index + 1]; 93 95 while (Result <> '') and ((Result[1] = ' ') or (Result[1] = #9)) do 94 96 Delete(Result, 1, 1); … … 99 101 end; 100 102 101 function TStringTable.Lookup(const Item: string; Index: integer): string;103 function TStringTable.Lookup(const Item: string; Index: Integer): string; 102 104 var 103 Handle: integer;105 Handle: Integer; 104 106 begin 105 107 Handle := GetHandle(Item); 106 if Handle >= 0 then 107 result := LookupByHandle(Handle, Index) 108 else 109 result := ''; 110 if result = '' then 111 if Index < 0 then 112 result := Format('[%s]', [Item]) 113 else 114 result := Format('[%s %d]', [Item, Index]) 108 if Handle >= 0 then Result := LookupByHandle(Handle, Index) 109 else Result := ''; 110 if Result = '' then begin 111 if Index < 0 then Result := Format('[%s]', [Item]) 112 else Result := Format('[%s %d]', [Item, Index]); 113 end; 115 114 end; 116 115 … … 153 152 begin 154 153 result := false; 155 exit 154 exit; 156 155 end; 157 156 if Copy(Lines[h + i + 1], 1, 1) = '#' then 158 157 begin 159 158 h := h + i + 1; 160 i := -1 159 i := -1; 161 160 end; 162 161 if (h >= 0) and not ((Length(Lines[h + i + 1]) > 0) and (Lines[h + i + 1][1] in ['#', ':', ';'])) and
Note:
See TracChangeset
for help on using the changeset viewer.