mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:09:25 +02:00
* test for forward class in $M+
git-svn-id: trunk@1999 -
This commit is contained in:
parent
22923c12d5
commit
6c75825751
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5310,6 +5310,7 @@ tests/tbs/tb0496.pp svneol=native#text/plain
|
||||
tests/tbs/tb0497.pp -text
|
||||
tests/tbs/tb0497a.pp -text
|
||||
tests/tbs/tb0497b.pp -text
|
||||
tests/tbs/tb0498.pp svneol=native#text/plain
|
||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||
tests/tbs/ub0069.pp svneol=native#text/plain
|
||||
tests/tbs/ub0119.pp svneol=native#text/plain
|
||||
|
63
tests/tbs/tb0498.pp
Executable file
63
tests/tbs/tb0498.pp
Executable file
@ -0,0 +1,63 @@
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, TypInfo;
|
||||
|
||||
|
||||
type
|
||||
{$M+}
|
||||
TMyTestObject = class;
|
||||
{$M-}
|
||||
|
||||
|
||||
TSomeOtherClass = class(TObject)
|
||||
private
|
||||
FName: string;
|
||||
public
|
||||
property Name: string read FName write FName;
|
||||
end;
|
||||
|
||||
|
||||
TMyTestObject = class(TObject)
|
||||
private
|
||||
FIntProp: integer;
|
||||
FStringProp: string;
|
||||
public
|
||||
published
|
||||
property StringProp: string read FStringProp write FStringProp;
|
||||
property IntProp: integer read FIntProp write FIntProp;
|
||||
end;
|
||||
|
||||
|
||||
procedure ShowProperties;
|
||||
var
|
||||
O: TMyTestObject;
|
||||
i: Longint;
|
||||
lPropFilter: TTypeKinds;
|
||||
lCount: Longint;
|
||||
lSize: Integer;
|
||||
lList: PPropList;
|
||||
begin
|
||||
O := TMyTestObject.Create;
|
||||
lPropFilter := [tkInteger, tkAString];
|
||||
|
||||
lCount := GetPropList(O.ClassInfo, lPropFilter, nil, false);
|
||||
lSize := lCount * SizeOf(Pointer);
|
||||
GetMem(lList, lSize);
|
||||
|
||||
Writeln('Total property Count: ' + IntToStr(lCount));
|
||||
lCount := GetPropList(O.ClassInfo, lPropFilter, lList, false);
|
||||
for i := 0 to lCount-1 do
|
||||
begin
|
||||
Writeln('Property '+IntToStr(i+1)+': ' + lList^[i]^.Name);
|
||||
end;
|
||||
|
||||
FreeMem(lList);
|
||||
O.Free;
|
||||
Writeln('---------------');
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
ShowProperties;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user