home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / OpList.pas < prev    next >
Pascal/Delphi Source File  |  1999-05-29  |  1KB  |  49 lines

  1.  
  2. unit OpList;
  3.  
  4. interface
  5. uses
  6.      ObjOp,ObjList;
  7. type TOpList=class
  8.      protected
  9.        fList:TObjList;
  10.      public
  11.        constructor Create;
  12.        destructor  Destroy;override;
  13.        procedure Register(OpCode:integer;OpClass:TObjOpClass);
  14.        function  Find(OpCode:integer):TObjOp;
  15.      end;
  16. implementation
  17. constructor TOpList.Create;
  18.             begin
  19.               Inherited Create;
  20.               fList:=TObjList.Create;
  21.             end;
  22. destructor  TOpList.Destroy;
  23.             begin
  24.               fList.Free;
  25.               Inherited Destroy;
  26.             end;
  27. procedure   TOpList.Register;
  28.             Var Op:TObjOp;
  29.             begin
  30.               Op:=OpClass.Create;
  31.               Op.OpCode:=OpCode;
  32.               fList.Add(Op);
  33.             end;
  34. function    TOpList.Find;
  35.             Var i:Integer;
  36.             begin
  37.               Result:=nil;
  38.               for i:=0 to fList.Count-1 do
  39.               begin
  40.                 if (fList.Obj[i] as TObjOp).OpCode=OpCode then
  41.                 begin
  42.                   Result:=fList.Obj[i] as TObjOp;
  43.                   exit;
  44.                 end;
  45.               end;
  46.             end;
  47.  
  48. end.
  49.