20 #ifndef RIPPLE_TEST_JTX_AMOUNT_H_INCLUDED
21 #define RIPPLE_TEST_JTX_AMOUNT_H_INCLUDED
23 #include <ripple/basics/FeeUnits.h>
24 #include <ripple/basics/contract.h>
25 #include <ripple/protocol/Issue.h>
26 #include <ripple/protocol/STAmount.h>
30 #include <test/jtx/Account.h>
31 #include <test/jtx/amount.h>
32 #include <test/jtx/tags.h>
96 sizeof(T) >=
sizeof(
int) && std::is_integral_v<T> &&
97 std::is_signed_v<T>>* =
nullptr)
98 :
amount_((v > 0) ? v : -v, v < 0)
186 template <
class T,
class = std::enable_if_t<std::is_
integral_v<T>>>
202 if (
double(d) / c != v)
203 Throw<std::domain_error>(
"unrepresentable");
207 if (
double(d) / c != v)
208 Throw<std::domain_error>(
"unrepresentable");
239 template <
class Integer,
class = std::enable_if_t<std::is_
integral_v<Integer>>>
std::string const & name() const
Return the name.
friend BookSpec operator~(XRP_t const &)
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T >> *=nullptr)
drops
const XRP_t XRP
Converts to XRP Issue or STAmount.
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_integral_v< T > &&std::is_signed_v< T >> *=nullptr)
drops
PrettyAmount(XRPAmount v)
drops
constexpr XRPAmount dropsPerXRP
A currency issued by an account.
std::ostream & operator<<(std::ostream &os, PrettyAmount const &amount)
PrettyAmount operator()(double v) const
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
constexpr value_type drops() const
Returns the number of drops.
ripple::Currency currency
Amount specifier with an option for any issuer.
None operator()(none_t) const
Returns None-of-Issue.
detail::epsilon_multiple operator()(std::size_t n) const
AnyAmount operator()(STAmount const &sta) const
PrettyAmount & operator=(PrettyAmount const &)=default
AnyAmount & operator=(AnyAmount const &)=default
void setIssuer(AccountID const &uIssuer)
AccountID id() const
Returns the Account ID.
PrettyAmount operator()(T v) const
AnyAmount(STAmount const &amount)
friend BookSpec operator~(IOU const &iou)
void to(AccountID const &id)
IOU(Account const &account_, ripple::Currency const ¤cy_)
BookSpec(AccountID const &account_, ripple::Currency const ¤cy_)
const any_t any
Returns an amount representing "any issuer".
ripple::Currency currency
AccountID const & xrpAccount()
Compute AccountID from public key.
bool operator!=(PrettyAmount const &lhs, PrettyAmount const &rhs)
PrettyAmount operator()(T v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertable to STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string const & name() const
STAmount amountFromString(Issue const &issue, std::string const &amount)
Converts to IOU Issue or STAmount.
static const epsilon_t epsilon
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
STAmount const & value() const
AnyAmount(STAmount const &amount, any_t const *)
Immutable cryptographic account descriptor.
bool operator==(Account const &lhs, Account const &rhs) noexcept
None operator()(none_t) const
Returns None-of-XRP.
PrettyAmount(STAmount const &amount, std::string const &name)
Currency const & xrpCurrency()
XRP currency.
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...