DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType > Struct Template Reference

Maps all the budgeted monies to their source. More...

#include <BudgetedMoneyMap.hpp>

Inheritance diagram for drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >:
Collaboration diagram for drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >:

Public Member Functions

 BudgetedMoneyMap (std::map< BudgetSource, BudgetedMoneyType > monies={})
 
void add (BudgetedMoneyType added)
 Places the new budgeted money into the budgeted monies indexed by its source.
 
const_iterator begin () const
 
const_iterator end () const
 
bool has (const BudgetSource &source) const
 Determines if a specific budgeted money exists within the budgeted monies.
 
std::strong_ordering operator<=> (const BudgetedMoneyMap &other) const noexcept
 
bool operator== (const BudgetedMoneyMap &) const noexcept=default
 
void remove (const BudgetSource &source)
 Removes an budgeted money from the budgeted monies.
 
void rename (const BudgetSource &original, BudgetSource changed)
 
std::set< BudgetSourcesources () const
 An accessor to all the known budgeted money sources.
 
pecunia::Money total (const pecunia::Currency &code, const EventFrequency period) const
 Calculates the total amount of budgeted monies.
 
void update (BudgetedMoneyType updated)
 Changes the budgeted money to the newly supplied one indexed by the source of the budgeted money. When the new budgeted money is not in the same currency as the existing entry, the new budgeted money will replace the existing entry, i.e. no currency conversions will take place.
 

Detailed Description

template<typename BudgetedMoneyType>
struct drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >

Maps all the budgeted monies to their source.

Template Parameters
BudgetedMoneyTypeThis is the type that is mapped to a budget item source. This type must derive from the BudgetedMoney class.

Constructor & Destructor Documentation

◆ BudgetedMoneyMap()

template<typename BudgetedMoneyType>
drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::BudgetedMoneyMap ( std::map< BudgetSource, BudgetedMoneyType > monies = {})
explicit
Here is the caller graph for this function:

Member Function Documentation

◆ add()

template<typename BudgetedMoneyType>
void drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::add ( BudgetedMoneyType added)

Places the new budgeted money into the budgeted monies indexed by its source.

Exceptions
BudgetItemErrorWhen the supplied budgeted money already exists in the budgeted monies.
Parameters
addedThe new budgeted money that is placed into the budgeted monies.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin()

template<typename BudgetedMoneyType>
drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::const_iterator drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::begin ( ) const
nodiscard
Here is the caller graph for this function:

◆ end()

template<typename BudgetedMoneyType>
drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::const_iterator drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::end ( ) const
nodiscard
Here is the caller graph for this function:

◆ has()

template<typename BudgetedMoneyType>
bool drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::has ( const BudgetSource & source) const
nodiscard

Determines if a specific budgeted money exists within the budgeted monies.

Parameters
sourceThe source of the budgeted money to check.
Returns
True when the budgeted money exists, false else-wise.
Here is the caller graph for this function:

◆ operator<=>()

template<typename BudgetedMoneyType>
std::strong_ordering drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::operator<=> ( const BudgetedMoneyMap< BudgetedMoneyType > & other) const
nodiscardnoexcept
Here is the call graph for this function:

◆ operator==()

template<typename BudgetedMoneyType>
bool drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::operator== ( const BudgetedMoneyMap< BudgetedMoneyType > & ) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ remove()

template<typename BudgetedMoneyType>
void drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::remove ( const BudgetSource & source)

Removes an budgeted money from the budgeted monies.

Exceptions
BudgetItemErrorWhen the supplied source does not exist.
Parameters
sourceThe budgeted money source to remove.
Here is the caller graph for this function:

◆ rename()

template<typename BudgetedMoneyType>
void drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::rename ( const BudgetSource & original,
BudgetSource changed )

Changes the source of an budgeted money, and updates it's mapping.

Exceptions
BudgetItemErrorWhen the supplied current source does not exist.
BudgetItemErrorWhen the supplied changed source already exists.
Parameters
originalThe current source of the budgeted money.
changedThe new source of the budgeted money.
Here is the call graph for this function:

◆ sources()

template<typename BudgetedMoneyType>
std::set< drn::budgeting::BudgetSource > drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::sources ( ) const
nodiscard

An accessor to all the known budgeted money sources.

Returns
The known sources.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ total()

template<typename BudgetedMoneyType>
pecunia::Money drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::total ( const pecunia::Currency & code,
const EventFrequency period ) const
nodiscard

Calculates the total amount of budgeted monies.

Parameters
codeThe issued currency to calculate the monies in.
periodThe frequency period all monies should be tabulated in.
Returns
The sum of the amounts.
Here is the call graph for this function:

◆ update()

template<typename BudgetedMoneyType>
void drn::budgeting::BudgetedMoneyMap< BudgetedMoneyType >::update ( BudgetedMoneyType updated)

Changes the budgeted money to the newly supplied one indexed by the source of the budgeted money. When the new budgeted money is not in the same currency as the existing entry, the new budgeted money will replace the existing entry, i.e. no currency conversions will take place.

Exceptions
BudgetItemErrorWhen the supplied source source does not exist.
Parameters
updatedThe new budgeted money to update the indexed entry to.
Here is the call graph for this function: