[Overview][Constants][Types][Classes][Procedures and functions] | Reference for unit 'typinfo' (#rtl) |
Convert set to a string description
Source position: line 0
function SetToString( |
TypeInfo: PTypeInfo; |
Value: Integer; |
Brackets: Boolean |
):String; |
PropInfo: PPropInfo; |
Value: Integer; |
Brackets: Boolean |
):String; |
PropInfo: PPropInfo; |
Value: Integer |
):String; |
SetToString takes an integer representation of a set (as received e.g. by GetOrdProp) and turns it into a string representing the elements in the set, based on the type information found in the PropInfo property information. By default, the string representation is not surrounded by square brackets. Setting the Brackets parameter to True will surround the string representation with brackets.
The function returns the string representation of the set.
No checking is done to see whether PropInfo points to valid property information.
|
Return name of enumeration constant. |
|
|
Get ordinal value for enumerated type by name |
|
|
Convert string description to a set. |
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.
No notes exist for this page yet.