A representation of financial institutions mapped to their names. More...
#include <BankMap.h>
Public Member Functions | |
BankMap ()=default | |
Constructs a default instance. | |
BankMap (std::map< BankName, Bank > banks) | |
Full initialisation constructor. | |
void | add (Bank b) |
Adds a new financial institution to the container. | |
void | add (const BankName &name, const accounting::AccountNumber &number, const BankAccountTypes type) |
Adds an associated account to the financial institution. | |
const Bank & | bank (const BankName &bn) const |
An accessor to the bank via its financial institution name. | |
void | close (const BankName &name) |
Marks the financial institution as closed for usage. | |
std::optional< Bank > | find (const accounting::AccountNumber &number) const |
Finds the bank that is associated with a given account number. | |
bool | hasBank (const BankName &name) const |
Determines if a financial institution is in a container. | |
std::set< BankName > | names () const |
Collects all the known bank names. | |
void | open (const BankName &name) |
Marks the financial institution as opened for usage. | |
void | remove (const BankName &name) |
Removes the financial institution from the container. | |
void | remove (const BankName &name, const accounting::AccountNumber &number) |
Removes an associated account from the financial institution. | |
void | rename (const BankName &original, const BankName &changed) |
Renames the financial institution in the container. | |
void | update (Bank b) |
Updates the financial institution information. | |
Friends | |
DRN_BANKING_EXPORT std::ostream & | operator<< (std::ostream &o, const BankMap &bm) |
DRN_BANKING_EXPORT bool | operator== (const BankMap &lhs, const BankMap &rhs) |
A representation of financial institutions mapped to their names.
|
default |
Constructs a default instance.
This constructor initializes it with default values, ensuring it is ready to be used without prior setup.
Full initialisation constructor.
BankError | When a financial institution name key does not match its name. |
BankError | When a financial institution uses a general ledger account number used by another financial institution. |
BankError | When a financial institution uses the a default ledger account. |
banks | The financial institutions. |
void drn::banking::BankMap::add | ( | Bank | b | ) |
void drn::banking::BankMap::add | ( | const BankName & | name, |
const accounting::AccountNumber & | number, | ||
const BankAccountTypes | type ) |
Adds an associated account to the financial institution.
BankError | When the financial institution does not exist. |
BankError | When the account number is already associated with another financial institution. |
name | The name of the financial institution. |
number | The account number to add the association. |
An accessor to the bank via its financial institution name.
BankError | When the financial institution name does not exist. |
bn | The name of the financial institution to look-up. |
void drn::banking::BankMap::close | ( | const BankName & | name | ) |
Marks the financial institution as closed for usage.
BankError | When the financial institution does not exist. |
name | The name of the financial institution. |
|
nodiscard |
Finds the bank that is associated with a given account number.
number | The account number to find the associated bank. |
|
nodiscard |
Determines if a financial institution is in a container.
name | The name of the financial institution to check. |
|
nodiscard |
Collects all the known bank names.
void drn::banking::BankMap::open | ( | const BankName & | name | ) |
Marks the financial institution as opened for usage.
BankError | When the financial institution does not exist. |
name | The name of the financial institution. |
void drn::banking::BankMap::remove | ( | const BankName & | name | ) |
Removes the financial institution from the container.
BankError | When the financial institution does not exist. |
name | The name of the financial institution. |
void drn::banking::BankMap::remove | ( | const BankName & | name, |
const accounting::AccountNumber & | number ) |
Removes an associated account from the financial institution.
BankError | When the financial institution does not exist. |
BankError | When the financial institution does not have the account. |
name | The name of the financial institution. |
number | The account number to remove the association. |
Renames the financial institution in the container.
BankError | When the financial institution name to be changed does not exist. |
BankError | When the financial institution name to be changed and to be changed into are the same. |
BankError | When the financial institution name to change to already exists. |
original | The name of the financial institution. |
changed | The changed name of the financial institution. |
void drn::banking::BankMap::update | ( | Bank | b | ) |
Updates the financial institution information.
BankError | When the financial institution does not exist. |
BankError | When the financial institution to update is closed. |
BankError | When the financial institution's associated account ledger is already associated with another financial institution. |
b | The financial institution to update. |
|
friend |