This commit is contained in:
csh
2025-04-16 10:03:34 +08:00
parent 87c3aa75f7
commit f816e8b6e3
20 changed files with 27378 additions and 28116 deletions
+27 -6
View File
@@ -6,8 +6,8 @@ public
function Append(data: any): boolean;
function Insert(data: any): boolean;
function InsertAfter(data: any; pos_data: any);
function Get(name: string; index: integer);overload;
function Get(): array of tslobj;overload;
function Get(name: string; index: integer);
function GetElements(include_removed: boolean): array of tslobj;
private
function GetBucketObj(str: string): LinkList;
@@ -24,6 +24,7 @@ public
function Create(name: string);
function Set(data: any);
function Add(data: any);
function Delete(data: any): boolean;
function InsertAfter(data: any; pos_data: any): boolean;
function Name(): string;
function Size(): integer;
@@ -58,7 +59,7 @@ function TSOfficeContainer.Set(data: any): boolean;
begin
obj := {self.}GetBucketObj(data.ElementName);
if ifnil(obj) then return false;
obj.Set(data);
obj.Add(data);
return true;
end;
@@ -125,7 +126,7 @@ begin
end
end;
function TSOfficeContainer.Get(): array of tslobj;overload;
function TSOfficeContainer.GetElements(include_removed: boolean = true): array of tslobj;
begin
arr := array();
for i:=0 to current_index_ do
@@ -136,7 +137,8 @@ begin
node := obj.First();
while ifObj(node) do
begin
arr[length(arr)] := node.data;
if include_removed or not node.data.Removed then
arr[length(arr)] := node.data;
node := node.next;
end
end
@@ -144,7 +146,7 @@ begin
return arr;
end;
function TSOfficeContainer.Get(name: string; index: integer);overload;
function TSOfficeContainer.Get(name: string; index: integer);
begin
ind := child_[name];
arr := array();
@@ -239,6 +241,25 @@ begin
return false;
end;
function LinkList.Delete(data: any): boolean;
begin
node := {self.}First();
prev := nil;
while ifObj(node) do
begin
if node.data = data then
begin
if ifnil(prev) then head_.next := node.next;
else if tail_ = node then tail_ := prev;
else prev.next := node.next;
return true;
end
prev := node;
node := node.next;
end
return false;
end;
function LinkList.Name(): string;
begin
return name_;