Bitcoin ABC  0.24.7
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)
 
 operator UniValue () const
 Convenient implicit UniValue conversion operator. More...
 
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 friend bool operator== (const Amount a, const Amount b)
 Equality. More...
 
constexpr friend bool operator!= (const Amount a, const Amount b)
 
constexpr friend bool operator< (const Amount a, const Amount b)
 Comparison. More...
 
constexpr friend bool operator> (const Amount a, const Amount b)
 
constexpr friend bool operator<= (const Amount a, const Amount b)
 
constexpr friend bool operator>= (const Amount a, const Amount b)
 
constexpr friend Amount operator+ (const Amount a, const Amount b)
 Addition and subtraction. More...
 
constexpr friend Amount operator- (const Amount a, const Amount b)
 
constexpr friend Amount operator* (const int64_t a, const Amount b)
 Multiplication. More...
 
constexpr friend Amount operator* (const int a, const Amount b)
 
constexpr friend 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 19 of file amount.h.

Constructor & Destructor Documentation

◆ Amount() [1/3]

constexpr Amount::Amount ( int64_t  _amount)
inlineexplicitconstexprprivate

Definition at line 23 of file amount.h.

◆ Amount() [2/3]

constexpr Amount::Amount ( )
inlineconstexpr

Definition at line 26 of file amount.h.

Here is the caller graph for this function:

◆ Amount() [3/3]

constexpr Amount::Amount ( const Amount other)
inlineconstexpr

Definition at line 27 of file amount.h.

Member Function Documentation

◆ operator UniValue()

Amount::operator UniValue ( ) const

Convenient implicit UniValue conversion operator.

Definition at line 30 of file amount.cpp.

Here is the call graph for this function:

◆ operator%() [1/4]

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

Modulus.

Definition at line 126 of file amount.h.

Here is the call graph for this function:

◆ operator%() [2/4]

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

◆ operator%() [3/4]

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

Definition at line 132 of file amount.h.

Here is the call graph for this function:

◆ operator%() [4/4]

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

Definition at line 129 of file amount.h.

Here is the call graph for this function:

◆ operator+=()

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

Implement standard operators.

Definition at line 48 of file amount.h.

◆ operator-()

constexpr Amount Amount::operator- ( ) const
inlineconstexpr

Unary minus.

Definition at line 86 of file amount.h.

Here is the call graph for this function:

◆ operator-=()

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

Definition at line 52 of file amount.h.

◆ operator/() [1/4]

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

Division.

Definition at line 111 of file amount.h.

◆ operator/() [2/4]

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

◆ operator/() [3/4]

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

Definition at line 117 of file amount.h.

Here is the call graph for this function:

◆ operator/() [4/4]

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

Definition at line 114 of file amount.h.

Here is the call graph for this function:

◆ operator/=()

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

Definition at line 118 of file amount.h.

◆ operator=()

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

Assignement operator.

Definition at line 37 of file amount.h.

◆ satoshi()

static constexpr Amount Amount::satoshi ( )
inlinestaticconstexpr

Definition at line 43 of file amount.h.

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

◆ SERIALIZE_METHODS()

Amount::SERIALIZE_METHODS ( Amount  ,
obj   
)
inline

Definition at line 150 of file amount.h.

◆ ToString()

std::string Amount::ToString ( ) const

Definition at line 23 of file amount.cpp.

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

◆ zero()

static constexpr Amount Amount::zero ( )
inlinestaticconstexpr

Definition at line 42 of file amount.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 63 of file amount.h.

◆ operator* [1/3]

constexpr friend 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* [2/3]

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

Definition at line 104 of file amount.h.

◆ operator* [3/3]

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

Multiplication.

Definition at line 101 of file amount.h.

◆ operator+

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

Addition and subtraction.

Definition at line 91 of file amount.h.

◆ operator-

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

Definition at line 94 of file amount.h.

◆ operator<

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

Comparison.

Definition at line 70 of file amount.h.

◆ operator<<

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

Definition at line 143 of file amount.h.

◆ operator<=

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

Definition at line 76 of file amount.h.

◆ operator==

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

Equality.

Definition at line 60 of file amount.h.

◆ operator>

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

Definition at line 73 of file amount.h.

◆ operator>=

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

Definition at line 79 of file amount.h.

Member Data Documentation

◆ amount

int64_t Amount::amount
private

Definition at line 21 of file amount.h.


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