|
Sen API
Sen Libraries
|
A registry of units. More...
#include <unit_registry.h>
Public Types | |
| using | UnitList = std::vector<Unit*> |
| using | UnitStorage = std::vector<std::unique_ptr<Unit>> |
| using | UnitRange = sen::util::IteratorRange<util::SmartPtrIteratorAdapter<UnitStorage::const_iterator>> |
Public Member Functions | |
| UnitRange | getUnits () const noexcept |
| The currently registered units. Does not include the builtin units. | |
| UnitList | getUnitsByCategory (UnitCategory category) const |
| Returns all registered units that belong to a given category. It also searches in the built-in units. | |
| std::optional< const Unit * > | searchUnitByName (std::string_view name) const |
| Tries to find a unit with a specific name (case sensitive) It also searches in the built-in units. Returns nullopt if the unit was not found, otherwise a valid pointer to the unit. | |
| std::optional< const Unit * > | searchUnitByAbbreviation (std::string_view abbrev) const |
| Tries to find a unit with a specific abbreviation (case sensitive). It also searches in the built-in units. Returns nullopt if the unit was not found, otherwise a valid pointer to the unit. | |
Static Public Member Functions | |
| static const UnitRegistry & | get () |
A registry of units.
| using sen::UnitRegistry::UnitList = std::vector<Unit*> |
| using sen::UnitRegistry::UnitStorage = std::vector<std::unique_ptr<Unit>> |
| using sen::UnitRegistry::UnitRange = sen::util::IteratorRange<util::SmartPtrIteratorAdapter<UnitStorage::const_iterator>> |
|
static |
|
nodiscardnoexcept |
The currently registered units. Does not include the builtin units.
|
nodiscard |
Returns all registered units that belong to a given category. It also searches in the built-in units.
|
nodiscard |
Tries to find a unit with a specific name (case sensitive) It also searches in the built-in units. Returns nullopt if the unit was not found, otherwise a valid pointer to the unit.
|
nodiscard |
Tries to find a unit with a specific abbreviation (case sensitive). It also searches in the built-in units. Returns nullopt if the unit was not found, otherwise a valid pointer to the unit.