Sign in Join
FPDoc Onlineexperiment

IsStoredProp function

In unit TypInfo

Check whether a property is stored.

Declaration

pascal
function IsStoredProp(Instance: TObject; PropInfo: PPropInfo): 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

Example: ex11

pascal
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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.