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>
requires (sizeof(T) >= sizeof(int) && std::is_integral_v<T> && std::is_signed_v<T>)
 PrettyAmount (T v)
 drops
template<class T>
requires (sizeof(T) >= sizeof(int) && std::is_unsigned_v<T>)
 PrettyAmount (T v)
 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 77 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 90 of file src/test/jtx/amount.h.

◆ PrettyAmount() [4/6]

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

drops

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

◆ PrettyAmount() [5/6]

template<class T>
requires (sizeof(T) >= sizeof(int) && std::is_unsigned_v<T>)
xrpl::test::jtx::PrettyAmount::PrettyAmount ( T v)

drops

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

◆ PrettyAmount() [6/6]

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

drops

Definition at line 118 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 123 of file src/test/jtx/amount.h.

◆ value()

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

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

◆ number()

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

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

◆ signum()

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

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

◆ operator STAmount const &()

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

Definition at line 146 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 153 of file src/test/jtx/amount.h.

Member Data Documentation

◆ amount_

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

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

◆ name_

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

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