The representation of a unique identifier and its associated name for an account. The only identifying item is the number, the name is a convenience for the user to associate the number with a name.
More...
#include <AccountCode.hpp>
The representation of a unique identifier and its associated name for an account. The only identifying item is the number, the name is a convenience for the user to associate the number with a name.
◆ AccountCode() [1/4]
| drn::accounting::AccountCode::AccountCode |
( |
| ) |
|
|
default |
◆ AccountCode() [2/4]
| drn::accounting::AccountCode::AccountCode |
( |
::QString | name, |
|
|
std::optional< AccountNumber > | parent = {} ) |
|
explicit |
Partially initialises the object with supplied account code name, and defaults the rest.
- Exceptions
-
- Parameters
-
| name | The unique name for the account, e.g. Cash. |
| parent | (Optional) The parent account number for the account. |
◆ AccountCode() [3/4]
Partially initialises the object with supplied values, and defaults the rest.
- Exceptions
-
- Parameters
-
| number | The unique number for the account, e.g. 1000. |
| parent | (Optional) The parent account number for the account. |
◆ AccountCode() [4/4]
Fully initialises the object.
- Exceptions
-
- Parameters
-
| number | The unique number for the account, e.g. 1000. |
| name | The unique name for the account, e.g. Cash. |
| parent | (Optional) The parent account number for the account. |
◆ name()
| const ::QString & drn::accounting::AccountCode::name |
( |
| ) |
const |
The human friendly name for the account.
◆ number()
| const AccountNumber & drn::accounting::AccountCode::number |
( |
| ) |
const |
The numeric identifier for the account.
◆ operator!=()
| bool drn::accounting::AccountCode::operator!= |
( |
const AccountCode & | | ) |
const |
|
nodiscarddefaultnoexcept |
◆ operator<=>()
| std::strong_ordering drn::accounting::AccountCode::operator<=> |
( |
const AccountCode & | other | ) |
const |
|
nodiscardnoexcept |
Compares the calling object's identifier with another identifier, establishing their relative order.
- Parameters
-
| other | The identifier to compare against the calling object's identifier. |
- Returns
- Returns a comparison result of less, greater, or equal, representing the relative order between the two identifiers' account number.
◆ operator==()
| bool drn::accounting::AccountCode::operator== |
( |
const AccountCode & | other | ) |
const |
|
nodiscardnoexcept |
Determines whether the current account code is equal to another account code.
- Parameters
-
| other | The account code to compare with the current account code. |
- Returns
- True if the current account code’s unique identifier, i.e. account number, is equal to the provided account code; otherwise, false.
◆ parent()
| const std::optional< AccountNumber > & drn::accounting::AccountCode::parent |
( |
| ) |
const |
The number of the parent account for this account.
◆ setName()
| void drn::accounting::AccountCode::setName |
( |
::QString | name | ) |
|
Changes the human friendly name for the account.
- Exceptions
-
| AccountError | When the supplied identifier is effectively empty. |
- Parameters
-
| name | The new name for the account. |
◆ setNumber()
| void drn::accounting::AccountCode::setNumber |
( |
AccountNumber | number | ) |
|
Changes the number for the account.
- Exceptions
-
| Error | When the parent and the number are the same. |
- Parameters
-
| number | The new number for the account. |
◆ setParent()
| void drn::accounting::AccountCode::setParent |
( |
std::optional< AccountNumber > | parent | ) |
|
Changes the parent for the account.
- Exceptions
-
| Error | When the parent is invalid. |
| Error | When the parent and the current number are the same. |
- Parameters
-
| parent | The new parent for the account. |
◆ separator_
| const ::QString drn::accounting::AccountCode::separator_ |
|
static |
The character separator to place between the number and name when outputting the account code, currently an em-dash.