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

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>

Collaboration diagram for drn::accounting::AccountCode:

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 AccountNumbernumber () 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_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AccountCode() [1/4]

drn::accounting::AccountCode::AccountCode ( )
default
Here is the caller graph for this function:

◆ 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
AccountErrorWhen the supplied name is effectively empty.
AccountErrorWhen the supplied name contains the account separator.
AccountErrorWhen the parent is invalid.
Parameters
nameThe unique name for the account, e.g. Cash.
parent(Optional) The parent account number for the account.
Here is the call graph for this function:

◆ AccountCode() [3/4]

drn::accounting::AccountCode::AccountCode ( AccountNumber number,
std::optional< AccountNumber > parent = {} )
explicit

Partially initialises the object with supplied values, and defaults the rest.

Exceptions
AccountErrorWhen the number is not set.
AccountErrorWhen the parent and the value are the same.
AccountErrorWhen the parent is invalid.
Parameters
numberThe unique number for the account, e.g. 1000.
parent(Optional) The parent account number for the account.
Here is the call graph for this function:

◆ AccountCode() [4/4]

drn::accounting::AccountCode::AccountCode ( AccountNumber number,
::QString name,
std::optional< AccountNumber > parent = {} )

Fully initialises the object.

Exceptions
AccountErrorWhen the supplied number is zero.
AccountErrorWhen the supplied name is effectively empty.
AccountErrorWhen the supplied name contains the account separator.
Parameters
numberThe unique number for the account, e.g. 1000.
nameThe unique name for the account, e.g. Cash.
parent(Optional) The parent account number for the account.
Here is the call graph for this function:

Member Function Documentation

◆ name()

const ::QString & drn::accounting::AccountCode::name ( ) const

The human friendly name for the account.

Here is the caller graph for this function:

◆ number()

const AccountNumber & drn::accounting::AccountCode::number ( ) const

The numeric identifier for the account.

Here is the caller graph for this function:

◆ operator!=()

bool drn::accounting::AccountCode::operator!= ( const AccountCode & ) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ 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
otherThe 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.
Here is the call graph for this function:

◆ operator==()

bool drn::accounting::AccountCode::operator== ( const AccountCode & other) const
nodiscardnoexcept

Determines whether the current account code is equal to another account code.

Parameters
otherThe 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.
Here is the call graph for this function:

◆ parent()

const std::optional< AccountNumber > & drn::accounting::AccountCode::parent ( ) const

The number of the parent account for this account.

Here is the caller graph for this function:

◆ setName()

void drn::accounting::AccountCode::setName ( ::QString name)

Changes the human friendly name for the account.

Exceptions
AccountErrorWhen the supplied identifier is effectively empty.
Parameters
nameThe new name for the account.
Here is the call graph for this function:

◆ setNumber()

void drn::accounting::AccountCode::setNumber ( AccountNumber number)

Changes the number for the account.

Exceptions
ErrorWhen the parent and the number are the same.
Parameters
numberThe new number for the account.
Here is the call graph for this function:

◆ setParent()

void drn::accounting::AccountCode::setParent ( std::optional< AccountNumber > parent)

Changes the parent for the account.

Exceptions
ErrorWhen the parent is invalid.
ErrorWhen the parent and the current number are the same.
Parameters
parentThe new parent for the account.
Here is the call graph for this function:

Member Data Documentation

◆ 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.