HDK
|
#include <Unit.h>
Public Member Functions | |
virtual | ~UnitConverterRegistry () |
bool | addUnitConverter (UnitTypeDefPtr def, UnitConverterPtr converter) |
bool | removeUnitConverter (UnitTypeDefPtr def) |
UnitConverterPtr | getUnitConverter (UnitTypeDefPtr def) |
void | clearUnitConverters () |
Clear all unit converters from the registry. More... | |
int | getUnitAsInteger (const string &unitName) const |
void | write (DocumentPtr doc) const |
Create unit definitions in a document based on registered converters. More... | |
bool | convertToUnit (DocumentPtr doc, const string &unitType, const string &targetUnit) |
Static Public Member Functions | |
static UnitConverterRegistryPtr | create () |
Creator. More... | |
|
inlinevirtual |
bool UnitConverterRegistry::addUnitConverter | ( | UnitTypeDefPtr | def, |
UnitConverterPtr | converter | ||
) |
void UnitConverterRegistry::clearUnitConverters | ( | ) |
Clear all unit converters from the registry.
bool UnitConverterRegistry::convertToUnit | ( | DocumentPtr | doc, |
const string & | unitType, | ||
const string & | targetUnit | ||
) |
Convert input values which have a source unit to a given target unit. Returns if any unit conversion occured.
|
static |
Creator.
Given a unit name return a value that it can map to as an integer Returns -1 value if not found
UnitConverterPtr UnitConverterRegistry::getUnitConverter | ( | UnitTypeDefPtr | def | ) |
bool UnitConverterRegistry::removeUnitConverter | ( | UnitTypeDefPtr | def | ) |
void UnitConverterRegistry::write | ( | DocumentPtr | doc | ) | const |
Create unit definitions in a document based on registered converters.