IsStoredProp

Check whether a property is stored.

Declaration

Source position: typinfo.pp line 879

  function IsStoredProp(Instance: TObject; PropInfo: PPropInfo) : Boolean;
  function IsStoredProp(Instance: TObject; const PropName: string)
                        : Boolean;

Description

IsStoredProp returns True if the Stored modifier evaluates to True for the property described by PropInfo or with name PropName for object Instance. It returns False otherwise. If the function returns True, this indicates that the property should be written when streaming the object Instance.

If there was no stored modifier in the declaration of the property, True will be returned.

Errors

No checking is done whether Instance is non-nil, or whether PropInfo describes a valid property of Instance. Specifying an invalid property name in PropName will result in an EPropertyError exception.

See also

Name Description
IsPublishedProp Check whether a published property exists.
PropIsType Check the type of a published property.

Example

program example11;
{ This program demonstrates the IsStoredProp function }
{$mode objfpc}
uses rttiobj,typinfo;
Var
  O : TMyTestObject;
  PI : PPropInfo;
begin
  O:=TMyTestObject.Create;
  Writeln('Stored tests    : ');
  Write('IsStoredProp(O,StoredIntegerConstFalse)    : ');
  Writeln(IsStoredProp(O,'StoredIntegerConstFalse'));
  Write('IsStoredProp(O,StoredIntegerConstTrue)     : ');
  Writeln(IsStoredProp(O,'StoredIntegerConstTrue'));
  Write('IsStoredProp(O,StoredIntegerMethod)        : ');
  Writeln(IsStoredProp(O,'StoredIntegerMethod'));
  Write('IsStoredProp(O,StoredIntegerVirtualMethod) : ');
  Writeln(IsStoredProp(O,'StoredIntegerVirtualMethod'));
  O.Free;
end.