home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { Delphi Visual Component Library }
- { }
- { Copyright (c) 1995 Borland International }
- { }
- { Warning: }
- { The interface section of this file will change }
- { in future versions of Delphi. }
- { }
- {*******************************************************}
-
- unit TypInfo;
-
- {$N+,S-}
-
- interface
-
- uses Classes, SysUtils;
-
- type
-
- TTypeKind = (tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
- tkString, tkSet, tkClass, tkMethod);
- TTypeKinds = set of TTypeKind;
-
- TOrdType = (otSByte, otUByte, otSWord, otUWord, otSLong);
-
- TFloatType = (ftSingle, ftDouble, ftExtended, ftComp);
-
- TMethodKind = (mkProcedure, mkFunction);
- TParamFlags = set of (pfVar, pfConst, pfArray);
-
- PTypeInfo = ^TTypeInfo;
- TTypeInfo = record
- Kind: TTypeKind;
- Name: string;
- {TypeData: TTypeData}
- end;
-
- PTypeData = ^TTypeData;
- TTypeData = packed record
- case TTypeKind of
- tkUnknown: ();
- tkInteger, tkChar, tkEnumeration, tkSet: (
- OrdType: TOrdType;
- case TTypeKind of
- tkInteger, tkChar, tkEnumeration: (
- MinValue: Longint;
- MaxValue: Longint;
- case TTypeKind of
- tkInteger, tkChar: ();
- tkEnumeration: (
- BaseType: PTypeInfo;
- NameList: string));
- tkSet: (
- CompType: PTypeInfo));
- tkFloat: (
- FloatType: TFloatType);
- tkString: (
- MaxLength: Byte);
- tkClass: (
- ClassType: TClass;
- ParentInfo: PTypeInfo;
- PropCount: SmallInt;
- UnitName: string
- {PropData: TPropData});
- tkMethod: (
- MethodKind: TMethodKind;
- ParamCount: Byte;
- ParamList: array[0..1023] of Char
- {ParamList: array[1..ParamCount] of
- record
- Flags: TParamFlags;
- ParamName: string;
- TypeName: string;
- end;
- ResultType: string});
- end;
-
- TPropData = packed record
- PropCount: Word;
- PropList: record end;
- {PropList: array[1..PropCount] of TPropInfo}
- end;
-
- PPropInfo = ^TPropInfo;
- TPropInfo = packed record
- PropType: PTypeInfo;
- GetProc: Pointer;
- SetProc: Pointer;
- StoredProc: Pointer;
- Index: SmallInt;
- Default: Longint;
- NameIndex: SmallInt;
- Name: string;
- end;
-
- TPropInfoProc = procedure(PropInfo: PPropInfo) of object;
-
- PPropList = ^TPropList;
- TPropList = array[0..16379] of PPropInfo;
-
- const
- tkProperties = [tkInteger..tkClass];
- tkMethods = [tkMethod];
- tkAny = [tkUnknown..tkMethod];
-
- { Property access routines }
-
- function GetTypeData(TypeInfo: PTypeInfo): PTypeData;
-
- function GetEnumName(TypeInfo: PTypeInfo; Value: Integer): PString;
- function GetEnumValue(TypeInfo: PTypeInfo; const EnumName: string): Integer;
-
- function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string): PPropInfo;
- procedure GetPropInfos(TypeInfo: PTypeInfo; PropList: PPropList);
- function GetPropList(TypeInfo: PTypeInfo; TypeKinds: TTypeKinds;
- PropList: PPropList): Integer;
-
- function IsStoredProp(Instance: TObject; PropInfo: PPropInfo): Boolean;
-
- function GetOrdProp(Instance: TObject; PropInfo: PPropInfo): Longint;
- procedure SetOrdProp(Instance: TObject; PropInfo: PPropInfo;
- Value: Longint);
-
- function GetStrProp(Instance: TObject; PropInfo: PPropInfo): string;
- procedure SetStrProp(Instance: TObject; PropInfo: PPropInfo;
- const Value: string);
-
- function GetFloatProp(Instance: TObject; PropInfo: PPropInfo): Extended;
- procedure SetFloatProp(Instance: TObject; PropInfo: PPropInfo;
- Value: Extended);
-
- function GetMethodProp(Instance: TObject; PropInfo: PPropInfo): TMethod;
- procedure SetMethodProp(Instance: TObject; PropInfo: PPropInfo;
- const Value: TMethod);
-
- implementation
-