📄 wwstacks.pas
字号:
unit wwStacks;
{
//
// Simple stack classes to support the parsing of table filters
//
// Copyright (c) 1995-2001 by Woll2Woll Software
//
}
interface
uses classes;
type
{ TNode = Class;
PTNode = ^TNode;
}
TStackStr = class
private
list: TStringList;
public
procedure push(s: string);
function pop: string;
constructor create;
destructor Destroy; override;
function count: integer;
end;
TStackPtr = class
private
list: TList;
public
procedure push(s: Pointer);
function pop: Pointer;
constructor create;
destructor Destroy; override;
function count: integer;
end;
implementation
constructor TStackStr.create;
begin
list:= TStringList.create;
list.sorted:= False;
end;
destructor TStackStr.destroy;
begin
list.free;
list:= Nil;
end;
Function TStackStr.count: integer;
begin
result:= list.count;
end;
procedure TStackStr.push(s: string);
begin
list.add(s);
end;
function TStackStr.pop: string;
begin
if list.count=0 then
result:= ''
else begin
result:= list[list.count-1];
list.delete(list.count-1);
end
end;
constructor TStackPtr.create;
begin
list:= TList.create;
end;
Function TStackPtr.count: integer;
begin
result:= list.count;
end;
destructor TStackPtr.destroy;
begin
list.free;
list:= Nil;
end;
procedure TStackPtr.push(s: Pointer);
begin
list.add(s);
end;
function TStackPtr.Pop: Pointer;
begin
if list.count=0 then
result:= Nil
else begin
result:= list[list.count-1];
list.delete(list.count-1);
end
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -