NDEVR
API Documentation

A program-defined unit that can be used for some specific task different from a program-wide unit. More...

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

Public Member Functions

 BasicCustomUnit (const StringView &id, const TranslatedString &title, UnitCategory type)
 Constructs a BasicCustomUnit with the given identifier, title, and unit category.
virtual ConstPointer< UnitdefaultUnit (UnitManager &) const override
 Returns the default unit for this custom unit.
virtual void finishReadingINI (UnitManager &manager) override
 Resolves the unit from the INI-stored name after reading INI data.
Buffer< ConstPointer< UnitOption > > options (UnitManager &manager) const override
 Returns the available unit options for this custom unit.
virtual void prepareForINI (const UnitManager &manager) override
 Prepares internal state for INI serialization by capturing the current unit name.
virtual void setupINI (INIFactory &ini) override
 Registers this custom unit's settings with the given INI factory.
virtual TranslatedString title () const override
 Returns the display title for this custom unit.
virtual Resource< ConstPointer< Unit > > & unitResource (UnitManager &manager) override
 Returns a mutable reference to the resource holding the current unit.
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 ConstPointer< UnitcurrentUnit (UnitManager &manager)
 Returns the current unit using the given manager context.
virtual void resetToDefault (UnitManager &)
 Resets this custom unit to its default value.

Protected Attributes

String m_ini_unit_name
 The unit name stored in INI for serialization.
TranslatedString m_title
 The translated display title.
Resource< ConstPointer< Unit > > m_unit
 The resource holding the current unit selection.

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 program-defined unit that can be used for some specific task different from a program-wide unit.


Class: BaseValues

Definition at line 298 of file UnitManager.h.

Constructor & Destructor Documentation

◆ BasicCustomUnit()

BasicCustomUnit::BasicCustomUnit ( const StringView & id,
const TranslatedString & title,
UnitCategory type )

Constructs a BasicCustomUnit with the given identifier, title, and unit category.

Parameters
[in]idThe unique string identifier for this custom unit.
[in]titleThe translated display title for this custom unit.
[in]typeThe category of unit this custom unit belongs to.

References title().

Member Function Documentation

◆ defaultUnit()

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

Returns the default unit for this custom unit.

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

Implements CustomUnit.

◆ finishReadingINI()

virtual void BasicCustomUnit::finishReadingINI ( UnitManager & manager)
overridevirtual

Resolves the unit from the INI-stored name after reading INI data.

Parameters
[in]managerThe UnitManager providing unit context.

Reimplemented from CustomUnit.

◆ options()

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

Returns the available unit options for this custom unit.

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

Implements CustomUnit.

◆ prepareForINI()

virtual void BasicCustomUnit::prepareForINI ( const UnitManager & manager)
overridevirtual

Prepares internal state for INI serialization by capturing the current unit name.

Parameters
[in]managerThe UnitManager providing unit context.

Reimplemented from CustomUnit.

◆ setupINI()

virtual void BasicCustomUnit::setupINI ( INIFactory & ini)
overridevirtual

Registers this custom unit's settings with the given INI factory.

Parameters
[in]iniThe INI factory to register with.

Implements CustomUnit.

◆ title()

virtual TranslatedString BasicCustomUnit::title ( ) const
inlinenodiscardoverridevirtual

Returns the display title for this custom unit.

Returns
The translated title string.

Reimplemented from CustomUnit.

Definition at line 327 of file UnitManager.h.

References m_title.

Referenced by BasicCustomUnit().

◆ unitResource()

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

Returns a mutable reference to the resource holding the current unit.

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: