[Overview][Constants][Types][Classes][Procedures and functions] |
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; |
SetToStringtakes 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 PropInfoproperty information. By default, the string representation is not surrounded by square brackets. Setting the Bracketsparameter to Truewill surround the string representation with brackets.
The function returns the string representation of the set.
No checking is done to see whether PropInfopoints 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.