ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
active::measure::MassUnit Struct Reference

#include <MassUnit.h>

Inheritance diagram for active::measure::MassUnit:
Inheritance graph
[legend]
Collaboration diagram for active::measure::MassUnit:
Collaboration graph
[legend]

Public Types

using Type = MassType
 

Public Member Functions

 MassUnit ()
 
 MassUnit (MassType type, uint8_t prec, bool isDecimal=true, bool suffixes=true)
 
 MassUnit (MassType first, MassType second, uint8_t prec, bool isDecimal=true)
 
- Public Member Functions inherited from active::measure::Unit< MassUnit, MassType >
 Unit (MassType type)
 
 Unit (MassType first, MassType second)
 
 Unit (MassType type, uint8_t prec, bool isDecimal=true, bool suffixes=true)
 
 Unit (MassType first, MassType second, uint8_t prec, bool isDecimal=true)
 
 Unit (MassType first, MassType second, MassType third, uint8_t prec, bool isDecimal=true)
 
bool isDecimal () const
 
double divisor () const
 
double eps () const
 
bool isMetric (MassType type) const
 
double simpleRatio (double value, double factor, bool reversed) const
 
double conversion (MassType type, double value, bool reversed=false) const
 
utility::String suffix (MassType type) const
 
std::optional< MassTypefromTag (const utility::String &text) const
 
utility::String toTag (MassType type) const
 
std::optional< std::pair< MassType, utility::String::size_type > > findSuffix (const utility::String &text, utility::String::size_type startPos=0) const
 

Static Public Member Functions

static MassUnit grams (uint8_t prec=1, bool suffixes=true)
 
static MassUnit kilograms (uint8_t prec=4, bool suffixes=true)
 
static MassUnit pounds (uint8_t prec=4, bool suffixes=true)
 

Friends

struct Unit
 

Additional Inherited Members

- Public Attributes inherited from active::measure::Unit< MassUnit, MassType >
MassType primary
 The primary unit to display.
 
std::optional< MassTypesecondary
 An optional secondary unit, e.g. for foot/inch combos (nullopt = none)
 
std::optional< MassTypetertiary
 An optional teriary unit, e.g. for degrees/minutes/seconds combos (nullopt = none, ignored if no secondary unit)
 
uint8_t precision
 The display precision (decimal places for metric or 2^-n for fractional units.
 
double base
 The numeric base for fractional quantities (10.0 = floating point to specified decimal places, other values create a fraction)
 
bool isUnitSuffix
 True if values should be displayed with a unit suffix, e.g. "100.0mm" rather than "100.0" (always true when multiple units)
 
bool isLeadingZero
 True if a value is displayed with multiple units and zero values (apart from the last unit) should be included, e.g. 0' 10" vs 10".
 

Detailed Description

Structure to represent mass units

Constructor & Destructor Documentation

◆ MassUnit() [1/3]

active::measure::MassUnit::MassUnit ( )
inline

Default constructor

Default constructor

◆ MassUnit() [2/3]

active::measure::MassUnit::MassUnit ( MassType type,
uint8_t prec,
bool isDecimal = true,
bool suffixes = true )
inline

Constructor

Parameters
typeThe primary unit type
precThe unit display precision (decimal places for metric or 2^-n for fractional units)
isDecimalTrue if fractional values should display as decimal (floating point) numbers
suffixesTrue if the value should be displayed with the unit suffix, e.g. 100mm

◆ MassUnit() [3/3]

active::measure::MassUnit::MassUnit ( MassType first,
MassType second,
uint8_t prec,
bool isDecimal = true )
inline

Constructor

Parameters
firstThe primary unit type
secondThe secondary unit type
precThe unit display precision (decimal places for metric or 2^-n for fractional units)
isDecimalTrue if fractional values should display as decimal (floating point) numbers

The documentation for this struct was generated from the following files: