DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::conversion::OpenExchangeRatesSource Class Referencefinal

Manages the details of fetching conversion rates between two currencies from the Open Exchange Rates, https://openexchangerates.org/ . More...

#include <OpenExchangeRatesSource.h>

Inheritance diagram for drn::conversion::OpenExchangeRatesSource:
Collaboration diagram for drn::conversion::OpenExchangeRatesSource:

Public Member Functions

 OpenExchangeRatesSource (networking::NotifyingSender &sender, QString appId, foundation::QtPtr< QObject > parent)
 Full initialisation constructor.
 
 ~OpenExchangeRatesSource () override
 
const QString & applicationId () const
 The application identifier for the OER servers.
 
pecunia::FloatingPoint fetch (const pecunia::Currency &from, const pecunia::Currency &to) const override
 Synchronously retrieves the conversion from one currency code to another.
 
- Public Member Functions inherited from drn::conversion::CurrencySource
 CurrencySource (const foundation::QtPtr< QObject > &parent)
 Full initialisation constructor.
 

Static Public Attributes

static constexpr auto host_ {"openexchangerates.org"}
 

Detailed Description

Manages the details of fetching conversion rates between two currencies from the Open Exchange Rates, https://openexchangerates.org/ .

Constructor & Destructor Documentation

◆ OpenExchangeRatesSource()

drn::conversion::OpenExchangeRatesSource::OpenExchangeRatesSource ( networking::NotifyingSender & sender,
QString appId,
foundation::QtPtr< QObject > parent )

Full initialisation constructor.

Parameters
senderThe object through which the network is accessible for sending requests.
appIdThe application identifier for the OER servers.
parentThe parent widget of the object.

◆ ~OpenExchangeRatesSource()

drn::conversion::OpenExchangeRatesSource::~OpenExchangeRatesSource ( )
override

Member Function Documentation

◆ applicationId()

const QString & drn::conversion::OpenExchangeRatesSource::applicationId ( ) const
nodiscard

The application identifier for the OER servers.

◆ fetch()

pecunia::FloatingPoint drn::conversion::OpenExchangeRatesSource::fetch ( const pecunia::Currency & from,
const pecunia::Currency & to ) const
overridevirtual

Synchronously retrieves the conversion from one currency code to another.

Exceptions
ReplyErrorWhen it fails to during the reply of a conversion request.
ParsingErrorWhen the data returned contains an error.
Parameters
fromThe currency to convert from.
toThe currency to convert to.
Returns
The ratio that when multiplied will take the value of "from" to the value of "to".

Implements drn::conversion::CurrencySource.

Member Data Documentation

◆ host_

auto drn::conversion::OpenExchangeRatesSource::host_ {"openexchangerates.org"}
staticconstexpr