RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Classes.RegisterIntegerConsts Function

Registers conversion functions for string identifiers that represent type values.

Pascal
procedure RegisterIntegerConsts(AIntegerType: Pointer; AIdentToInt: TIdentToInt; AIntToIdent: TIntToIdent);
C++
RegisterIntegerConsts(void * AIntegerType, TIdentToInt AIdentToInt, TIntToIdent AIntToIdent);

RegisterIntegerConsts (which can only be called in Delphi) registers conversion functions for type identifiers. Call RegisterIntegerConsts from the initialization section of the unit that defines an integer-based type and a set of strings that represent the values of that type. 

AIntegerType is a pointer to the type information for the integer-based type whose values are represented as strings. Its value can be obtained from the base type using the TypeInfo function. 

AIdentToInt is the conversion function that converts strings that are symbolic representations of values to the corresponding integers. 

AIntToIdent is the conversion function that converts values that are instances of the base type to the corresponding string representation. 

Once the conversion functions are registered, string identifiers can represent type values and the conversion functions are used to convert the string identifiers into the underlying integer values. For example, the TColor type uses this system to convert between the type constants in the Graphics unit and numeric TColor values. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!