HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UnitConverterRegistry Class Reference

#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...
 

Detailed Description

A registry for unit converters.

Definition at line 168 of file Unit.h.

Constructor & Destructor Documentation

virtual UnitConverterRegistry::~UnitConverterRegistry ( )
inlinevirtual

Definition at line 171 of file Unit.h.

Member Function Documentation

bool UnitConverterRegistry::addUnitConverter ( UnitTypeDefPtr  def,
UnitConverterPtr  converter 
)

Add a unit converter for a given UnitDef. Returns false if a converter has already been registered for the given UnitDef

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 UnitConverterRegistryPtr UnitConverterRegistry::create ( )
static

Creator.

int UnitConverterRegistry::getUnitAsInteger ( const string unitName) const

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)

Get a unit converter for a given UnitDef Returns any empty pointer if a converter does not exist for the given UnitDef

bool UnitConverterRegistry::removeUnitConverter ( UnitTypeDefPtr  def)

Remove a unit converter for a given UnitDef. Returns false if a converter does not exist for the given UnitDef

void UnitConverterRegistry::write ( DocumentPtr  doc) const

Create unit definitions in a document based on registered converters.


The documentation for this class was generated from the following file: