DuxReiNummariae 1.1.0-alpha.19
Simple and powerful budgeting application
Loading...
Searching...
No Matches
drn::budgeting::BudgetedMoney Class Reference

Represents a budget item with monetary value that regularly occurs. More...

#include <BudgetedMoney.hpp>

Inheritance diagram for drn::budgeting::BudgetedMoney:
Collaboration diagram for drn::budgeting::BudgetedMoney:

Public Member Functions

 BudgetedMoney ()
 Constructs all member variables to their empty state.
 BudgetedMoney (BudgetedMoney &&) noexcept=default
 BudgetedMoney (BudgetSource source)
 Constructs all member variables to their empty state apart from the source.
 BudgetedMoney (BudgetSource source, pecunia::Money amount, const EventFrequency &period, const ::QDate &nextOccurOn)
 Fully initialises all member variables to their supplied values.
 BudgetedMoney (const BudgetedMoney &)=delete
 ~BudgetedMoney () override=default
const pecunia::Money & amount () const noexcept
 The amount expected per period for the money.
const ::QDate & nextOccurOn () const noexcept
 The date the budgeted money item occurs on next.
bool operator!= (const BudgetedMoney &other) const
 Inequality operator compares all members.
std::strong_ordering operator<=> (const BudgetedMoney &other) const noexcept
 Compares the current instance with another instance.
BudgetedMoneyoperator= (BudgetedMoney &&) noexcept=default
BudgetedMoneyoperator= (const BudgetedMoney &)=delete
bool operator== (const BudgetedMoney &other) const
 Equality operator compares all members.
const EventFrequencyperiod () const noexcept
 The frequency at which the money event occurs.
void rename (BudgetSource source)
 Changes the source of the money.
const BudgetSourcesource () const noexcept
 The identifier of the source for the money.
void updateNextOccurOn ()
 Updates the next occur on date by the event frequency period.
Public Member Functions inherited from drn::foundation::RequireClonable< BudgetedMoney >
virtual ~RequireClonable ()=default
virtual std::unique_ptr< BudgetedMoney > clone () const=0
 When implemented, creates a polymorphic deep copy of the object.

Protected Member Functions

void assign (const BudgetedMoney &other)
 Assigns the values from another BudgetedMoney instance to the current instance.

Detailed Description

Represents a budget item with monetary value that regularly occurs.

Constructor & Destructor Documentation

◆ BudgetedMoney() [1/5]

drn::budgeting::BudgetedMoney::BudgetedMoney ( )

Constructs all member variables to their empty state.

Here is the caller graph for this function:

◆ BudgetedMoney() [2/5]

drn::budgeting::BudgetedMoney::BudgetedMoney ( BudgetSource source)
explicit

Constructs all member variables to their empty state apart from the source.

Exceptions
BudgetItemErrorWhen the source is empty.
Parameters
sourceThe source of the money budget item.
Here is the call graph for this function:

◆ BudgetedMoney() [3/5]

drn::budgeting::BudgetedMoney::BudgetedMoney ( BudgetSource source,
pecunia::Money amount,
const EventFrequency & period,
const ::QDate & nextOccurOn )

Fully initialises all member variables to their supplied values.

Exceptions
BudgetItemErrorWhen the source is empty.
BudgetItemErrorWhen the amount is less then zero.
BudgetItemErrorWhen the amount is not issued in a known currency.
BudgetItemErrorWhen the period is not known.
BudgetItemErrorWhen the next occur date is invalid.
Parameters
sourceThe source of the money budget item.
amountThe amount the money is for every period.
periodThe frequency period of the event for the money.
nextOccurOnThe date the money budget item last occurred on.
Here is the call graph for this function:

◆ BudgetedMoney() [4/5]

drn::budgeting::BudgetedMoney::BudgetedMoney ( const BudgetedMoney & )
delete
Here is the call graph for this function:

◆ BudgetedMoney() [5/5]

drn::budgeting::BudgetedMoney::BudgetedMoney ( BudgetedMoney && )
defaultnoexcept
Here is the call graph for this function:

◆ ~BudgetedMoney()

drn::budgeting::BudgetedMoney::~BudgetedMoney ( )
overridedefault
Here is the call graph for this function:

Member Function Documentation

◆ amount()

const pecunia::Money & drn::budgeting::BudgetedMoney::amount ( ) const
nodiscardnoexcept

The amount expected per period for the money.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign()

void drn::budgeting::BudgetedMoney::assign ( const BudgetedMoney & other)
protected

Assigns the values from another BudgetedMoney instance to the current instance.

Copies all member variables from the given BudgetedMoney object into the current object. It is used internally by copy-related operations to ensure consistent transfer of state between instances, but makes /no/ validation of the data.

Parameters
otherThe instance whose values are to be assigned to the current instance.
Here is the call graph for this function:

◆ nextOccurOn()

const ::QDate & drn::budgeting::BudgetedMoney::nextOccurOn ( ) const
nodiscardnoexcept

The date the budgeted money item occurs on next.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool drn::budgeting::BudgetedMoney::operator!= ( const BudgetedMoney & other) const

Inequality operator compares all members.

Parameters
otherThe other object whose members should all not be equal.
Returns
When all member variables are not the same it'll give true, else false.
Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering drn::budgeting::BudgetedMoney::operator<=> ( const BudgetedMoney & other) const
noexcept

Compares the current instance with another instance.

Compares all member variables of the current instance against the provided instance.

Parameters
otherThe other instance to compare against.
Returns
Gives the comparison as performed in the following order of priority: source, period, nextOccurOn, and amount. The first non-equivalent member determines the ordering result. Gives the comparison result:
  • std::strong_ordering::less if the current instance is less than the other.
  • std::strong_ordering::equal if the two instances are equivalent.
  • std::strong_ordering::greater if the current instance is greater than the other.
Here is the call graph for this function:

◆ operator=() [1/2]

BudgetedMoney & drn::budgeting::BudgetedMoney::operator= ( BudgetedMoney && )
defaultnoexcept
Here is the call graph for this function:

◆ operator=() [2/2]

BudgetedMoney & drn::budgeting::BudgetedMoney::operator= ( const BudgetedMoney & )
delete
Here is the call graph for this function:

◆ operator==()

bool drn::budgeting::BudgetedMoney::operator== ( const BudgetedMoney & other) const

Equality operator compares all members.

Parameters
otherThe other object whose members should all be equal.
Returns
When all member variables are the same it'll give true, else false.
Here is the call graph for this function:

◆ period()

const EventFrequency & drn::budgeting::BudgetedMoney::period ( ) const
nodiscardnoexcept

The frequency at which the money event occurs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rename()

void drn::budgeting::BudgetedMoney::rename ( BudgetSource source)

Changes the source of the money.

Exceptions
BudgetItemErrorWhen the new source is empty.
Parameters
sourceThe new source for the money.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ source()

const BudgetSource & drn::budgeting::BudgetedMoney::source ( ) const
nodiscardnoexcept

The identifier of the source for the money.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateNextOccurOn()

void drn::budgeting::BudgetedMoney::updateNextOccurOn ( )

Updates the next occur on date by the event frequency period.

Exceptions
BudgetItemErrorWhen event frequency period is not known.
BudgetItemErrorWhen the next occur date is not valid.
Here is the call graph for this function:
Here is the caller graph for this function: