Bitcoin ABC  0.22.15
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Amount Struct Reference

#include <amount.h>

Public Member Functions

constexpr Amount ()
 
constexpr Amount (const Amount &other)
 
constexpr Amountoperator= (const Amount &other)
 Assignement operator. More...
 
Amountoperator+= (const Amount a)
 Implement standard operators. More...
 
Amountoperator-= (const Amount a)
 
constexpr Amount operator- () const
 Unary minus. More...
 
constexpr int64_t operator/ (const Amount b) const
 Division. More...
 
constexpr Amount operator/ (const int64_t b) const
 
constexpr Amount operator/ (const int b) const
 
Amountoperator/= (const int64_t n)
 
constexpr Amount operator% (const Amount b) const
 Modulus. More...
 
constexpr Amount operator% (const int64_t b) const
 
constexpr Amount operator% (const int b) const
 
constexpr Amount operator/ (const double b) const =delete
 
constexpr Amount operator% (const double b) const =delete
 
std::string ToString () const
 
 SERIALIZE_METHODS (Amount, obj)
 

Static Public Member Functions

static constexpr Amount zero ()
 
static constexpr Amount satoshi ()
 

Private Member Functions

constexpr Amount (int64_t _amount)
 

Private Attributes

int64_t amount
 

Friends

constexpr bool operator== (const Amount a, const Amount b)
 Equality. More...
 
constexpr bool operator!= (const Amount a, const Amount b)
 
constexpr bool operator< (const Amount a, const Amount b)
 Comparison. More...
 
constexpr bool operator> (const Amount a, const Amount b)
 
constexpr bool operator<= (const Amount a, const Amount b)
 
constexpr bool operator>= (const Amount a, const Amount b)
 
constexpr Amount operator+ (const Amount a, const Amount b)
 Addition and subtraction. More...
 
constexpr Amount operator- (const Amount a, const Amount b)
 
constexpr Amount operator* (const int64_t a, const Amount b)
 Multiplication. More...
 
constexpr Amount operator* (const int a, const Amount b)
 
constexpr Amount operator* (const double a, const Amount b)=delete
 Do not implement double ops to get an error with double and ensure casting to integer is explicit. More...
 
std::ostream & operator<< (std::ostream &stream, const Amount &ca)
 

Detailed Description

Definition at line 17 of file amount.h.

Constructor & Destructor Documentation

◆ Amount() [1/3]

constexpr Amount::Amount ( int64_t  _amount)
inlineexplicitprivate

Definition at line 21 of file amount.h.

◆ Amount() [2/3]

constexpr Amount::Amount ( )
inline

Definition at line 24 of file amount.h.

Here is the caller graph for this function:

◆ Amount() [3/3]

constexpr Amount::Amount ( const Amount other)
inline

Definition at line 25 of file amount.h.

Member Function Documentation

◆ operator%() [1/4]

constexpr Amount Amount::operator% ( const Amount  b) const
inline

Modulus.

Definition at line 119 of file amount.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator%() [2/4]

constexpr Amount Amount::operator% ( const int64_t  b) const
inline

Definition at line 122 of file amount.h.

Here is the call graph for this function:

◆ operator%() [3/4]

constexpr Amount Amount::operator% ( const int  b) const
inline

Definition at line 125 of file amount.h.

Here is the call graph for this function:

◆ operator%() [4/4]

constexpr Amount Amount::operator% ( const double  b) const
delete

◆ operator+=()

Amount& Amount::operator+= ( const Amount  a)
inline

Implement standard operators.

Definition at line 41 of file amount.h.

◆ operator-()

constexpr Amount Amount::operator- ( ) const
inline

Unary minus.

Definition at line 79 of file amount.h.

Here is the call graph for this function:

◆ operator-=()

Amount& Amount::operator-= ( const Amount  a)
inline

Definition at line 45 of file amount.h.

◆ operator/() [1/4]

constexpr int64_t Amount::operator/ ( const Amount  b) const
inline

Division.

Definition at line 104 of file amount.h.

Here is the caller graph for this function:

◆ operator/() [2/4]

constexpr Amount Amount::operator/ ( const int64_t  b) const
inline

Definition at line 107 of file amount.h.

Here is the call graph for this function:

◆ operator/() [3/4]

constexpr Amount Amount::operator/ ( const int  b) const
inline

Definition at line 110 of file amount.h.

Here is the call graph for this function:

◆ operator/() [4/4]

constexpr Amount Amount::operator/ ( const double  b) const
delete

◆ operator/=()

Amount& Amount::operator/= ( const int64_t  n)
inline

Definition at line 111 of file amount.h.

◆ operator=()

constexpr Amount& Amount::operator= ( const Amount other)
inline

Assignement operator.

Definition at line 30 of file amount.h.

◆ satoshi()

static constexpr Amount Amount::satoshi ( )
inlinestatic

Definition at line 36 of file amount.h.

Here is the call graph for this function:

◆ SERIALIZE_METHODS()

Amount::SERIALIZE_METHODS ( Amount  ,
obj   
)
inline

Definition at line 143 of file amount.h.

◆ ToString()

std::string Amount::ToString ( ) const

Definition at line 13 of file amount.cpp.

◆ zero()

static constexpr Amount Amount::zero ( )
inlinestatic

Definition at line 35 of file amount.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

constexpr bool operator!= ( const Amount  a,
const Amount  b 
)
friend

Definition at line 56 of file amount.h.

◆ operator* [1/3]

constexpr Amount operator* ( const int64_t  a,
const Amount  b 
)
friend

Multiplication.

Definition at line 94 of file amount.h.

◆ operator* [2/3]

constexpr Amount operator* ( const int  a,
const Amount  b 
)
friend

Definition at line 97 of file amount.h.

◆ operator* [3/3]

constexpr Amount operator* ( const double  a,
const Amount  b 
)
friend

Do not implement double ops to get an error with double and ensure casting to integer is explicit.

◆ operator+

constexpr Amount operator+ ( const Amount  a,
const Amount  b 
)
friend

Addition and subtraction.

Definition at line 84 of file amount.h.

◆ operator-

constexpr Amount operator- ( const Amount  a,
const Amount  b 
)
friend

Definition at line 87 of file amount.h.

◆ operator<

constexpr bool operator< ( const Amount  a,
const Amount  b 
)
friend

Comparison.

Definition at line 63 of file amount.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Amount ca 
)
friend

Definition at line 136 of file amount.h.

◆ operator<=

constexpr bool operator<= ( const Amount  a,
const Amount  b 
)
friend

Definition at line 69 of file amount.h.

◆ operator==

constexpr bool operator== ( const Amount  a,
const Amount  b 
)
friend

Equality.

Definition at line 53 of file amount.h.

◆ operator>

constexpr bool operator> ( const Amount  a,
const Amount  b 
)
friend

Definition at line 66 of file amount.h.

◆ operator>=

constexpr bool operator>= ( const Amount  a,
const Amount  b 
)
friend

Definition at line 72 of file amount.h.

Member Data Documentation

◆ amount

int64_t Amount::amount
private

Definition at line 19 of file amount.h.


The documentation for this struct was generated from the following files: