A generalised generator for account code numbers. More...
#include <AccountNumberGenerator.h>
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< AccountNumberGenerator > | clone () 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 AccountNumber & | operator* () const |
Dereference operator to the current generated account code number. | |
const AccountNumber & | operator++ () |
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 AccountNumber & | operator-- () |
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. | |
AccountNumberGenerator & | operator= (AccountNumberGenerator &&) noexcept=default |
AccountNumberGenerator & | operator= (const AccountNumber &number) |
Assignment operator for setting the current generated account code number. | |
AccountNumberGenerator & | operator= (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 AccountNumber & | number () const noexcept |
An accessor to the current account code number. | |
A generalised generator for account code numbers.
|
explicit |
Constructor for fully initialising the generator.
number | The current account code number that is used. |
|
default |
|
defaultnoexcept |
|
virtualdefault |
|
nodiscardpure virtual |
When implemented, will clone all data members of the object.
Implemented in drn::accounting::SequentialAccountNumberGenerator.
|
nodiscardpure virtual |
When implemented, finds the current largest account code number relevant to the account code generator in the account listings.
accounts | The current listing of all the accounts in the account ledger. |
Implemented in drn::accounting::SequentialAccountNumberGenerator.
|
nodiscardprotectedpure virtual |
When implemented produces the previous account code number.
Error | When the previous account code number cannot be generated. |
|
nodiscardprotectedpure virtual |
When implemented produces the next account code number.
Error | When the next account code number cannot be generated. |
|
nodiscardprotectedpure virtual |
When implemented, determines if two account numbers are larger than the other.
an | The account number to compare against the current account number. |
|
nodiscardprotectednoexcept |
An accessor to the current account code number.
|
nodiscard |
Dereference operator to the current generated account code number.
const AccountNumber & drn::accounting::AccountNumberGenerator::operator++ | ( | ) |
Prefix incremental operator to advance to the next account code number.
Error | When the next account code number cannot be generated. |
|
nodiscard |
Postfix incremental operator to advance to the next account code number.
Error | When the next account code number cannot be generated. |
const AccountNumber & drn::accounting::AccountNumberGenerator::operator-- | ( | ) |
Prefix decremental operator to go back to the previous account code number.
Error | When the previous account code number cannot be generated. |
|
nodiscard |
Postfix decremental operator to go back to the previous account code number.
Error | When the previous account code number cannot be generated. |
|
defaultnoexcept |
AccountNumberGenerator & drn::accounting::AccountNumberGenerator::operator= | ( | const AccountNumber & | number | ) |
Assignment operator for setting the current generated account code number.
number | The number to set the account code number generated to. |
|
default |
void drn::accounting::AccountNumberGenerator::update | ( | AccountNumber | an | ) |
Updates the current account number to the supplied number when it is larger.
an | The account number to update to if it is larger than the current account number value. |