Adding new measurement types (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Converting measurements (C++)

If you want to perform conversions between measurement units not already defined in the System.StdConvs unit, you need to create a new conversion family to represent the measurement units (TConvType values). When two TConvType values are registered with the same conversion family, the Convert function can convert between measurements made using the units represented by those TConvType values.

You first need to obtain TConvFamily values by registering a conversion family using the RegisterConversionFamily function. After you get a TConvFamily value (by registering a new conversion family or using one of the global variables in the System.StdConvs unit), you can use the RegisterConversionType function to add the new units to the conversion family.

The following examples show how to do this; see Creating a simple conversion family and adding units (C++) and Using a conversion function (C++).

See also