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.h>
Public Member Functions | |
AccountCode ()=default | |
AccountCode (::QString name, std::optional< AccountNumber > parent={}) | |
Partially initialises the object with supplied account code name, and defaults the rest. | |
AccountCode (AccountNumber number, ::QString name, std::optional< AccountNumber > parent={}) | |
Fully initialises the object. | |
AccountCode (AccountNumber number, std::optional< AccountNumber > parent={}) | |
Partially initialises the object with supplied values, and defaults the rest. | |
const ::QString & | name () const |
The human friendly name for the account. | |
const AccountNumber & | number () const |
The numeric identifier for the account. | |
bool | operator!= (const AccountCode &) const noexcept=default |
std::strong_ordering | operator<=> (const AccountCode &other) const noexcept |
Compares the calling object's identifier with another identifier, establishing their relative order. | |
bool | operator== (const AccountCode &other) const noexcept |
Determines whether the current account code is equal to another account code. | |
const std::optional< AccountNumber > & | parent () const |
The number of the parent account for this account. | |
void | setName (::QString name) |
Changes the human friendly name for the account. | |
void | setNumber (AccountNumber number) |
Changes the number for the account. | |
void | setParent (std::optional< AccountNumber > parent) |
Changes the parent for the account. | |
Static Public Attributes | |
static const ::QString | separator_ |
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.
|
default |
|
explicit |
Partially initialises the object with supplied account code name, and defaults the rest.
AccountError | When the supplied name is effectively empty. |
AccountError | When the supplied name contains the account separator. |
AccountError | When the parent is invalid. |
name | The unique name for the account, e.g. Cash. |
parent | (Optional) The parent account number for the account. |
|
explicit |
Partially initialises the object with supplied values, and defaults the rest.
AccountError | When the number is not set. |
AccountError | When the parent and the value are the same. |
AccountError | When the parent is invalid. |
number | The unique number for the account, e.g. 1000. |
parent | (Optional) The parent account number for the account. |
drn::accounting::AccountCode::AccountCode | ( | AccountNumber | number, |
::QString | name, | ||
std::optional< AccountNumber > | parent = {} ) |
Fully initialises the object.
AccountError | When the supplied number is zero. |
AccountError | When the supplied name is effectively empty. |
AccountError | When the supplied name contains the account separator. |
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. |
const ::QString & drn::accounting::AccountCode::name | ( | ) | const |
The human friendly name for the account.
const AccountNumber & drn::accounting::AccountCode::number | ( | ) | const |
The numeric identifier for the account.
|
nodiscarddefaultnoexcept |
|
nodiscardnoexcept |
Compares the calling object's identifier with another identifier, establishing their relative order.
other | The identifier to compare against the calling object's identifier. |
|
nodiscardnoexcept |
Determines whether the current account code is equal to another account code.
other | The account code to compare with the current account code. |
const std::optional< AccountNumber > & drn::accounting::AccountCode::parent | ( | ) | const |
The number of the parent account for this account.
void drn::accounting::AccountCode::setName | ( | ::QString | name | ) |
Changes the human friendly name for the account.
AccountError | When the supplied identifier is effectively empty. |
name | The new name for the account. |
void drn::accounting::AccountCode::setNumber | ( | AccountNumber | number | ) |
Changes the number for the account.
Error | When the parent and the number are the same. |
number | The new number for the account. |
void drn::accounting::AccountCode::setParent | ( | std::optional< AccountNumber > | parent | ) |
Changes the parent for the account.
Error | When the parent is invalid. |
Error | When the parent and the current number are the same. |
parent | The new parent for the account. |
|
static |
The character separator to place between the number and name when outputting the account code, currently an em-dash.