mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 23:19:26 +02:00
codetools: TStringTree: enumerator
git-svn-id: trunk@32237 -
This commit is contained in:
parent
160132b781
commit
bfe2e33e1a
@ -147,6 +147,21 @@ type
|
|||||||
constructor Create(CaseInsensitive: boolean); // false = system default
|
constructor Create(CaseInsensitive: boolean); // false = system default
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TStringTree = class;
|
||||||
|
|
||||||
|
{ TStringTreeEnumerator }
|
||||||
|
|
||||||
|
TStringTreeEnumerator = class
|
||||||
|
private
|
||||||
|
FTree: TStringTree;
|
||||||
|
FCurrent: TAVLTreeNode;
|
||||||
|
function GetCurrent: string;
|
||||||
|
public
|
||||||
|
constructor Create(Tree: TStringTree);
|
||||||
|
function MoveNext: boolean;
|
||||||
|
property Current: string read GetCurrent;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TStringTree }
|
{ TStringTree }
|
||||||
|
|
||||||
TStringTree = class
|
TStringTree = class
|
||||||
@ -158,6 +173,7 @@ type
|
|||||||
function FindNode(const s: string): TAVLTreeNode; inline;
|
function FindNode(const s: string): TAVLTreeNode; inline;
|
||||||
procedure ReplaceString(var s: string);
|
procedure ReplaceString(var s: string);
|
||||||
function CalcMemSize: PtrUInt;
|
function CalcMemSize: PtrUInt;
|
||||||
|
function GetEnumerator: TStringTreeEnumerator;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -312,6 +328,27 @@ begin
|
|||||||
Result:=CompareStr(AnsiString(Data1),AnsiString(Data2));
|
Result:=CompareStr(AnsiString(Data1),AnsiString(Data2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TStringTreeEnumerator }
|
||||||
|
|
||||||
|
function TStringTreeEnumerator.GetCurrent: string;
|
||||||
|
begin
|
||||||
|
Result:=AnsiString(FCurrent.Data);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TStringTreeEnumerator.Create(Tree: TStringTree);
|
||||||
|
begin
|
||||||
|
FTree:=Tree;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStringTreeEnumerator.MoveNext: boolean;
|
||||||
|
begin
|
||||||
|
if FCurrent=nil then
|
||||||
|
FCurrent:=FTree.Tree.FindLowest
|
||||||
|
else
|
||||||
|
FCurrent:=FTree.Tree.FindSuccessor(FCurrent);
|
||||||
|
Result:=FCurrent<>nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCodeXYPositions }
|
{ TCodeXYPositions }
|
||||||
|
|
||||||
function TCodeXYPositions.GetItems(Index: integer): PCodeXYPosition;
|
function TCodeXYPositions.GetItems(Index: integer): PCodeXYPosition;
|
||||||
@ -784,6 +821,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TStringTree.GetEnumerator: TStringTreeEnumerator;
|
||||||
|
begin
|
||||||
|
Result:=TStringTreeEnumerator.Create(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TComponentChildCollector }
|
{ TComponentChildCollector }
|
||||||
|
|
||||||
procedure TComponentChildCollector.AddChildComponent(Child: TComponent);
|
procedure TComponentChildCollector.AddChildComponent(Child: TComponent);
|
||||||
|
Loading…
Reference in New Issue
Block a user