DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::accounting::AccountNumberGenerator Class Referenceabstract

A generalised generator for account code numbers. More...

#include <AccountNumberGenerator.h>

Inheritance diagram for drn::accounting::AccountNumberGenerator:
Collaboration diagram for drn::accounting::AccountNumberGenerator:

Public Member Functions

 AccountNumberGenerator (AccountNumber number={})
 Constructor for fully initialising the generator.
 
 AccountNumberGenerator (AccountNumberGenerator &&) noexcept=default
 
 AccountNumberGenerator (const AccountNumberGenerator &)=default
 
virtual ~AccountNumberGenerator ()=default
 
virtual std::unique_ptr< AccountNumberGeneratorclone () const =0
 When implemented, will clone all data members of the object.
 
virtual AccountNumber current (const std::set< Account > &accounts) const =0
 When implemented, finds the current largest account code number relevant to the account code generator in the account listings.
 
const AccountNumberoperator* () const
 Dereference operator to the current generated account code number.
 
const AccountNumberoperator++ ()
 Prefix incremental operator to advance to the next account code number.
 
AccountNumber operator++ (int)
 Postfix incremental operator to advance to the next account code number.
 
const AccountNumberoperator-- ()
 Prefix decremental operator to go back to the previous account code number.
 
AccountNumber operator-- (int)
 Postfix decremental operator to go back to the previous account code number.
 
AccountNumberGeneratoroperator= (AccountNumberGenerator &&) noexcept=default
 
AccountNumberGeneratoroperator= (const AccountNumber &number)
 Assignment operator for setting the current generated account code number.
 
AccountNumberGeneratoroperator= (const AccountNumberGenerator &)=default
 
void update (AccountNumber an)
 Updates the current account number to the supplied number when it is larger.
 

Protected Member Functions

virtual AccountNumber decrement () const =0
 When implemented produces the previous account code number.
 
virtual AccountNumber increment () const =0
 When implemented produces the next account code number.
 
virtual bool isLarger (const AccountNumber &an) const =0
 When implemented, determines if two account numbers are larger than the other.
 
const AccountNumbernumber () const noexcept
 An accessor to the current account code number.
 

Detailed Description

A generalised generator for account code numbers.

Constructor & Destructor Documentation

◆ AccountNumberGenerator() [1/3]

drn::accounting::AccountNumberGenerator::AccountNumberGenerator ( AccountNumber number = {})
explicit

Constructor for fully initialising the generator.

Parameters
numberThe current account code number that is used.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AccountNumberGenerator() [2/3]

drn::accounting::AccountNumberGenerator::AccountNumberGenerator ( const AccountNumberGenerator & )
default
Here is the call graph for this function:

◆ AccountNumberGenerator() [3/3]

drn::accounting::AccountNumberGenerator::AccountNumberGenerator ( AccountNumberGenerator && )
defaultnoexcept
Here is the call graph for this function:

◆ ~AccountNumberGenerator()

virtual drn::accounting::AccountNumberGenerator::~AccountNumberGenerator ( )
virtualdefault
Here is the call graph for this function:

Member Function Documentation

◆ clone()

virtual std::unique_ptr< AccountNumberGenerator > drn::accounting::AccountNumberGenerator::clone ( ) const
nodiscardpure virtual

When implemented, will clone all data members of the object.

Returns
The cloned object.

Implemented in drn::accounting::SequentialAccountNumberGenerator.

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

◆ current()

virtual AccountNumber drn::accounting::AccountNumberGenerator::current ( const std::set< Account > & accounts) const
nodiscardpure virtual

When implemented, finds the current largest account code number relevant to the account code generator in the account listings.

Parameters
accountsThe current listing of all the accounts in the account ledger.
Returns
The current highest account code number found, or default empty if there is not any.

Implemented in drn::accounting::SequentialAccountNumberGenerator.

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

◆ decrement()

virtual AccountNumber drn::accounting::AccountNumberGenerator::decrement ( ) const
nodiscardprotectedpure virtual

When implemented produces the previous account code number.

Exceptions
ErrorWhen the previous account code number cannot be generated.
Returns
The previous account code number generated.

◆ increment()

virtual AccountNumber drn::accounting::AccountNumberGenerator::increment ( ) const
nodiscardprotectedpure virtual

When implemented produces the next account code number.

Exceptions
ErrorWhen the next account code number cannot be generated.
Returns
The next account code number generated.

◆ isLarger()

virtual bool drn::accounting::AccountNumberGenerator::isLarger ( const AccountNumber & an) const
nodiscardprotectedpure virtual

When implemented, determines if two account numbers are larger than the other.

Parameters
anThe account number to compare against the current account number.
Returns
True when the account number is considered to be larger than the current account number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ number()

const AccountNumber & drn::accounting::AccountNumberGenerator::number ( ) const
nodiscardprotectednoexcept

An accessor to the current account code number.

Returns
The current account code number.
Here is the caller graph for this function:

◆ operator*()

const AccountNumber & drn::accounting::AccountNumberGenerator::operator* ( ) const
nodiscard

Dereference operator to the current generated account code number.

◆ operator++() [1/2]

const AccountNumber & drn::accounting::AccountNumberGenerator::operator++ ( )

Prefix incremental operator to advance to the next account code number.

Exceptions
ErrorWhen the next account code number cannot be generated.
Returns
The next generated account code number.

◆ operator++() [2/2]

AccountNumber drn::accounting::AccountNumberGenerator::operator++ ( int )
nodiscard

Postfix incremental operator to advance to the next account code number.

Exceptions
ErrorWhen the next account code number cannot be generated.
Returns
The current generated account code number.

◆ operator--() [1/2]

const AccountNumber & drn::accounting::AccountNumberGenerator::operator-- ( )

Prefix decremental operator to go back to the previous account code number.

Exceptions
ErrorWhen the previous account code number cannot be generated.
Returns
The current generated account code number.

◆ operator--() [2/2]

AccountNumber drn::accounting::AccountNumberGenerator::operator-- ( int )
nodiscard

Postfix decremental operator to go back to the previous account code number.

Exceptions
ErrorWhen the previous account code number cannot be generated.
Returns
The previous generated account code number.

◆ operator=() [1/3]

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

◆ operator=() [2/3]

AccountNumberGenerator & drn::accounting::AccountNumberGenerator::operator= ( const AccountNumber & number)

Assignment operator for setting the current generated account code number.

Parameters
numberThe number to set the account code number generated to.
Returns
The current instance.
Here is the call graph for this function:

◆ operator=() [3/3]

AccountNumberGenerator & drn::accounting::AccountNumberGenerator::operator= ( const AccountNumberGenerator & )
default
Here is the call graph for this function:

◆ update()

void drn::accounting::AccountNumberGenerator::update ( AccountNumber an)

Updates the current account number to the supplied number when it is larger.

Parameters
anThe account number to update to if it is larger than the current account number value.
Here is the call graph for this function:
Here is the caller graph for this function: