libqalculate-2.0.0
Public Member Functions | Protected Attributes | List of all members
DecimalPrefix Class Reference

A decimal (metric) prefix. More...

#include <Prefix.h>

Inheritance diagram for DecimalPrefix:
Prefix

Public Member Functions

 DecimalPrefix (int exp10, string long_name, string short_name="", string unicode_name="")
 
int exponent (int iexp=1) const
 
Number exponent (const Number &nexp) const
 
void setExponent (int iexp)
 
Number value (const Number &nexp) const
 
Number value (int iexp) const
 
Number value () const
 
int type () const
 
- Public Member Functions inherited from Prefix
 Prefix (string long_name, string short_name="", string unicode_name="")
 
const string & shortName (bool return_long_if_no_short=true, bool use_unicode=false) const
 
const string & longName (bool return_short_if_no_long=true, bool use_unicode=false) const
 
const string & unicodeName (bool return_short_if_no_uni=true) const
 
void setShortName (string short_name)
 
void setLongName (string long_name)
 
void setUnicodeName (string unicode_name)
 
const string & name (bool short_default=true, bool use_unicode=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 

Protected Attributes

int exp
 
- Protected Attributes inherited from Prefix
string l_name
 
string s_name
 
string u_name
 

Detailed Description

A decimal (metric) prefix.

A metric or decimal prefix has an integer exponent which with a base of ten constitutes the value of the prefix (value=10^exponent).

Constructor & Destructor Documentation

◆ DecimalPrefix()

DecimalPrefix::DecimalPrefix ( int  exp10,
string  long_name,
string  short_name = "",
string  unicode_name = "" 
)

Create a decimal prefix.

Parameters
exp10Exponent for the value.
long_nameLong name.
short_nameShort name.
unicode_nameUnicode name.

Member Function Documentation

◆ exponent() [1/2]

int DecimalPrefix::exponent ( int  iexp = 1) const

Returns the exponent.

Parameters
iexpExponent of the unit.
Returns
The exponent of the prefix.

◆ exponent() [2/2]

Number DecimalPrefix::exponent ( const Number nexp) const

Returns the exponent.

Parameters
nexpExponent of the unit.
Returns
The exponent of the prefix.

◆ setExponent()

void DecimalPrefix::setExponent ( int  iexp)

Sets the exponent of the prefix.

Parameters
iexpNew exponent for the prefix.

◆ type()

int DecimalPrefix::type ( ) const
virtual

Returns type, subclass, of the prefix. This can be PREFIX_DECIMAL for prefixes of the class DecimalPrefix, PREFIX_BINARY for BinaryPrefix, or PREFIX_NUMBER for NumberPrefix.

Returns
The type of the prefix.

Implements Prefix.

◆ value() [1/3]

Number DecimalPrefix::value ( const Number nexp) const
virtual

Returns the value of the prefix.

Parameters
nexpThe power of the prefixed unit.
Returns
The value of the prefix.

Implements Prefix.

◆ value() [2/3]

Number DecimalPrefix::value ( int  iexp) const
virtual

Returns the value of the prefix.

Parameters
iexpThe power of the prefixed unit.
Returns
The value of the prefix.

Implements Prefix.

◆ value() [3/3]

Number DecimalPrefix::value ( ) const
virtual

Returns the value of the prefix.

Returns
The value of the prefix.

Implements Prefix.


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