mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 10:45:08 +02:00
* Functions to see whether a published property is readable or writeable
git-svn-id: trunk@37497 -
This commit is contained in:
parent
a3bcefd78c
commit
3f09294aab
@ -304,6 +304,8 @@ ResourceString
|
||||
SErrStatusCallBackRequired = 'Thread status report handler cannot be empty.';
|
||||
SErrFindNeedsSortedList = 'Cannot use find on unsorted list';
|
||||
SParamIsNegative = 'Parameter "%s" cannot be negative.';
|
||||
SErrCannotWriteToProperty = 'Cannot write to property "%s".';
|
||||
SErrCannotReadProperty = 'Cannot read property "%s".';
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Keysim Names
|
||||
|
@ -746,6 +746,12 @@ function GetPropList(Instance: TObject; out PropList: PPropList): Integer;
|
||||
|
||||
|
||||
// Property information routines.
|
||||
Function IsReadableProp(PropInfo : PPropInfo) : Boolean;
|
||||
Function IsReadableProp(Instance: TObject; const PropName: string): Boolean;
|
||||
Function IsReadableProp(AClass: TClass; const PropName: string): Boolean;
|
||||
Function IsWriteableProp(PropInfo : PPropInfo) : Boolean;
|
||||
Function IsWriteableProp(Instance: TObject; const PropName: string): Boolean;
|
||||
Function IsWriteableProp(AClass: TClass; const PropName: string): Boolean;
|
||||
Function IsStoredProp(Instance: TObject;PropInfo : PPropInfo) : Boolean;
|
||||
Function IsStoredProp(Instance: TObject; const PropName: string): Boolean;
|
||||
Function IsPublishedProp(Instance: TObject; const PropName: string): Boolean;
|
||||
@ -1242,6 +1248,35 @@ begin
|
||||
Raise EPropertyError.CreateFmt(SErrPropertyNotFound, [PropName]);
|
||||
end;
|
||||
|
||||
function IsReadableProp(PropInfo: PPropInfo): Boolean;
|
||||
begin
|
||||
Result:=(((PropInfo^.PropProcs) and 3) in [ptField,ptStatic,ptVirtual]);
|
||||
end;
|
||||
|
||||
function IsReadableProp(Instance: TObject; const PropName: string): Boolean;
|
||||
begin
|
||||
Result:=IsReadableProp(FindPropInfo(Instance,PropName));
|
||||
end;
|
||||
|
||||
function IsReadableProp(AClass: TClass; const PropName: string): Boolean;
|
||||
begin
|
||||
Result:=IsReadableProp(FindPropInfo(AClass,PropName));
|
||||
end;
|
||||
|
||||
function IsWriteableProp(PropInfo: PPropInfo): Boolean;
|
||||
begin
|
||||
Result:=(((PropInfo^.PropProcs shr 2) and 3) in [ptField,ptStatic,ptVirtual]);
|
||||
end;
|
||||
|
||||
function IsWriteableProp(Instance: TObject; const PropName: string): Boolean;
|
||||
begin
|
||||
Result:=IsWriteableProp(FindPropInfo(Instance,PropName));
|
||||
end;
|
||||
|
||||
function IsWriteableProp(AClass: TClass; const PropName: string): Boolean;
|
||||
begin
|
||||
Result:=IsWriteableProp(FindPropInfo(AClass,PropName));
|
||||
end;
|
||||
|
||||
Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean;
|
||||
type
|
||||
|
Loading…
Reference in New Issue
Block a user