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

Represents a unique identifier for a financial transaction. More...

#include <TransactionNumber.h>

Collaboration diagram for drn::accounting::TransactionNumber:

Public Types

using IntegerType = quint16
 The type used to store a transaction’s number.
 

Public Member Functions

 TransactionNumber ()
 Default initialises the object to an invalid numerical value.
 
 TransactionNumber (const IntegerType &value)
 Fully initialises the object with the supplied values.
 
const IntegerTypeinteger () const noexcept
 Retrieves the integer value representing the transaction number.
 
bool operator!= (const TransactionNumber &) const noexcept=default
 
TransactionNumberoperator++ ()
 Increment the object by one.
 
TransactionNumber operator++ (int)
 Increment the object by one.
 
std::strong_ordering operator<=> (const TransactionNumber &) const noexcept=default
 
bool operator== (const TransactionNumber &) const noexcept=default
 

Static Public Attributes

static const IntegerType invalid_
 The number that indicates that it is invalid and empty.
 

Detailed Description

Represents a unique identifier for a financial transaction.

This is designed to encapsulate the concept of a transaction number, ensuring that it is managed consistently, is always valid, and adapted to specific transactional contexts where unique identification is critical.

Member Typedef Documentation

◆ IntegerType

The type used to store a transaction’s number.

Constructor & Destructor Documentation

◆ TransactionNumber() [1/2]

drn::accounting::TransactionNumber::TransactionNumber ( )

Default initialises the object to an invalid numerical value.

Here is the caller graph for this function:

◆ TransactionNumber() [2/2]

drn::accounting::TransactionNumber::TransactionNumber ( const IntegerType & value)
explicit

Fully initialises the object with the supplied values.

Exceptions
TransactionErrorWhen the supplied new value is zero.
Parameters
valueThe number for the transaction.

Member Function Documentation

◆ integer()

const IntegerType & drn::accounting::TransactionNumber::integer ( ) const
nodiscardnoexcept

Retrieves the integer value representing the transaction number.

Returns
The integer value that represents the transaction number.

◆ operator!=()

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

◆ operator++() [1/2]

TransactionNumber & drn::accounting::TransactionNumber::operator++ ( )

Increment the object by one.

Exceptions
ErrorWhen the result of the incrementation would exceed the limit of the integer storage type.
Returns
The instance after the increment operation is performed.
Here is the call graph for this function:

◆ operator++() [2/2]

TransactionNumber drn::accounting::TransactionNumber::operator++ ( int )
nodiscard

Increment the object by one.

Exceptions
ErrorWhen the result of the incrementation would exceed the limit of the integer storage type.
Returns
The instance before the increment operation is performed.
Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering drn::accounting::TransactionNumber::operator<=> ( const TransactionNumber & ) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ operator==()

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

Member Data Documentation

◆ invalid_

const IntegerType drn::accounting::TransactionNumber::invalid_
static

The number that indicates that it is invalid and empty.