mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 00:30:35 +02:00
+ GetEnumNameCount by Danny Milosavljevic
git-svn-id: trunk@783 -
This commit is contained in:
parent
469f2d1020
commit
451a7c3366
@ -271,6 +271,8 @@ Procedure SetVariantProp(Instance: TObject; PropInfo : PPropInfo; const Value: V
|
||||
// Auxiliary routines, which may be useful
|
||||
Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
|
||||
Function GetEnumValue(TypeInfo : PTypeInfo;const Name : string) : Integer;
|
||||
function GetEnumNameCount(enum1: PTypeInfo): SizeInt;
|
||||
|
||||
function SetToString(TypeInfo: PTypeInfo; Value: Integer; Brackets: Boolean) : String;
|
||||
function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
|
||||
function SetToString(PropInfo: PPropInfo; Value: Integer) : String;
|
||||
@ -357,6 +359,27 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function GetEnumNameCount(enum1: PTypeInfo): SizeInt;
|
||||
var
|
||||
PS: PShortString;
|
||||
PT: PTypeData;
|
||||
Count: SizeInt;
|
||||
begin
|
||||
PT:=GetTypeData(enum1);
|
||||
Count:=0;
|
||||
Result:=0;
|
||||
|
||||
PS:=@PT^.NameList;
|
||||
While (PByte(PS)^<>0) do
|
||||
begin
|
||||
PS:=PShortString(pointer(PS)+PByte(PS)^+1);
|
||||
Inc(Count);
|
||||
end;
|
||||
|
||||
Result := Count;
|
||||
end;
|
||||
|
||||
|
||||
Function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean) : String;
|
||||
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user