20#ifndef RIPPLE_PROTOCOL_XRPAMOUNT_H_INCLUDED 
   21#define RIPPLE_PROTOCOL_XRPAMOUNT_H_INCLUDED 
   23#include <xrpl/basics/Number.h> 
   24#include <xrpl/basics/contract.h> 
   25#include <xrpl/beast/utility/Zero.h> 
   26#include <xrpl/json/json_value.h> 
   27#include <xrpl/protocol/Units.h> 
   29#include <boost/multiprecision/cpp_int.hpp> 
   30#include <boost/operators.hpp> 
   39class XRPAmount : 
private boost::totally_ordered<XRPAmount>,
 
   40                  private boost::additive<XRPAmount>,
 
   41                  private boost::equality_comparable<XRPAmount, std::int64_t>,
 
   42                  private boost::additive<XRPAmount, std::int64_t>
 
  158    operator bool() const noexcept
 
 
  185    template <
class Dest>
 
  196        return static_cast<Dest
>(
drops_);
 
 
  199    template <
class Dest>
 
  203        return dropsAs<Dest>().value_or(defaultValue);
 
 
  206    template <
class Dest>
 
  210        return dropsAs<Dest>().value_or(defaultValue.
drops());
 
 
  222            "Expected XRPAmount to be a signed integral type");
 
 
 
  268template <
class Char, 
class Traits>
 
  272    return os << q.
drops();
 
  288    using namespace boost::multiprecision;
 
  291        Throw<std::runtime_error>(
"division by zero");
 
  293    int128_t 
const amt128(amt.
drops());
 
  294    auto const neg = amt.
drops() < 0;
 
  295    auto const m = amt128 * num;
 
  305        Throw<std::overflow_error>(
"XRP mulRatio overflow");
 
 
constexpr XRPAmount(beast::Zero)
 
XRPAmount & operator=(value_type drops)
 
Dest dropsAs(Dest defaultValue) const
 
constexpr value_type value() const
Returns the underlying value.
 
bool operator==(XRPAmount const &other) const
 
std::optional< Dest > dropsAs() const
 
constexpr int signum() const noexcept
Return the sign of the amount.
 
friend std::istream & operator>>(std::istream &s, XRPAmount &val)
 
XRPAmount & operator-=(XRPAmount const &other)
 
XRPAmount operator-() const
 
constexpr XRPAmount operator*(value_type const &rhs) const
 
XRPAmount & operator+=(value_type const &rhs)
 
constexpr value_type drops() const
Returns the number of drops.
 
XRPAmount & operator*=(value_type const &rhs)
 
constexpr XRPAmount & operator=(XRPAmount const &other)=default
 
XRPAmount & operator-=(value_type const &rhs)
 
static XRPAmount minPositiveAmount()
 
Dest dropsAs(XRPAmount defaultValue) const
 
constexpr XRPAmount(value_type drops)
 
XRPAmount & operator+=(XRPAmount const &other)
 
bool operator<(XRPAmount const &other) const
 
constexpr double decimalXRP() const
 
constexpr XRPAmount & operator=(beast::Zero)
 
Json::Value jsonClipped() const
 
bool operator==(value_type other) const
 
XRPAmount(Number const &x)
 
friend constexpr XRPAmount operator*(value_type lhs, XRPAmount const &rhs)
 
constexpr XRPAmount(XRPAmount const &other)=default
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
 
IOUAmount mulRatio(IOUAmount const &amt, std::uint32_t num, std::uint32_t den, bool roundUp)
 
std::string to_string(base_uint< Bits, Tag > const &a)
 
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
 
Zero allows classes to offer efficient comparisons to zero.