📄 jclcontainerintf.pas
字号:
{**************************************************************************************************}
{ }
{ Project JEDI Code Library (JCL) }
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
{ you may not use this file except in compliance with the License. You may obtain a copy of the }
{ License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
{ ANY KIND, either express or implied. See the License for the specific language governing rights }
{ and limitations under the License. }
{ }
{ The Original Code is DCL_intf.pas. }
{ }
{ The Initial Developer of the Original Code is Jean-Philippe BEMPEL aka RDM. Portions created by }
{ Jean-Philippe BEMPEL are Copyright (C) Jean-Philippe BEMPEL (rdm_30 att yahoo dott com) }
{ All rights reserved. }
{ }
{**************************************************************************************************}
{ }
{ The Delphi Container Library }
{ }
{**************************************************************************************************}
// Last modified: $Date: 2005/03/02 17:51:24 $
// For history see end of file
unit JclContainerIntf;
{$I jcl.inc}
interface
uses
Classes,
JclBase;
const
DefaultContainerCapacity = 16;
type
IJclIntfCloneable = interface
['{BCF77740-FB60-4306-9BD1-448AADE5FF4E}']
function Clone: IInterface;
end;
IJclCloneable = interface
['{D224AE70-2C93-4998-9479-1D513D75F2B2}']
function Clone: TObject;
end;
IJclIntfIterator = interface
['{E121A98A-7C43-4587-806B-9189E8B2F106}']
procedure Add(AInterface: IInterface);
function GetObject: IInterface;
function HasNext: Boolean;
function HasPrevious: Boolean;
function Next: IInterface;
function NextIndex: Integer;
function Previous: IInterface;
function PreviousIndex: Integer;
procedure Remove;
procedure SetObject(AInterface: IInterface);
end;
IJclStrIterator = interface
['{D5D4B681-F902-49C7-B9E1-73007C9D64F0}']
procedure Add(const AString: string);
function GetString: string;
function HasNext: Boolean;
function HasPrevious: Boolean;
function Next: string;
function NextIndex: Integer;
function Previous: string;
function PreviousIndex: Integer;
procedure Remove;
procedure SetString(const AString: string);
end;
IJclIterator = interface
['{997DF9B7-9AA2-4239-8B94-14DFFD26D790}']
procedure Add(AObject: TObject);
function GetObject: TObject;
function HasNext: Boolean;
function HasPrevious: Boolean;
function Next: TObject;
function NextIndex: Integer;
function Previous: TObject;
function PreviousIndex: Integer;
procedure Remove;
procedure SetObject(AObject: TObject);
end;
IJclIntfCollection = interface
['{8E178463-4575-487A-B4D5-DC2AED3C7ACA}']
function Add(AInterface: IInterface): Boolean;
function AddAll(ACollection: IJclIntfCollection): Boolean;
procedure Clear;
function Contains(AInterface: IInterface): Boolean;
function ContainsAll(ACollection: IJclIntfCollection): Boolean;
function Equals(ACollection: IJclIntfCollection): Boolean;
function First: IJclIntfIterator;
function IsEmpty: Boolean;
function Last: IJclIntfIterator;
function Remove(AInterface: IInterface): Boolean;
function RemoveAll(ACollection: IJclIntfCollection): Boolean;
function RetainAll(ACollection: IJclIntfCollection): Boolean;
function Size: Integer;
end;
IJclStrCollection = interface
['{3E3CFC19-E8AF-4DD7-91FA-2DF2895FC7B9}']
function Add(const AString: string): Boolean;
function AddAll(ACollection: IJclStrCollection): Boolean;
procedure Clear;
function Contains(const AString: string): Boolean;
function ContainsAll(ACollection: IJclStrCollection): Boolean;
function Equals(ACollection: IJclStrCollection): Boolean;
function First: IJclStrIterator;
function IsEmpty: Boolean;
function Last: IJclStrIterator;
function Remove(const AString: string): Boolean;
function RemoveAll(ACollection: IJclStrCollection): Boolean;
function RetainAll(ACollection: IJclStrCollection): Boolean;
function Size: Integer;
//Daniele Teti 27/12/2004
procedure LoadFromStrings(Strings: TStrings);
procedure SaveToStrings(Strings: TStrings);
procedure AppendToStrings(Strings: TStrings);
procedure AppendFromStrings(Strings: TStrings);
function GetAsStrings: TStrings;
function GetAsDelimited(Separator: string = AnsiLineBreak): string;
procedure AppendDelimited(AString: string; Separator: string = AnsiLineBreak);
procedure LoadDelimited(AString: string; Separator: string = AnsiLineBreak);
end;
IJclCollection = interface
['{58947EF1-CD21-4DD1-AE3D-225C3AAD7EE5}']
function Add(AObject: TObject): Boolean;
function AddAll(ACollection: IJclCollection): Boolean;
procedure Clear;
function Contains(AObject: TObject): Boolean;
function ContainsAll(ACollection: IJclCollection): Boolean;
function Equals(ACollection: IJclCollection): Boolean;
function First: IJclIterator;
function IsEmpty: Boolean;
function Last: IJclIterator;
function Remove(AObject: TObject): Boolean;
function RemoveAll(ACollection: IJclCollection): Boolean;
function RetainAll(ACollection: IJclCollection): Boolean;
function Size: Integer;
end;
IJclIntfList = interface(IJclIntfCollection)
['{E14EDA4B-1DAA-4013-9E6C-CDCB365C7CF9}']
procedure Insert(Index: Integer; AInterface: IInterface); overload;
function InsertAll(Index: Integer; ACollection: IJclIntfCollection): Boolean; overload;
function GetObject(Index: Integer): IInterface;
function IndexOf(AInterface: IInterface): Integer;
function LastIndexOf(AInterface: IInterface): Integer;
function Remove(Index: Integer): IInterface; overload;
procedure SetObject(Index: Integer; AInterface: IInterface);
function SubList(First, Count: Integer): IJclIntfList;
end;
IJclStrList = interface(IJclStrCollection)
['{07DD7644-EAC6-4059-99FC-BEB7FBB73186}']
procedure Insert(Index: Integer; const AString: string); overload;
function InsertAll(Index: Integer; ACollection: IJclStrCollection): Boolean; overload;
function GetString(Index: Integer): string;
function IndexOf(const AString: string): Integer;
function LastIndexOf(const AString: string): Integer;
function Remove(Index: Integer): string; overload;
procedure SetString(Index: Integer; const AString: string);
function SubList(First, Count: Integer): IJclStrList;
//Daniele Teti
property Items[Key: Integer]: string read GetString write SetString; default;
end;
IJclList = interface(IJclCollection)
['{8ABC70AC-5C06-43EA-AFE0-D066379BCC28}']
procedure Insert(Index: Integer; AObject: TObject); overload;
function InsertAll(Index: Integer; ACollection: IJclCollection): Boolean; overload;
function GetObject(Index: Integer): TObject;
function IndexOf(AObject: TObject): Integer;
function LastIndexOf(AObject: TObject): Integer;
function Remove(Index: Integer): TObject; overload;
procedure SetObject(Index: Integer; AObject: TObject);
function SubList(First, Count: Integer): IJclList;
//Daniele Teti
property Items[Key: Integer]: TObject read GetObject write SetObject; default;
end;
IJclIntfArray = interface(IJclIntfList)
['{B055B427-7817-43FC-97D4-AD1845643D63}']
property Items[Index: Integer]: IInterface read GetObject write SetObject;
default;
end;
IJclStrArray = interface(IJclStrList)
['{B055B427-7817-43FC-97D4-AD1845643D63}']
property Items[Index: Integer]: string read GetString write SetString; default;
end;
IJclArray = interface(IJclList)
['{A69F6D35-54B2-4361-852E-097ED75E648A}']
property Items[Index: Integer]: TObject read GetObject write SetObject; default;
end;
IJclIntfSet = interface(IJclIntfCollection)
['{E2D28852-9774-49B7-A739-5DBA2B705924}']
procedure Intersect(ACollection: IJclIntfCollection);
procedure Subtract(ACollection: IJclIntfCollection);
procedure Union(ACollection: IJclIntfCollection);
end;
IJclStrSet = interface(IJclStrCollection)
['{72204D85-2B68-4914-B9F2-09E5180C12E9}']
procedure Intersect(ACollection: IJclStrCollection);
procedure Subtract(ACollection: IJclStrCollection);
procedure Union(ACollection: IJclStrCollection);
end;
IJclSet = interface(IJclCollection)
['{0B7CDB90-8588-4260-A54C-D87101C669EA}']
procedure Intersect(ACollection: IJclCollection);
procedure Subtract(ACollection: IJclCollection);
procedure Union(ACollection: IJclCollection);
end;
TJclTraverseOrder = (toPreOrder, toOrder, toPostOrder);
IJclIntfTree = interface(IJclIntfCollection)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -