📄 cpwbase.pas
字号:
{*********************************************}
{ }
{ COMPONENT for MS DOS and MS WINDOWS }
{ }
{ Source code for Turbo Pascal 6.0 and }
{ Turbo Pasacal for Windows 1.0 compilers. }
{ }
{ (c) 1991, Roderic D. M. Page }
{ }
{*********************************************}
{*
A simple object supporting bitmask flags. Other objects
in COMPONENT will be derived from this object. This means that
all can easily use bitmasks without having to duplicate the
same methods.
*}
{$I CPDIR.INC}
unit cpwbase;
interface
uses
WObjects;
type
BASEOBJECT = object (TObject)
Flags : word;
constructor Init;
function IsFlag (m:word):Boolean;virtual;
function IsAFlag (m:word):Boolean;virtual;
procedure SetFlag (m:word; On:Boolean);virtual;
end;
implementation
constructor BASEOBJECT.Init;
begin
Flags := $0000;
end;
function BASEOBJECT.IsFlag (m:word):Boolean;
begin
IsFlag := ((Flags and m) = m);
end;
function BASEOBJECT.IsAFlag (m:word):Boolean;
begin
IsAFlag := ((Flags and m) <> $0000);
end;
procedure BASEOBJECT.SetFlag (m:word; On:Boolean);
begin
if On then
Flags := Flags or m
else Flags := Flags and not m;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -