NDEVR
API Documentation
ReferenceCustomUnit

A unit that mirrors another set unit. More...

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

Public Member Functions

 ReferenceCustomUnit (const StringView &id, const TranslatedString &name, UnitCategory unit_type)
 Constructs a ReferenceCustomUnit with the given identifier, name, and unit category.
virtual ~ReferenceCustomUnit ()
 Virtual destructor.
virtual ConstPointer< UnitcurrentUnit (UnitManager &manager) override
 Returns the current unit from the referenced source.
virtual ConstPointer< UnitdefaultUnit (UnitManager &) const override
 Returns the default unit from the referenced source.
virtual void finishReadingINI (UnitManager &) override
 No-op for reference units since INI state is managed by the referenced source.
virtual Buffer< ConstPointer< UnitOption > > options (UnitManager &manager) const override
 Returns the available unit options from the referenced source.
virtual void prepareForINI (const UnitManager &) override
 No-op for reference units since INI state is managed by the referenced source.
virtual void resetToDefault (UnitManager &) override
 Resets this reference unit to its default value.
virtual void setupINI (INIFactory &) override
 No-op for reference units since INI state is managed by the referenced source.
virtual Resource< ConstPointer< Unit > > & unitResource (UnitManager &manager) override
 Returns the unit resource from the referenced manager source.
Public Member Functions inherited from CustomUnit
 CustomUnit (const StringView &id, const TranslatedString &name, UnitCategory unit_type)
 Constructs a CustomUnit with the given identifier, name, and unit category.
virtual ~CustomUnit ()
 Virtual destructor.
virtual ConstPointer< UnitcurrentUnit ()
 Returns the current unit without a manager context.
virtual TranslatedString title () const
 Returns the translated display title.

Additional Inherited Members

Public Attributes inherited from CustomUnit
String id
 The unique string identifier of this custom unit.
TranslatedString name
 The translated display name of this custom unit.
UnitCategory unit_type
 The category of unit this custom unit belongs to.

Detailed Description

A unit that mirrors another set unit.


Class: BaseValues

Definition at line 235 of file UnitManager.h.

Constructor & Destructor Documentation

◆ ReferenceCustomUnit()

ReferenceCustomUnit::ReferenceCustomUnit ( const StringView & id,
const TranslatedString & name,
UnitCategory unit_type )
inline

Constructs a ReferenceCustomUnit with the given identifier, name, and unit category.

Parameters
[in]idThe unique string identifier for this reference unit.
[in]nameThe translated display name for this reference unit.
[in]unit_typeThe category of unit this reference unit mirrors.

Definition at line 244 of file UnitManager.h.

References CustomUnit::CustomUnit(), CustomUnit::id, CustomUnit::name, and CustomUnit::unit_type.

Member Function Documentation

◆ currentUnit()

virtual ConstPointer< Unit > ReferenceCustomUnit::currentUnit ( UnitManager & manager)
overridevirtual

Returns the current unit from the referenced source.

Parameters
[in]managerThe UnitManager providing unit context.
Returns
A const pointer to the current unit.

Reimplemented from CustomUnit.

◆ defaultUnit()

virtual ConstPointer< Unit > ReferenceCustomUnit::defaultUnit ( UnitManager & ) const
nodiscardoverridevirtual

Returns the default unit from the referenced source.

Parameters
[in]managerThe UnitManager providing unit context.
Returns
A const pointer to the default unit.

Implements CustomUnit.

◆ options()

virtual Buffer< ConstPointer< UnitOption > > ReferenceCustomUnit::options ( UnitManager & manager) const
nodiscardoverridevirtual

Returns the available unit options from the referenced source.

Parameters
[in]managerThe UnitManager providing unit context.
Returns
A buffer of const pointers to UnitOption objects.

Implements CustomUnit.

◆ resetToDefault()

virtual void ReferenceCustomUnit::resetToDefault ( UnitManager & )
overridevirtual

Resets this reference unit to its default value.

Parameters
[in]managerThe UnitManager providing unit context.

Reimplemented from CustomUnit.

◆ unitResource()

virtual Resource< ConstPointer< Unit > > & ReferenceCustomUnit::unitResource ( UnitManager & manager)
nodiscardoverridevirtual

Returns the unit resource from the referenced manager source.

Parameters
[in]managerThe UnitManager providing unit context.
Returns
A reference to the unit resource.

Implements CustomUnit.


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