3#include <NDEVR/Resource.h>
4#include <NDEVR/Pointer.h>
5#include <NDEVR/TranslatedString.h>
6#include <NDEVR/Dictionary.h>
7#include <NDEVR/INIInterface.h>
33 :
UnitOption(unit->name, unit->translatedName())
35 , custom_title(custom_title)
38 virtual
bool hasMemberUnit(const
ConstPointer<
Unit>& unit) const final override;
54 virtual
bool hasMemberUnit(const
ConstPointer<
Unit>& unit) const final override;
68 , unit_type(unit_type)
100 virtual void resetToDefault(
UnitManager&)
override;
113 virtual void prepareForINI(
const UnitManager& manager)
override;
114 virtual void setupINI(
INIFactory& ini)
override;
115 virtual void finishReadingINI(
UnitManager& manager)
override;
131 void setToDefaultMetric(
bool preserve_spacial);
132 void setToDefaultImperial(
bool preserve_spacial);
135 void prepareForINI(
INIFactory& factory)
override;
136 void finishReadingINI(
INIFactory& factory)
override;
138 [[nodiscard]]
static UnitManager& DefaultManager();
144 void clearUnitOptions(
UnitType type);
145 void setUnitOptionsToDefault(
UnitType type);
161 bool hasSpecialUnit(
const String& name)
const;
162 void setupDefaultAngleUnitOptions();
163 void setupDefaultDistanceOptions();
164 void setupDefaultCoordinateSpaceOptions();
165 void setupDefaultVolumeOptions();
166 void setupDefaultAreaOptions();
167 void setupDefaultWeightOptions();
168 void setupDefaultLatLonOptions();
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:110
String m_ini_unit_name
Definition UnitManager.h:122
Resource< ConstPointer< Unit > > m_unit
Definition UnitManager.h:123
TranslatedString m_title
Definition UnitManager.h:121
virtual TranslatedString title() const override
Definition UnitManager.h:116
Definition UnitManager.h:30
Buffer< ConstPointer< UnitOption > > m_sub_options
Definition UnitManager.h:45
TranslatedString custom_title
Definition UnitManager.h:43
ConstPointer< Unit > base_unit
Definition UnitManager.h:42
BasicUnitOption(const ConstPointer< Unit > &unit, const TranslatedString &custom_title=TranslatedString())
Definition UnitManager.h:32
virtual Buffer< ConstPointer< UnitOption > > & editSubOptions()
Definition UnitManager.h:41
virtual Buffer< ConstPointer< UnitOption > > subOptions() const final override
Definition UnitManager.h:40
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition UnitManager.h:48
CoordinateUnitOption(const String &id, const TranslatedString &name)
Definition UnitManager.h:50
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:63
virtual TranslatedString title() const
Definition UnitManager.h:74
CustomUnit(const String &id, const TranslatedString &name, UnitType unit_type)
Definition UnitManager.h:65
virtual void finishReadingINI(UnitManager &)
Definition UnitManager.h:80
virtual void setupINI(INIFactory &)=0
TranslatedString name
Definition UnitManager.h:71
String id
Definition UnitManager.h:72
virtual void prepareForINI(const UnitManager &)
Definition UnitManager.h:77
virtual ~CustomUnit()
Definition UnitManager.h:70
virtual ConstPointer< Unit > defaultUnit(UnitManager &) const =0
virtual Resource< ConstPointer< Unit > > & unitResource(UnitManager &manager)=0
virtual Buffer< ConstPointer< UnitOption > > options(UnitManager &manager) const =0
UnitType unit_type
Definition UnitManager.h:73
Definition Dictionary.h:48
Definition Pointer.hpp:303
Definition INIReader.h:57
Definition INIInterface.h:40
A unit that mirrors another set unit.
Definition UnitManager.h:90
virtual void finishReadingINI(UnitManager &) override
Definition UnitManager.h:101
virtual void prepareForINI(const UnitManager &) override
Definition UnitManager.h:98
virtual ~ReferenceCustomUnit()
Definition UnitManager.h:95
ReferenceCustomUnit(const String &id, const TranslatedString &name, UnitType unit_type)
Definition UnitManager.h:92
virtual void setupINI(INIFactory &) override
Definition UnitManager.h:99
Definition ResourceListener.h:55
Definition TranslatedString.h:9
Definition UnitManager.h:126
Resource< ConstPointer< Unit > > weight_unit
Definition UnitManager.h:188
String distance_space_name
Definition UnitManager.h:207
Resource< ConstPointer< Unit > > distance_unit
Definition UnitManager.h:184
Buffer< ConstPointer< UnitOption > > m_area_unit_options
Definition UnitManager.h:196
Buffer< DynamicPointer< CustomUnit > > m_special_units
Definition UnitManager.h:201
String orientation_space_name
Definition UnitManager.h:205
Resource< ConstPointer< Unit > > volume_unit
Definition UnitManager.h:187
static Resource< ConstPointer< Unit > > default_orientation_space_unit
Definition UnitManager.h:191
Buffer< ConstPointer< UnitOption > > m_volume_unit_options
Definition UnitManager.h:197
Buffer< ConstPointer< UnitOption > > m_weight_unit_options
Definition UnitManager.h:198
const Buffer< ConstPointer< UnitOption > > & coordinateSpaceFormatOptions() const
Definition UnitManager.h:156
const Buffer< ConstPointer< UnitOption > > & latLonUnitOptions() const
Definition UnitManager.h:151
Buffer< ConstPointer< UnitOption > > m_coordinate_format_options
Definition UnitManager.h:199
String surface_area_name
Definition UnitManager.h:208
String volume_name
Definition UnitManager.h:209
const Buffer< ConstPointer< UnitOption > > & angleUnitOptions() const
Definition UnitManager.h:150
const Buffer< ConstPointer< UnitOption > > & areaUnitOptions() const
Definition UnitManager.h:153
const Buffer< ConstPointer< UnitOption > > & distanceUnitOptions() const
Definition UnitManager.h:152
String coordinate_space_name
Definition UnitManager.h:206
const Buffer< ConstPointer< UnitOption > > & volumeUnitOptions() const
Definition UnitManager.h:154
String temperature_name
Definition UnitManager.h:210
Buffer< ConstPointer< UnitOption > > m_angle_unit_options
Definition UnitManager.h:193
Resource< ConstPointer< Unit > > coordinate_space_unit
Definition UnitManager.h:185
String angle_name
Definition UnitManager.h:204
Resource< ConstPointer< Unit > > surface_area_unit
Definition UnitManager.h:186
String lat_lon_name
Definition UnitManager.h:212
const Buffer< ConstPointer< UnitOption > > & weightUnitOptions() const
Definition UnitManager.h:155
Resource< ConstPointer< Unit > > lat_lon_unit
Definition UnitManager.h:190
Resource< ConstPointer< Unit > > temperature_unit
Definition UnitManager.h:189
Dictionary< String, ConstPointer< UnitOption > > m_registered_units
Definition UnitManager.h:200
String weight_name
Definition UnitManager.h:211
Buffer< ConstPointer< UnitOption > > m_distance_unit_options
Definition UnitManager.h:195
Resource< ConstPointer< Unit > > angle_unit
Definition UnitManager.h:182
Dictionary< String, DynamicPointer< CustomUnit > > m_special_unit_lookup
Definition UnitManager.h:202
Resource< ConstPointer< Unit > > orientation_space_unit
Definition UnitManager.h:183
const Buffer< DynamicPointer< CustomUnit > > & specialUnits() const
Definition UnitManager.h:157
Buffer< ConstPointer< UnitOption > > m_lat_lon_unit_options
Definition UnitManager.h:194
Definition UnitManager.h:12
virtual TranslatedString title() const
Definition UnitManager.h:19
virtual bool hasMemberUnit(const ConstPointer< Unit > &unit) const =0
TranslatedString name
Definition UnitManager.h:26
String id
Definition UnitManager.h:27
virtual ~UnitOption()
Definition UnitManager.h:18
virtual ConstPointer< Unit > unit() const =0
virtual ConstPointer< Unit > unit(const ConstPointer< Unit > &) const
Definition UnitManager.h:22
UnitOption(const String &id, const TranslatedString &name)
Definition UnitManager.h:14
virtual Buffer< ConstPointer< UnitOption > > subOptions() const
Definition UnitManager.h:23
UnitType
Definition Unit.h:10