NDEVR
API Documentation

A definition of how to describe a particular set of data to a custom category of unit. More...

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

Public Member Functions

 BasicUnitOption (const ConstPointer< Unit > &unit, const TranslatedString &custom_title=TranslatedString())
 Constructs a BasicUnitOption from a unit and an optional custom title.
virtual Buffer< ConstPointer< UnitOption > > & editSubOptions ()
 Returns a mutable reference to the sub-options for editing.
virtual bool hasMemberUnit (const ConstPointer< Unit > &unit) const final override
 Checks whether the given unit matches this option or any sub-option.
virtual Buffer< ConstPointer< UnitOption > > subOptions () const final override
 Returns the sub-options for this unit option.
virtual TranslatedString title () const final override
 Returns the display title, using the custom title if set.
virtual ConstPointer< Unitunit () const final override
 Returns the base unit for this option.
Public Member Functions inherited from UnitOption
 UnitOption (const StringView &id, const TranslatedString &name)
 Constructs a UnitOption with the given identifier and display name.
virtual ~UnitOption ()
 Virtual destructor.
virtual ConstPointer< Unitunit (const ConstPointer< Unit > &) const
 Returns a unit resolved relative to the given unit context.

Public Attributes

ConstPointer< Unitbase_unit
 The underlying unit this option wraps.
TranslatedString custom_title
 An optional custom display title.
Public Attributes inherited from UnitOption
String id
 The unique string identifier of this unit option.
TranslatedString name
 The translated display name of this unit option.

Protected Attributes

Buffer< ConstPointer< UnitOption > > m_sub_options
 Child sub-options within this unit option.

Detailed Description

A definition of how to describe a particular set of data to a custom category of unit.


Definition at line 70 of file UnitManager.h.

Constructor & Destructor Documentation

◆ BasicUnitOption()

BasicUnitOption::BasicUnitOption ( const ConstPointer< Unit > & unit,
const TranslatedString & custom_title = TranslatedString() )
inline

Constructs a BasicUnitOption from a unit and an optional custom title.

Parameters
[in]unitThe unit this option represents.
[in]custom_titleAn optional custom translated title to override the unit name.

Definition at line 78 of file UnitManager.h.

References UnitOption::UnitOption(), base_unit, custom_title, UnitOption::name, and unit().

Member Function Documentation

◆ editSubOptions()

virtual Buffer< ConstPointer< UnitOption > > & BasicUnitOption::editSubOptions ( )
inlinevirtual

Returns a mutable reference to the sub-options for editing.

Returns
A reference to the buffer of sub-options.

Definition at line 108 of file UnitManager.h.

References m_sub_options.

◆ hasMemberUnit()

virtual bool BasicUnitOption::hasMemberUnit ( const ConstPointer< Unit > & unit) const
finaloverridevirtual

Checks whether the given unit matches this option or any sub-option.

Parameters
[in]unitThe unit to check membership for.
Returns
True if the unit is a member of this option, false otherwise.

Implements UnitOption.

References hasMemberUnit(), and unit().

Referenced by hasMemberUnit().

◆ subOptions()

virtual Buffer< ConstPointer< UnitOption > > BasicUnitOption::subOptions ( ) const
inlinefinaloverridevirtual

Returns the sub-options for this unit option.

Returns
A buffer of const pointers to child UnitOption objects.

Reimplemented from UnitOption.

Definition at line 103 of file UnitManager.h.

References m_sub_options.

◆ title()

virtual TranslatedString BasicUnitOption::title ( ) const
finaloverridevirtual

Returns the display title, using the custom title if set.

Returns
The translated title string.

Reimplemented from UnitOption.

◆ unit()

virtual ConstPointer< Unit > BasicUnitOption::unit ( ) const
inlinefinaloverridevirtual

Returns the base unit for this option.

Returns
A const pointer to the base unit.

Implements UnitOption.

Definition at line 98 of file UnitManager.h.

References base_unit, and unit().

Referenced by BasicUnitOption(), hasMemberUnit(), and unit().


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