xrpld
Loading...
Searching...
No Matches
xrpl::test::jtx::PrettyAmount Struct Reference

Represents an XRP, IOU, or MPT quantity This customizes the string conversion and supports XRP conversions from integer and floating point. More...

#include <amount.h>

Collaboration diagram for xrpl::test::jtx::PrettyAmount:

Public Member Functions

 PrettyAmount ()=default
 PrettyAmount (PrettyAmount const &)=default
PrettyAmountoperator= (PrettyAmount const &)=default
 PrettyAmount (STAmount amount, std::string name)
template<class T>
 PrettyAmount (T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_integral_v< T > &&std::is_signed_v< T > > *=nullptr)
 drops
template<class T>
 PrettyAmount (T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T > > *=nullptr)
 drops
 PrettyAmount (XRPAmount v)
 drops
std::string const & name () const
STAmount const & value () const
Number number () const
int signum () const
 operator STAmount const & () const
 operator AnyAmount () const
 operator json::Value () const

Private Attributes

STAmount amount_
std::string name_

Detailed Description

Represents an XRP, IOU, or MPT quantity This customizes the string conversion and supports XRP conversions from integer and floating point.

Definition at line 64 of file src/test/jtx/amount.h.

Constructor & Destructor Documentation

◆ PrettyAmount() [1/6]

xrpl::test::jtx::PrettyAmount::PrettyAmount ( )
default

◆ PrettyAmount() [2/6]

xrpl::test::jtx::PrettyAmount::PrettyAmount ( PrettyAmount const & )
default

◆ PrettyAmount() [3/6]

xrpl::test::jtx::PrettyAmount::PrettyAmount ( STAmount amount,
std::string name )

Definition at line 77 of file src/test/jtx/amount.h.

◆ PrettyAmount() [4/6]

template<class T>
xrpl::test::jtx::PrettyAmount::PrettyAmount ( T v,
std::enable_if_t< sizeof(T) > = sizeof(int) && std::is_integral_v<T> && std::is_signed_v<T>,
* = nullptr )

drops

Definition at line 84 of file src/test/jtx/amount.h.

◆ PrettyAmount() [5/6]

template<class T>
xrpl::test::jtx::PrettyAmount::PrettyAmount ( T v,
std::enable_if_t< sizeof(T) > = sizeof(int) && std::is_unsigned_v<T>,
* = nullptr )

drops

Definition at line 94 of file src/test/jtx/amount.h.

◆ PrettyAmount() [6/6]

xrpl::test::jtx::PrettyAmount::PrettyAmount ( XRPAmount v)

drops

Definition at line 102 of file src/test/jtx/amount.h.

Member Function Documentation

◆ operator=()

PrettyAmount & xrpl::test::jtx::PrettyAmount::operator= ( PrettyAmount const & )
default

◆ name()

std::string const & xrpl::test::jtx::PrettyAmount::name ( ) const
nodiscard

Definition at line 107 of file src/test/jtx/amount.h.

◆ value()

STAmount const & xrpl::test::jtx::PrettyAmount::value ( ) const
nodiscard

Definition at line 113 of file src/test/jtx/amount.h.

◆ number()

Number xrpl::test::jtx::PrettyAmount::number ( ) const
nodiscard

Definition at line 119 of file src/test/jtx/amount.h.

◆ signum()

int xrpl::test::jtx::PrettyAmount::signum ( ) const
nodiscard

Definition at line 125 of file src/test/jtx/amount.h.

◆ operator STAmount const &()

xrpl::test::jtx::PrettyAmount::operator STAmount const & ( ) const

Definition at line 130 of file src/test/jtx/amount.h.

◆ operator AnyAmount()

xrpl::test::jtx::PrettyAmount::operator AnyAmount ( ) const

Definition at line 22 of file amount.cpp.

◆ operator json::Value()

xrpl::test::jtx::PrettyAmount::operator json::Value ( ) const

Definition at line 137 of file src/test/jtx/amount.h.

Member Data Documentation

◆ amount_

STAmount xrpl::test::jtx::PrettyAmount::amount_
private

Definition at line 68 of file src/test/jtx/amount.h.

◆ name_

std::string xrpl::test::jtx::PrettyAmount::name_
private

Definition at line 69 of file src/test/jtx/amount.h.