cpwbase.pas
来自「生物信息学中的遗传数据分析的delphi源码。」· PAS 代码 · 共 63 行
PAS
63 行
{*********************************************}
{ }
{ 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 + =
减小字号Ctrl + -
显示快捷键?