home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Plus! (NZ) 2001 June
/
HDC50.iso
/
Runimage
/
Delphi50
/
Doc
/
CONTNRS.INT
< prev
next >
Wrap
Text File
|
1999-08-11
|
3KB
|
122 lines
{*******************************************************}
{ }
{ Borland Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,99 Inprise Corporation }
{ }
{*******************************************************}
unit Contnrs;
interface
uses
SysUtils, Classes;
type
{ TObjectList class }
TObjectList = class(TList)
protected
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
function GetItem(Index: Integer): TObject;
procedure SetItem(Index: Integer; AObject: TObject);
public
constructor Create; overload;
constructor Create(AOwnsObjects: Boolean); overload;
function Add(AObject: TObject): Integer;
function Remove(AObject: TObject): Integer;
function IndexOf(AObject: TObject): Integer;
function FindInstanceOf(AClass: TClass; AExact: Boolean = True; AStartAt: Integer = 0): Integer;
procedure Insert(Index: Integer; AObject: TObject);
property OwnsObjects: Boolean;
property Items[Index: Integer]: TObject; default;
end;
{ TComponentList class }
TComponentList = class(TObjectList)
protected
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
function GetItems(Index: Integer): TComponent;
procedure SetItems(Index: Integer; AComponent: TComponent);
procedure HandleFreeNotify(Sender: TObject; AComponent: TComponent);
public
destructor Destroy; override;
function Add(AComponent: TComponent): Integer;
function Remove(AComponent: TComponent): Integer;
function IndexOf(AComponent: TComponent): Integer;
procedure Insert(Index: Integer; AComponent: TComponent);
property Items[Index: Integer]: TComponent; default;
end;
{ TClassList class }
TClassList = class(TList)
protected
function GetItems(Index: Integer): TClass;
procedure SetItems(Index: Integer; AClass: TClass);
public
function Add(aClass: TClass): Integer;
function Remove(aClass: TClass): Integer;
function IndexOf(aClass: TClass): Integer;
procedure Insert(Index: Integer; aClass: TClass);
property Items[Index: Integer]: TClass; default;
end;
{ TOrdered class }
TOrderedList = class(TObject)
protected
procedure PushItem(AItem: Pointer); virtual; abstract;
function PopItem: Pointer; virtual;
function PeekItem: Pointer; virtual;
property List: TList;
public
constructor Create;
destructor Destroy; override;
function Count: Integer;
function AtLeast(ACount: Integer): Boolean;
procedure Push(AItem: Pointer);
function Pop: Pointer;
function Peek: Pointer;
end;
{ TStack class }
TStack = class(TOrderedList)
protected
procedure PushItem(AItem: Pointer); override;
end;
{ TObjectStack class }
TObjectStack = class(TStack)
public
procedure Push(AObject: TObject);
function Pop: TObject;
function Peek: TObject;
end;
{ TQueue class }
TQueue = class(TOrderedList)
protected
procedure PushItem(AItem: Pointer); override;
end;
{ TObjectQueue class }
TObjectQueue = class(TQueue)
public
procedure Push(AObject: TObject);
function Pop: TObject;
function Peek: TObject;
end;
implementation