PIP 6.1.0
Platform-Independent Primitives
Loading...
Searching...
No Matches
PIUnits::Value Class Reference

Numeric value paired with a registered unit type. More...

#include <piunits_value.h>

Public Member Functions

 Value (double v=0., int t=Class::Invalid)
 Constructs value "v" of unit type "t".
bool isValid () const
 Returns whether the value references a registered unit type.
bool isNotValid () const
 Returns whether the value has no registered unit type.
double value () const
 Returns stored numeric value.
PIString toString (char format='g', int prec=5) const
 Formats the value with localized unit suffix and automatic prefix when supported.
bool convert (int type_to)
 Converts the value to unit type "type_to" inside the same unit family.
Value converted (int type_to)
 Returns converted copy in unit type "type_to", or invalid value on failure.

(Note that these are not member symbols.)

PICout operator<< (PICout s, const PIUnits::Value &v)
 Writes formatted unit value to PICout.

Detailed Description

Numeric value paired with a registered unit type.