Bitcoin ABC 0.30.5
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 () noexcept
 
 operator UniValue () const
 Convenient implicit UniValue conversion 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 () noexcept
 
static constexpr Amount satoshi () noexcept
 

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 19 of file amount.h.

Constructor & Destructor Documentation

◆ Amount() [1/2]

constexpr Amount::Amount ( int64_t  _amount)
inlineexplicitconstexprprivate

Definition at line 23 of file amount.h.

◆ Amount() [2/2]

constexpr Amount::Amount ( )
inlineconstexprnoexcept

Definition at line 26 of file amount.h.

Here is the caller graph for this function:

Member Function Documentation

◆ operator UniValue()

Amount::operator UniValue ( ) const

Convenient implicit UniValue conversion operator.

Definition at line 29 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 116 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 122 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 119 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 38 of file amount.h.

◆ operator-()

constexpr Amount Amount::operator- ( ) const
inlineconstexpr

Unary minus.

Definition at line 76 of file amount.h.

Here is the call graph for this function:

◆ operator-=()

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

Definition at line 42 of file amount.h.

◆ operator/() [1/4]

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

Division.

Definition at line 101 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 107 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 104 of file amount.h.

Here is the call graph for this function:

◆ operator/=()

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

Definition at line 108 of file amount.h.

◆ satoshi()

static constexpr Amount Amount::satoshi ( )
inlinestaticconstexprnoexcept

Definition at line 33 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 140 of file amount.h.

◆ ToString()

std::string Amount::ToString ( ) const

Definition at line 22 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 ( )
inlinestaticconstexprnoexcept

Definition at line 32 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 53 of file amount.h.

◆ operator* [1/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* [2/3]

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

Definition at line 94 of file amount.h.

◆ operator* [3/3]

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

Multiplication.

Definition at line 91 of file amount.h.

◆ operator+

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

Addition and subtraction.

Definition at line 81 of file amount.h.

◆ operator-

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

Definition at line 84 of file amount.h.

◆ operator<

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

Comparison.

Definition at line 60 of file amount.h.

◆ operator<<

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

Definition at line 133 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

Equality.

Definition at line 50 of file amount.h.

◆ operator>

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

Definition at line 63 of file amount.h.

◆ operator>=

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

Definition at line 69 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: