I believe the use of the unit "contnrs" belongs inside the $ifdef
IP_LAZARUS (the entire css functionality seems to be lazarus-only
anyways, so no ifdefs needed in ipcss.inc)

I didn't find any other TStringList yet with such heavy usage of IndexOf().

Bernd
Index: components/turbopower_ipro/ipcss.inc
===================================================================
--- components/turbopower_ipro/ipcss.inc	(Revision 34379)
+++ components/turbopower_ipro/ipcss.inc	(Arbeitskopie)
@@ -96,7 +96,7 @@
  { TCSSGlobalProps }
 
  TCSSGlobalProps = class
-   FElements: TStringList;
+   FElements: TFPObjectHashTable;
  public
    constructor Create;
    destructor Destroy; override;
@@ -482,6 +482,7 @@
   end;
 end;
 
+
 { TCSSReader }
 
 function TCSSReader.GetStatementElements(AStatement: String): TStringList;
@@ -870,15 +871,13 @@
 
 constructor TCSSGlobalProps.Create;
 begin
-  FElements := TStringList.Create;
+  FElements := TFPObjectHashTable.Create(True);
 end;
 
 destructor TCSSGlobalProps.Destroy;
 var
   i: Integer;
 begin
-  for i := 0 to FElements.Count-1 do
-    FElements.Objects[i].Free;
   FElements.Free;
   inherited Destroy;
 end;
@@ -889,21 +888,14 @@
   ElementName: String;
 
   procedure LookForElement(const aElement: string);
-  var
-    ElementIndex: Integer;
   begin
     if length(ClassID) > 0 then
       ElementName := Lowercase(aElement+'.'+ClassId)
     else
       ElementName := lowercase(aElement);
-
-    ElementIndex := FElements.IndexOf(ElementName);
-
-    if ElementIndex>=0 then begin
-      result := TCSSProps(FElements.Objects[ElementIndex]);
-    end;
-
+    Result := TCSSProps(FElements.Items[ElementName]);
   end;
+
 begin
   Result := nil;
   if (length(ClassID) = 0) and (length(AElementID) = 0) then
@@ -916,7 +908,7 @@
   if (Result = nil) and CreateIfNotExist then
   begin
     Result := TCSSProps.Create;
-    FElements.AddObject(ElementName, Result);
+    FElements.Add(ElementName, Result);
   end;
 end;
 
Index: components/turbopower_ipro/iphtml.pas
===================================================================
--- components/turbopower_ipro/iphtml.pas	(Revision 34379)
+++ components/turbopower_ipro/iphtml.pas	(Arbeitskopie)
@@ -63,6 +63,7 @@
   Translations,
   FileUtil,
   LConvEncoding,
+  contnrs,
   {$ELSE}
   Windows,
   {$ENDIF}
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to