~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to docs/typinfex/ex8.pp

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program example8;
 
2
 
 
3
{ This program demonstrates the SetToString function }
 
4
 
 
5
{$mode objfpc}
 
6
 
 
7
uses rttiobj,typinfo;
 
8
 
 
9
Var
 
10
  O : TMyTestObject;
 
11
  PI : PPropInfo;
 
12
 
 
13
Const
 
14
  ConstSet = 'mefirst,methird';
 
15
  
 
16
Var
 
17
  S : TMyEnums;
 
18
  
 
19
begin
 
20
  O:=TMyTestObject.Create;
 
21
  O.SetField:=[mefirst,meSecond,meThird];
 
22
  PI:=GetPropInfo(O,'SetField');
 
23
  Writeln('SetToString (brackets) : ',SetToString(Pi,Integer(O.SetField),True));
 
24
  Writeln('SetToString (default)  : ',SetToString(Pi,Integer(O.SetField)));
 
25
  O.SetField:=TMyEnums(StringToSet(PI,ConstSet));
 
26
  Writeln('Stringtoset            : ',SetToString(PI,Integer(O.SetField)));
 
27
  O.Free;
 
28
end.
 
 
b'\\ No newline at end of file'