RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TConvTypeInfo Class

TConvTypeInfo describes a single registered conversion type (measurement unit).

Pascal
TConvTypeInfo = class(TObject);
C++
class TConvTypeInfo : public TObject;

TConvTypeInfo contains information about a conversion type, including 

The ConvFamily property, which indicates the conversion family to which the conversion type belongs. 

The ConvType property, which is the TConvType identifier for the conversion type. 

The Description property, which is a human-readable description of the conversion type. 

In addition, each TConvTypeInfo instance defines two methods for converting between the conversion type and the base units of its conversion family. These methods are abstract (pure virual) in TConvTypeInfo, and implemented by the descendant classes created by the RegisterConversionType function. 

When you call RegisterConversionType to register a new conversion type (measurement unit), you can describe the new unit in one of three ways: 

Specify the conversion family, a description, and supply a factor for converting from the new type to the base units of the conversion family. 

Specify the conversion family, a description, and supply two methods for converting between the new type and the base units of the conversion family. 

Provide a TConvTypeInfo descendant whose properties describe the conversion family and description and whose methods convert between the new type and the base units of the conversion family. 

If you choose either of the first two methods, RegisterConversionType creates a special TConvTypeInfo descendant to represent the new conversion type. 

By creating your own TConvTypeInfo descendant, you can make use of a common conversion scheme that relies only on a simple parameterized conversion method rather than creating many nearly identical conversion functions, one for each conversion type. Thus, for example, the TConvTypeFactor class, which is created automatically when you register a conversion type by specifying a conversion factor, implements the FromCommon and ToCommon methods only once, using a property to specify the conversion factor. 

 

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