3#include <test/jtx/Account.h>
4#include <test/jtx/tags.h>
6#include <xrpl/basics/contract.h>
7#include <xrpl/protocol/Issue.h>
8#include <xrpl/protocol/STAmount.h>
9#include <xrpl/protocol/Units.h>
85 :
amount_((v > 0) ? v : -v, v < 0)
159 template <
typename A>
185 template <std::
integral T>
218 template <Val
idIssueType TIss>
264 template <
class T,
class = std::enable_if_t<std::is_
integral_v<T>>>
283 Throw<std::domain_error>(
"unrepresentable");
294 if (
double(d) / c != v)
295 Throw<std::domain_error>(
"unrepresentable");
299 if (
double(d) / c != v)
300 Throw<std::domain_error>(
"unrepresentable");
332template <
class Integer,
class = std::enable_if_t<std::is_
integral_v<Integer>>>
415 template <
class T,
class = std::enable_if_t<sizeof(T) >= sizeof(
int) && std::is_arithmetic<T>::value>>
510 operator()(T v)
const
531 Throw<std::logic_error>(
"MPT is not supported");
constexpr bool holds() const
A currency issued by an account.
Number is a floating point type that can represent a wide range of values.
static rounding_mode getround()
void setIssuer(AccountID const &uIssuer)
int signum() const noexcept
constexpr value_type drops() const
Returns the number of drops.
Immutable cryptographic account descriptor.
std::string const & name() const
Return the name.
AccountID id() const
Returns the Account ID.
Converts to IOU Issue or STAmount.
PrettyAmount operator()(T v) const
friend BookSpec operator~(IOU const &iou)
IOU(Account const &account_, xrpl::Currency const ¤cy_)
None operator()(none_t) const
Returns None-of-Issue.
Converts to MPT Issue or STAmount.
friend BookSpec operator~(MPT const &mpt)
xrpl::MPTIssue mptIssue() const
Explicit conversion to MPTIssue or asset.
MPT(std::string const &n, xrpl::MPTID const &issuanceID_)
PrettyAmount operator()(epsilon_t) const
xrpl::MPTID const & mpt() const
PrettyAmount operator()(detail::epsilon_multiple) const
None operator()(none_t) const
Returns None-of-Issue.
any_t const any
Returns an amount representing "any issuer".
static epsilon_t const epsilon
std::ostream & operator<<(std::ostream &os, PrettyAmount const &amount)
XRP_t const XRP
Converts to XRP Issue or STAmount.
constexpr XRPAmount dropsPerXRP
bool operator!=(PrettyAmount const &lhs, PrettyAmount const &rhs)
bool operator==(Account const &lhs, Account const &rhs) noexcept
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
STAmount amountFromString(Asset const &asset, std::string const &amount)
Currency const & xrpCurrency()
XRP currency.
Json::Value to_json(Asset const &asset)
Currency const & noCurrency()
A placeholder for empty currencies.
AccountID const & xrpAccount()
Compute AccountID from public key.
Amount specifier with an option for any issuer.
AnyAmount(AnyAmount const &)=default
void to(AccountID const &id)
AnyAmount & operator=(AnyAmount const &)=default
AnyAmount(STAmount const &amount, any_t const *)
AnyAmount(STAmount const &amount)
BookSpec(AccountID const &account_, xrpl::Currency const ¤cy_)
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
std::string const & name() const
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T > > *=nullptr)
drops
PrettyAmount(STAmount const &amount, std::string const &name)
PrettyAmount(PrettyAmount const &)=default
STAmount const & value() const
PrettyAmount(XRPAmount v)
drops
PrettyAmount & operator=(PrettyAmount const &)=default
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_integral_v< T > &&std::is_signed_v< T > > *=nullptr)
drops
PrettyAsset(Asset const &asset, std::uint32_t scale=1)
None operator()(none_t) const
PrettyAmount operator()(T v, Number::rounding_mode rounding=Number::getround()) const
Asset const & raw() const
PrettyAsset(A const &asset, std::uint32_t scale=1)
PrettyAmount operator()(Number v, Number::rounding_mode rounding=Number::getround()) const
None operator()(none_t) const
Returns None-of-XRP.
friend BookSpec operator~(XRP_t const &)
PrettyAmount operator()(double v) const
PrettyAmount operator()(Number v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.
PrettyAmount operator()(T v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.
AnyAmount operator()(STAmount const &sta) const
detail::epsilon_multiple operator()(std::size_t n) const