mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 19:08:07 +02:00
46 lines
594 B
ObjectPascal
46 lines
594 B
ObjectPascal
program tcustomattr1;
|
|
|
|
{$mode objfpc}{$H+}
|
|
{$modeswitch prefixedattributes}
|
|
|
|
uses
|
|
typinfo;
|
|
|
|
type
|
|
|
|
{ tmyt }
|
|
|
|
tmyt = class(TCustomAttribute)
|
|
constructor create;
|
|
end;
|
|
|
|
type
|
|
[Tmyt]
|
|
TMyObject = class(TObject)
|
|
end;
|
|
|
|
var
|
|
at: PAttributeTable;
|
|
AClassAttribute: TCustomAttribute;
|
|
|
|
{ tmyt }
|
|
|
|
constructor tmyt.create;
|
|
begin
|
|
//
|
|
end;
|
|
|
|
begin
|
|
at := GetAttributeTable(TMyObject.ClassInfo);
|
|
if not assigned(at) then
|
|
halt(1);
|
|
if at^.AttributeCount<>1 then
|
|
halt(2);
|
|
|
|
AClassAttribute := GetAttribute(at,0);
|
|
if AClassAttribute = nil then
|
|
halt(3);
|
|
writeln('ok');
|
|
end.
|
|
|