rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
xrpl::XRPAmount Class Reference

#include <XRPAmount.h>

Inheritance diagram for xrpl::XRPAmount:
Inheritance graph
[legend]
Collaboration diagram for xrpl::XRPAmount:
Collaboration graph
[legend]

Public Types

using unit_type = unit::dropTag
 
using value_type = std::int64_t
 

Public Member Functions

 XRPAmount ()=default
 
constexpr XRPAmount (XRPAmount const &other)=default
 
constexpr XRPAmountoperator= (XRPAmount const &other)=default
 
 XRPAmount (Number const &x)
 
constexpr XRPAmount (beast::Zero)
 
constexpr XRPAmountoperator= (beast::Zero)
 
constexpr XRPAmount (value_type drops)
 
XRPAmountoperator= (value_type drops)
 
constexpr XRPAmount operator* (value_type const &rhs) const
 
XRPAmountoperator+= (XRPAmount const &other)
 
XRPAmountoperator-= (XRPAmount const &other)
 
XRPAmountoperator+= (value_type const &rhs)
 
XRPAmountoperator-= (value_type const &rhs)
 
XRPAmountoperator*= (value_type const &rhs)
 
XRPAmount operator- () const
 
bool operator== (XRPAmount const &other) const
 
bool operator== (value_type other) const
 
bool operator< (XRPAmount const &other) const
 
constexpr operator bool () const noexcept
 Returns true if the amount is not zero.
 
 operator Number () const noexcept
 
constexpr int signum () const noexcept
 Return the sign of the amount.
 
constexpr value_type drops () const
 Returns the number of drops.
 
constexpr double decimalXRP () const
 
template<class Dest >
std::optional< Dest > dropsAs () const
 
template<class Dest >
Dest dropsAs (Dest defaultValue) const
 
template<class Dest >
Dest dropsAs (XRPAmount defaultValue) const
 
Json::Value jsonClipped () const
 
constexpr value_type value () const
 Returns the underlying value.
 

Static Public Member Functions

static XRPAmount minPositiveAmount ()
 

Private Attributes

value_type drops_
 

Friends

constexpr XRPAmount operator* (value_type lhs, XRPAmount const &rhs)
 
std::istreamoperator>> (std::istream &s, XRPAmount &val)
 

Detailed Description

Definition at line 19 of file XRPAmount.h.

Member Typedef Documentation

◆ unit_type

using xrpl::XRPAmount::unit_type = unit::dropTag

Definition at line 25 of file XRPAmount.h.

◆ value_type

Definition at line 26 of file XRPAmount.h.

Constructor & Destructor Documentation

◆ XRPAmount() [1/5]

xrpl::XRPAmount::XRPAmount ( )
default

◆ XRPAmount() [2/5]

constexpr xrpl::XRPAmount::XRPAmount ( XRPAmount const &  other)
constexprdefault

◆ XRPAmount() [3/5]

xrpl::XRPAmount::XRPAmount ( Number const &  x)
explicit

Definition at line 38 of file XRPAmount.h.

◆ XRPAmount() [4/5]

constexpr xrpl::XRPAmount::XRPAmount ( beast::Zero  )
constexpr

Definition at line 42 of file XRPAmount.h.

◆ XRPAmount() [5/5]

constexpr xrpl::XRPAmount::XRPAmount ( value_type  drops)
explicitconstexpr

Definition at line 53 of file XRPAmount.h.

Member Function Documentation

◆ operator=() [1/3]

constexpr XRPAmount & xrpl::XRPAmount::operator= ( XRPAmount const &  other)
constexprdefault

◆ operator=() [2/3]

constexpr XRPAmount & xrpl::XRPAmount::operator= ( beast::Zero  )
constexpr

Definition at line 47 of file XRPAmount.h.

◆ operator=() [3/3]

XRPAmount & xrpl::XRPAmount::operator= ( value_type  drops)

Definition at line 58 of file XRPAmount.h.

◆ operator*()

constexpr XRPAmount xrpl::XRPAmount::operator* ( value_type const &  rhs) const
constexpr

Definition at line 65 of file XRPAmount.h.

◆ operator+=() [1/2]

XRPAmount & xrpl::XRPAmount::operator+= ( XRPAmount const &  other)

Definition at line 78 of file XRPAmount.h.

◆ operator-=() [1/2]

XRPAmount & xrpl::XRPAmount::operator-= ( XRPAmount const &  other)

Definition at line 85 of file XRPAmount.h.

◆ operator+=() [2/2]

XRPAmount & xrpl::XRPAmount::operator+= ( value_type const &  rhs)

Definition at line 92 of file XRPAmount.h.

◆ operator-=() [2/2]

XRPAmount & xrpl::XRPAmount::operator-= ( value_type const &  rhs)

Definition at line 99 of file XRPAmount.h.

◆ operator*=()

XRPAmount & xrpl::XRPAmount::operator*= ( value_type const &  rhs)

Definition at line 106 of file XRPAmount.h.

◆ operator-()

XRPAmount xrpl::XRPAmount::operator- ( ) const

Definition at line 113 of file XRPAmount.h.

◆ operator==() [1/2]

bool xrpl::XRPAmount::operator== ( XRPAmount const &  other) const

Definition at line 119 of file XRPAmount.h.

◆ operator==() [2/2]

bool xrpl::XRPAmount::operator== ( value_type  other) const

Definition at line 125 of file XRPAmount.h.

◆ operator<()

bool xrpl::XRPAmount::operator< ( XRPAmount const &  other) const

Definition at line 130 of file XRPAmount.h.

◆ operator bool()

constexpr xrpl::XRPAmount::operator bool ( ) const
explicitconstexprnoexcept

Returns true if the amount is not zero.

Definition at line 138 of file XRPAmount.h.

◆ operator Number()

xrpl::XRPAmount::operator Number ( ) const
noexcept

Definition at line 143 of file XRPAmount.h.

◆ signum()

constexpr int xrpl::XRPAmount::signum ( ) const
constexprnoexcept

Return the sign of the amount.

Definition at line 150 of file XRPAmount.h.

◆ drops()

constexpr value_type xrpl::XRPAmount::drops ( ) const
constexpr

Returns the number of drops.

Definition at line 157 of file XRPAmount.h.

◆ decimalXRP()

constexpr double xrpl::XRPAmount::decimalXRP ( ) const
constexpr

Definition at line 240 of file XRPAmount.h.

◆ dropsAs() [1/3]

template<class Dest >
std::optional< Dest > xrpl::XRPAmount::dropsAs ( ) const

Definition at line 167 of file XRPAmount.h.

◆ dropsAs() [2/3]

template<class Dest >
Dest xrpl::XRPAmount::dropsAs ( Dest  defaultValue) const

Definition at line 179 of file XRPAmount.h.

◆ dropsAs() [3/3]

template<class Dest >
Dest xrpl::XRPAmount::dropsAs ( XRPAmount  defaultValue) const

Definition at line 186 of file XRPAmount.h.

◆ jsonClipped()

Json::Value xrpl::XRPAmount::jsonClipped ( ) const

Definition at line 196 of file XRPAmount.h.

◆ value()

constexpr value_type xrpl::XRPAmount::value ( ) const
constexpr

Returns the underlying value.

Code SHOULD NOT call this function unless the type has been abstracted away, e.g. in a templated function.

Definition at line 217 of file XRPAmount.h.

◆ minPositiveAmount()

static XRPAmount xrpl::XRPAmount::minPositiveAmount ( )
static

Definition at line 230 of file XRPAmount.h.

Friends And Related Symbol Documentation

◆ operator*

constexpr XRPAmount operator* ( value_type  lhs,
XRPAmount const &  rhs 
)
friend

Definition at line 71 of file XRPAmount.h.

◆ operator>>

std::istream & operator>> ( std::istream s,
XRPAmount val 
)
friend

Definition at line 223 of file XRPAmount.h.

Member Data Documentation

◆ drops_

value_type xrpl::XRPAmount::drops_
private

Definition at line 29 of file XRPAmount.h.