mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 20:49:49 +02:00
+ Added SetToString example
This commit is contained in:
parent
e8c8f8785a
commit
e111767081
@ -33,9 +33,7 @@ endif
|
||||
.PHONY: all tex clean
|
||||
|
||||
OBJECTS=rttiobj trtti1 trtti2 trtti3 ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 \
|
||||
ex10 ex11 ex12 ex13
|
||||
# ex14
|
||||
# ex15 ex16
|
||||
ex10 ex11 ex12 ex13 ex14 ex15 ex16 ex17 ex18
|
||||
|
||||
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
|
||||
|
||||
|
@ -24,3 +24,4 @@ ex14.pp This program demonstrates the FindPropInfo function
|
||||
ex15.pp This program demonstrates the GetInt64Prop function
|
||||
ex16.pp This program demonstrates the PropIsType function
|
||||
ex17.pp This program demonstrates the PropType function
|
||||
ex18.pp This program demonstrates the SetToString function
|
||||
|
33
docs/typinfex/ex18.pp
Normal file
33
docs/typinfex/ex18.pp
Normal file
@ -0,0 +1,33 @@
|
||||
program example18;
|
||||
|
||||
{ This program demonstrates the SetToString function }
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
uses rttiobj,typinfo;
|
||||
|
||||
Var
|
||||
O : TMyTestObject;
|
||||
PI : PPropInfo;
|
||||
I : longint;
|
||||
|
||||
begin
|
||||
O:=TMyTestObject.Create;
|
||||
PI:=GetPropInfo(O,'SetField');
|
||||
O.SetField:=[mefirst,meSecond,meThird];
|
||||
I:=GetOrdProp(O,PI);
|
||||
Writeln('Set property to string : ');
|
||||
Writeln('Value : ',SetToString(PI,I,False));
|
||||
O.SetField:=[mefirst,meSecond];
|
||||
I:=GetOrdProp(O,PI);
|
||||
Writeln('Value : ',SetToString(PI,I,True));
|
||||
I:=StringToSet(PI,'mefirst');
|
||||
SetOrdProp(O,PI,I);
|
||||
I:=GetOrdProp(O,PI);
|
||||
Writeln('Value : ',SetToString(PI,I,False));
|
||||
I:=StringToSet(PI,'[mesecond,methird]');
|
||||
SetOrdProp(O,PI,I);
|
||||
I:=GetOrdProp(O,PI);
|
||||
Writeln('Value : ',SetToString(PI,I,True));
|
||||
O.Free;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user