home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 February
/
Chip_2000-02_cd.bin
/
zkuste
/
Delphi
/
navody
/
tt
/
objvm.exe
/
UNITS
/
ConstValues.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-06-26
|
2KB
|
71 lines
unit ConstValues;
interface
uses LangValue,
NamedValuesList,ProxyValue,VisualValue;
type
{Constant value set }
TConstValues=class(ILangValue)
protected
Variables:TNamedValuesList;
function rdValues(const s:string):ILangValue;override;
public
constructor Create;
destructor Destroy;override;
function HasValue(const s:string):boolean;override;
procedure AddValue(const s:string;a:ILangValue);override;
function CreateEqu:ILangValue;override;
procedure RemoveValue(a:ILangValue);override;
procedure AddTo(a:IValueOwner);
end;
implementation
uses SysUtils;
function TConstValues.rdValues;
Var a:TProxyValue;
begin
Result:=Variables.ValByName(s);
if Result=nil then raise Exception.Create(s+' - φσ φαΘΣσφε');
Result:=TProxyValue.CreateFrom(Result);
end;
constructor TConstValues.Create;
begin
inherited Create(nil);
Variables:=TNamedValuesList.Create;
end;
destructor TConstValues.Destroy;
begin
Variables.Free;
inherited Destroy;
end;
function TConstValues.HasValue;
begin
Result:=Variables.ValByName(s)<>nil;
end;
procedure TConstValues.AddValue;
begin
Variables.Add(s,a);
end;
function TConstValues.CreateEqu;
begin
Result:=TProxyValue.CreateFrom(Self);
end;
procedure TConstValues.RemoveValue(a:ILangValue);
begin
Variables.DeleteValue(a);
end;
procedure TConstValues.AddTo(a:IValueOwner);
Var i:Integer;
v:TVisualValue;
begin
for i:=0 to Variables.Count-1 do
begin
if Variables[i] is TVisualValue then
begin
v:=(Variables[i] as TVisualValue).CreateSame(a);
v.LangOwner:=a;
end;
end;
end;
end.