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

#include <LengthUnit.h>

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

Public Types

using Type = LengthType
 

Public Member Functions

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

Static Public Member Functions

static LengthUnit millimetres (uint8_t prec=1, bool suffixes=true)
 
static LengthUnit centimetres (uint8_t prec=2, bool suffixes=true)
 
static LengthUnit metres (uint8_t prec=4, bool suffixes=true)
 
static LengthUnit decimalInches (uint8_t prec=3, bool suffixes=true)
 
static LengthUnit decimalFeet (uint8_t prec=4, bool suffixes=true)
 
static LengthUnit feetDecInches (uint8_t prec=3)
 
static LengthUnit feetFracInches (uint8_t prec=6)
 

Friends

struct Unit
 

Additional Inherited Members

- Public Attributes inherited from active::measure::Unit< LengthUnit, LengthType >
LengthType primary
 The primary unit to display.
 
std::optional< LengthTypesecondary
 An optional secondary unit, e.g. for foot/inch combos (nullopt = none)
 
std::optional< LengthTypetertiary
 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 length units

Constructor & Destructor Documentation

◆ LengthUnit() [1/3]

active::measure::LengthUnit::LengthUnit ( )
inline

Default constructor

◆ LengthUnit() [2/3]

active::measure::LengthUnit::LengthUnit ( LengthType 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

◆ LengthUnit() [3/3]

active::measure::LengthUnit::LengthUnit ( LengthType first,
LengthType 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: