home *** CD-ROM | disk | FTP | other *** search
- unit NamedValuesList;
-
- interface
- uses
- LangValue,ObjStr;
- type TNamedValuesList=class
- protected
- fItems:TObjectStrings;
- function rdItems(No:integer):ILangValue;
- function rdNames(No:Integer):string;
- public
- constructor Create;
- destructor Destroy;override;
- property Items[No:integer]:ILangValue read rdItems;default;
- property Names[No:integer]:string read rdNames;
- function Count:integer;
- function ValByName(const a:string):ILangValue;
- procedure Add(const Name:string;a:ILangValue);
- procedure DeleteValue(a:ILangValue);
- end;
- implementation
- function TNamedValuesList.rdItems;
- begin
- Result:=fItems.Objects[No] as ILangValue;
- end;
- function TNamedValuesList.rdNames;
- begin
- Result:=fItems[No];
- end;
- constructor TNamedValuesList.Create;
- begin
- Inherited Create;
- fItems:=TObjectStrings.Create;
- end;
- destructor TNamedValuesList.Destroy;
- begin
- fItems.Free;
- Inherited Destroy;
- end;
- function TNamedValuesList.Count;
- begin
- Result:=fItems.Count;
- end;
- function TNamedValuesList.ValByName;
- Var i:Integer;
- begin
- i:=fItems.IndexOf(a);
- if i=-1 then
- Result:=nil
- else
- Result:=fItems.Objects[i] as ILangValue;
- end;
- procedure TNamedValuesList.Add;
- begin
- fItems.AddObject(Name,a);
- end;
- procedure TNamedValuesList.DeleteValue(a:ILangValue);
- begin
- fItems.Remove(fItems.IndexOfObject(a));
- end;
-
- end.
-