API Documentation
Loading...
Searching...
No Matches
UnitManager Class Reference

#include <UnitManager.h>

Inheritance diagram for UnitManager:
[legend]
Collaboration diagram for UnitManager:
[legend]

Public Member Functions

 UnitManager ()
 
 UnitManager (const UnitManager &manager)
 
 ~UnitManager ()
 
void setToDefaultMetric (bool preserve_spacial)
 
void setToDefaultImperial (bool preserve_spacial)
 
void tieToManager (const UnitManager &manager)
 
void getINI (INIFactory &factory) override
 
void prepareForINI (INIFactory &factory) override
 
void finishReadingINI (INIFactory &factory) override
 
void updateCoordinateBase (const ConstPointer< Unit > &base)
 
ConstPointer< Unitunit (UnitType type) const
 
ConstPointer< UnitorientationOffsetUnit () const
 
Resource< ConstPointer< Unit > > & unitResource (UnitType type)
 
void setUnit (UnitType type, const ConstPointer< Unit > &unit)
 
void clearUnitOptions (UnitType type)
 
void setUnitOptionsToDefault (UnitType type)
 
void setUnitOptions (UnitType type, const Buffer< ConstPointer< UnitOption > > &options)
 
void setUnitOptions (UnitType type, const Buffer< ConstPointer< Unit > > &options)
 
Buffer< ConstPointer< UnitOption > > unitOptions (UnitType units) const
 
const Buffer< ConstPointer< UnitOption > > & angleUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & latLonUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & distanceUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & areaUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & volumeUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & weightUnitOptions () const
 
const Buffer< ConstPointer< UnitOption > > & coordinateSpaceFormatOptions () const
 
const Buffer< DynamicPointer< CustomUnit > > & specialUnits () const
 
void addSpecialUnit (const DynamicPointer< CustomUnit > &custom_unit)
 
ConstPointer< UnitspecialUnit (const String &name)
 
Resource< ConstPointer< Unit > > & specialUnitResource (const String &name)
 
bool hasSpecialUnit (const String &name) const
 
void setupDefaultAngleUnitOptions ()
 
void setupDefaultDistanceOptions ()
 
void setupDefaultCoordinateSpaceOptions ()
 
void setupDefaultVolumeOptions ()
 
void setupDefaultAreaOptions ()
 
void setupDefaultWeightOptions ()
 
void setupDefaultLatLonOptions ()
 
ConstPointer< Unitunit (const String &name) const
 
ConstPointer< UnitparseUnit (const String &name, UnitType type=UnitType::e_undefined_unit) const
 
ConstPointer< UnitdetermineUnit (const Buffer< String > &unit_parts, UnitType type) const
 
bool canBeImperial (const ConstPointer< Unit > &unit) const
 
bool canBeMetric (const ConstPointer< Unit > &unit) const
 
void addFormatOption (UnitType unit_type, const ConstPointer< UnitOption > &format_option)
 
void removeFormatOption (UnitType unit_type, const ConstPointer< UnitOption > &format_option)
 
UnitManageroperator= (const UnitManager &manager)
 
- Public Member Functions inherited from INIInterface
 INIInterface (const File &default_ini)
 
virtual ~INIInterface ()
 
virtual void writeToLog (ProgressInfo *log, uint01 log_level=2U)
 
virtual void writeToLog (const String &title, ProgressInfo *log, uint01 log_level=2U)
 
void setDefaultINIFile (const File &file)
 
virtual bool readINIOptions ()
 
virtual bool readINIOptions (File &ini_file)
 
virtual bool saveINIOptions (bool multithead=false)
 
virtual bool saveINIOptions (File &ini_file, bool multithead=false)
 

Static Public Member Functions

static UnitManagerDefaultManager ()
 
static ConstPointer< UnitOptionActiveOption (const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit)
 

Public Attributes

Resource< ConstPointer< Unit > > angle_unit
 
Resource< ConstPointer< Unit > > orientation_space_unit
 
Resource< ConstPointer< Unit > > distance_unit
 
Resource< ConstPointer< Unit > > coordinate_space_unit
 
Resource< ConstPointer< Unit > > surface_area_unit
 
Resource< ConstPointer< Unit > > volume_unit
 
Resource< ConstPointer< Unit > > weight_unit
 
Resource< ConstPointer< Unit > > temperature_unit
 
Resource< ConstPointer< Unit > > lat_lon_unit
 

Static Public Attributes

static Resource< ConstPointer< Unit > > default_orientation_space_unit { ConstPointer<Unit>() }
 

Protected Attributes

Buffer< ConstPointer< UnitOption > > m_angle_unit_options
 
Buffer< ConstPointer< UnitOption > > m_lat_lon_unit_options
 
Buffer< ConstPointer< UnitOption > > m_distance_unit_options
 
Buffer< ConstPointer< UnitOption > > m_area_unit_options
 
Buffer< ConstPointer< UnitOption > > m_volume_unit_options
 
Buffer< ConstPointer< UnitOption > > m_weight_unit_options
 
Buffer< ConstPointer< UnitOption > > m_coordinate_format_options
 
Dictionary< String, ConstPointer< UnitOption > > m_registered_units
 
Buffer< DynamicPointer< CustomUnit > > m_special_units
 
Dictionary< String, DynamicPointer< CustomUnit > > m_special_unit_lookup
 
String angle_name
 
String orientation_space_name
 
String coordinate_space_name
 
String distance_space_name
 
String surface_area_name
 
String volume_name
 
String temperature_name
 
String weight_name
 
String lat_lon_name
 
ResourceListenerm_tie_to_listener = nullptr
 
- Protected Attributes inherited from INIInterface
File m_default_ini
 

Constructor & Destructor Documentation

◆ UnitManager() [1/2]

◆ UnitManager() [2/2]

UnitManager ( const UnitManager & manager)

◆ ~UnitManager()

Member Function Documentation

◆ ActiveOption()

ConstPointer< UnitOption > ActiveOption ( const Buffer< ConstPointer< UnitOption > > & options,
const ConstPointer< Unit > & unit )
staticnodiscard

◆ addFormatOption()

void addFormatOption ( UnitType unit_type,
const ConstPointer< UnitOption > & format_option )

◆ addSpecialUnit()

void addSpecialUnit ( const DynamicPointer< CustomUnit > & custom_unit)

◆ angleUnitOptions()

const Buffer< ConstPointer< UnitOption > > & angleUnitOptions ( ) const
inlinenodiscard

◆ areaUnitOptions()

const Buffer< ConstPointer< UnitOption > > & areaUnitOptions ( ) const
inlinenodiscard

◆ canBeImperial()

bool canBeImperial ( const ConstPointer< Unit > & unit) const

◆ canBeMetric()

bool canBeMetric ( const ConstPointer< Unit > & unit) const

◆ clearUnitOptions()

void clearUnitOptions ( UnitType type)

◆ coordinateSpaceFormatOptions()

const Buffer< ConstPointer< UnitOption > > & coordinateSpaceFormatOptions ( ) const
inlinenodiscard

◆ DefaultManager()

UnitManager & DefaultManager ( )
staticnodiscard

◆ determineUnit()

ConstPointer< Unit > determineUnit ( const Buffer< String > & unit_parts,
UnitType type ) const
nodiscard

◆ distanceUnitOptions()

const Buffer< ConstPointer< UnitOption > > & distanceUnitOptions ( ) const
inlinenodiscard

◆ finishReadingINI()

void finishReadingINI ( INIFactory & factory)
overridevirtual

Reimplemented from INIInterface.

◆ getINI()

void getINI ( INIFactory & factory)
overridevirtual

Implements INIInterface.

◆ hasSpecialUnit()

bool hasSpecialUnit ( const String & name) const

◆ latLonUnitOptions()

const Buffer< ConstPointer< UnitOption > > & latLonUnitOptions ( ) const
inlinenodiscard

◆ operator=()

UnitManager & operator= ( const UnitManager & manager)

◆ orientationOffsetUnit()

ConstPointer< Unit > orientationOffsetUnit ( ) const
nodiscard

◆ parseUnit()

ConstPointer< Unit > parseUnit ( const String & name,
UnitType type = UnitType::e_undefined_unit ) const
nodiscard

◆ prepareForINI()

void prepareForINI ( INIFactory & factory)
overridevirtual

Reimplemented from INIInterface.

◆ removeFormatOption()

void removeFormatOption ( UnitType unit_type,
const ConstPointer< UnitOption > & format_option )

◆ setToDefaultImperial()

void setToDefaultImperial ( bool preserve_spacial)

◆ setToDefaultMetric()

void setToDefaultMetric ( bool preserve_spacial)

◆ setUnit()

void setUnit ( UnitType type,
const ConstPointer< Unit > & unit )

◆ setUnitOptions() [1/2]

void setUnitOptions ( UnitType type,
const Buffer< ConstPointer< Unit > > & options )

◆ setUnitOptions() [2/2]

void setUnitOptions ( UnitType type,
const Buffer< ConstPointer< UnitOption > > & options )

◆ setUnitOptionsToDefault()

void setUnitOptionsToDefault ( UnitType type)

◆ setupDefaultAngleUnitOptions()

void setupDefaultAngleUnitOptions ( )

◆ setupDefaultAreaOptions()

void setupDefaultAreaOptions ( )

◆ setupDefaultCoordinateSpaceOptions()

void setupDefaultCoordinateSpaceOptions ( )

◆ setupDefaultDistanceOptions()

void setupDefaultDistanceOptions ( )

◆ setupDefaultLatLonOptions()

void setupDefaultLatLonOptions ( )

◆ setupDefaultVolumeOptions()

void setupDefaultVolumeOptions ( )

◆ setupDefaultWeightOptions()

void setupDefaultWeightOptions ( )

◆ specialUnit()

ConstPointer< Unit > specialUnit ( const String & name)

◆ specialUnitResource()

Resource< ConstPointer< Unit > > & specialUnitResource ( const String & name)

◆ specialUnits()

const Buffer< DynamicPointer< CustomUnit > > & specialUnits ( ) const
inlinenodiscard

◆ tieToManager()

void tieToManager ( const UnitManager & manager)

◆ unit() [1/2]

ConstPointer< Unit > unit ( const String & name) const
nodiscard

◆ unit() [2/2]

ConstPointer< Unit > unit ( UnitType type) const
nodiscard

◆ unitOptions()

Buffer< ConstPointer< UnitOption > > unitOptions ( UnitType units) const
nodiscard

◆ unitResource()

Resource< ConstPointer< Unit > > & unitResource ( UnitType type)
nodiscard

◆ updateCoordinateBase()

void updateCoordinateBase ( const ConstPointer< Unit > & base)

◆ volumeUnitOptions()

const Buffer< ConstPointer< UnitOption > > & volumeUnitOptions ( ) const
inlinenodiscard

◆ weightUnitOptions()

const Buffer< ConstPointer< UnitOption > > & weightUnitOptions ( ) const
inlinenodiscard

Member Data Documentation

◆ angle_name

String angle_name
protected

◆ angle_unit

Resource<ConstPointer<Unit> > angle_unit

◆ coordinate_space_name

String coordinate_space_name
protected

◆ coordinate_space_unit

Resource<ConstPointer<Unit> > coordinate_space_unit

◆ default_orientation_space_unit

Resource< ConstPointer< Unit > > default_orientation_space_unit { ConstPointer<Unit>() }
static

◆ distance_space_name

String distance_space_name
protected

◆ distance_unit

Resource<ConstPointer<Unit> > distance_unit

◆ lat_lon_name

String lat_lon_name
protected

◆ lat_lon_unit

Resource<ConstPointer<Unit> > lat_lon_unit

◆ m_angle_unit_options

Buffer<ConstPointer<UnitOption> > m_angle_unit_options
protected

◆ m_area_unit_options

Buffer<ConstPointer<UnitOption> > m_area_unit_options
protected

◆ m_coordinate_format_options

Buffer<ConstPointer<UnitOption> > m_coordinate_format_options
protected

◆ m_distance_unit_options

Buffer<ConstPointer<UnitOption> > m_distance_unit_options
protected

◆ m_lat_lon_unit_options

Buffer<ConstPointer<UnitOption> > m_lat_lon_unit_options
protected

◆ m_registered_units

Dictionary<String, ConstPointer<UnitOption> > m_registered_units
protected

◆ m_special_unit_lookup

Dictionary<String, DynamicPointer<CustomUnit> > m_special_unit_lookup
protected

◆ m_special_units

Buffer<DynamicPointer<CustomUnit> > m_special_units
protected

◆ m_tie_to_listener

ResourceListener* m_tie_to_listener = nullptr
protected

◆ m_volume_unit_options

Buffer<ConstPointer<UnitOption> > m_volume_unit_options
protected

◆ m_weight_unit_options

Buffer<ConstPointer<UnitOption> > m_weight_unit_options
protected

◆ orientation_space_name

String orientation_space_name
protected

◆ orientation_space_unit

Resource<ConstPointer<Unit> > orientation_space_unit

◆ surface_area_name

String surface_area_name
protected

◆ surface_area_unit

Resource<ConstPointer<Unit> > surface_area_unit

◆ temperature_name

String temperature_name
protected

◆ temperature_unit

Resource<ConstPointer<Unit> > temperature_unit

◆ volume_name

String volume_name
protected

◆ volume_unit

Resource<ConstPointer<Unit> > volume_unit

◆ weight_name

String weight_name
protected

◆ weight_unit

Resource<ConstPointer<Unit> > weight_unit

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