ledger-core
Public Member Functions | List of all members
ledger::core::Amount Class Reference
+ Inheritance diagram for ledger::core::Amount:
+ Collaboration diagram for ledger::core::Amount:

Public Member Functions

 Amount (const api::Currency &currency, int32_t unitIndex, const BigInt &value)
 
 Amount (const api::Currency &currency, int32_t unitIndex, BigInt &&value)
 
std::shared_ptr< api::BigInttoBigInt () override
 
api::Currency getCurrency () override
 
api::CurrencyUnit getUnit () override
 
std::shared_ptr< api::AmounttoUnit (const api::CurrencyUnit &unit) override
 
std::string toString () override
 
int64_t toLong () override
 
double toDouble () override
 
std::string format (const api::Locale &locale, const optional< api::FormatRules > &rules) override
 
std::shared_ptr< api::AmounttoMagnitude (int32_t magnitude) override
 
std::shared_ptr< ledger::core::BigIntvalue () const
 
- Public Member Functions inherited from ledger::core::api::Amount
virtual std::string format (const Locale &locale, const std::experimental::optional< FormatRules > &rules)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from ledger::core::api::Amount
static std::shared_ptr< AmountfromHex (const Currency &currency, const std::string &hex)
 
static std::shared_ptr< AmountfromLong (const Currency &currency, int64_t value)
 

Member Function Documentation

◆ getCurrency()

api::Currency ledger::core::Amount::getCurrency ( )
overridevirtual

Get currency in which amount was computed.

Returns
Currency object

Implements ledger::core::api::Amount.

◆ getUnit()

api::CurrencyUnit ledger::core::Amount::getUnit ( )
overridevirtual

Get currency unit in which amount was computed.

Returns
CurrencyUnit object

Implements ledger::core::api::Amount.

◆ toBigInt()

std::shared_ptr< api::BigInt > ledger::core::Amount::toBigInt ( )
overridevirtual

Get amount as a BigInt.

Returns
BigInt

Implements ledger::core::api::Amount.

◆ toDouble()

double ledger::core::Amount::toDouble ( )
overridevirtual

Get amount as double

Returns
double

Implements ledger::core::api::Amount.

◆ toLong()

int64_t ledger::core::Amount::toLong ( )
overridevirtual

Get amount as long

Returns
64 bits integer

Implements ledger::core::api::Amount.

◆ toMagnitude()

std::shared_ptr< api::Amount > ledger::core::Amount::toMagnitude ( int32_t  magnitude)
overridevirtual

Get an amount that is equal to the given magnitude in the units system.

Implements ledger::core::api::Amount.

◆ toString()

std::string ledger::core::Amount::toString ( )
overridevirtual

Get amount as string

Returns
string

Implements ledger::core::api::Amount.

◆ toUnit()

std::shared_ptr< api::Amount > ledger::core::Amount::toUnit ( const api::CurrencyUnit unit)
overridevirtual

Convert amount in another currency unit.

Parameters
CurrencyUnitobject, target currency unit
Returns
Amount object, amount in target currency unit

Implements ledger::core::api::Amount.


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