# DecimalPrefix Class Reference

A decimal (metric) prefix. More...

`#include <Prefix.h>`

Inheritance diagram for DecimalPrefix:

List of all members.

## 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

## Protected Attributes

int | exp

## 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 | ( | int | exp10,
|  | string | long_name,
|  | string | short_name = `""`,
|  | string | unicode_name = `""` |
| ) |  |  |

Create a decimal prefix.

Parameters:

  | exp10 | Exponent for the value.
  | long_name | Long name.
  | short_name | Short name.
  | unicode_name | Unicode name.

## Member Function Documentation

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

Returns the exponent.

Parameters:

  | iexp | Exponent of the unit.

Returns:
  The exponent of the prefix.

Number DecimalPrefix::exponent | ( | const Number & | nexp | ) | const

Returns the exponent.

Parameters:

  | nexp | Exponent of the unit.

Returns:
  The exponent of the prefix.

void DecimalPrefix::setExponent | ( | int | iexp | ) |

Sets the exponent of the prefix.

Parameters:

  | iexp | New exponent for the prefix.

Number DecimalPrefix::value | ( | const Number & | nexp | ) | const`[virtual]`

Returns the value of the prefix.

Parameters:

  | nexp | The power of the prefixed unit.

Returns:
  The value of the prefix.

Implements Prefix.

Number DecimalPrefix::value | ( | int | iexp | ) | const`[virtual]`

Returns the value of the prefix.

Parameters:

  | iexp | The power of the prefixed unit.

Returns:
  The value of the prefix.

Implements Prefix.

Number DecimalPrefix::value | ( |  | ) | const`[virtual]`

Returns the value of the prefix.

Returns:
  The value of the prefix.

Implements Prefix.

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.

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

- libqalculate/Prefix.h