20 #ifndef RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
21 #define RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
23 #include <ripple/basics/IOUAmount.h>
24 #include <ripple/basics/XRPAmount.h>
25 #include <ripple/protocol/SField.h>
26 #include <ripple/protocol/Serializer.h>
27 #include <ripple/protocol/STBase.h>
28 #include <ripple/protocol/Issue.h>
132 return emplace(n, buf, std::move(*
this));
190 explicit operator bool() const noexcept
192 return *
this != beast::zero;
218 if (*
this != beast::zero)
336 bool operator== (STAmount
const& lhs, STAmount
const& rhs);
337 bool operator< (STAmount
const& lhs, STAmount
const& rhs);
343 return !(lhs == rhs);
367 STAmount
operator- (STAmount
const& value);
375 STAmount
operator+ (STAmount
const& v1, STAmount
const& v2);
376 STAmount
operator- (STAmount
const& v1, STAmount
const& v2);
379 divide (STAmount
const& v1, STAmount
const& v2, Issue
const& issue);
382 multiply (STAmount
const& v1, STAmount
const& v2, Issue
const& issue);
386 mulRound (STAmount
const& v1, STAmount
const& v2,
387 Issue
const& issue,
bool roundUp);
390 divRound (STAmount
const& v1, STAmount
const& v2,
391 Issue
const& issue,
bool roundUp);
397 getRate (STAmount
const& offerOut, STAmount
const& offerIn);
void clear(STAmount const &saTmpl)
bool operator>(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
bool amountFromJsonNoThrow(STAmount &result, Json::Value const &jvSource)
STBase * move(std::size_t n, void *buf) override
A currency issued by an account.
static const std::uint64_t cMinValue
std::uint64_t mantissa() const noexcept
bool operator>=(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
std::string getText() const override
Json::Value getJson(JsonOptions) const override
static const std::uint64_t cMaxNative
int signum() const noexcept
static const int cMinOffset
bool isLegalNet(STAmount const &value)
STAmount operator-(STAmount const &v1, STAmount const &v2)
static const std::uint64_t cNotNative
Floating point representation of amounts with high dynamic range.
void setIssuer(AccountID const &uIssuer)
STAmount zeroed() const
Returns a zero value with the same issuer and currency.
STAmount & operator-=(STAmount const &)
bool operator==(Manifest const &lhs, Manifest const &rhs)
STAmount mulRound(STAmount const &v1, STAmount const &v2, Issue const &issue, bool roundUp)
STBase * copy(std::size_t n, void *buf) const override
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
STAmount divide(STAmount const &amount, Rate const &rate)
static STBase * emplace(std::size_t n, void *buf, T &&val)
std::string getFullText() const override
int exponent() const noexcept
bool operator<=(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
void setJson(Json::Value &) const
const base_uint< Bits, Tag > operator+(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
STAmount(SerialIter &sit, SField const &name)
void clear(Issue const &issue)
STAmount divRound(STAmount const &num, STAmount const &den, Issue const &issue, bool roundUp)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
bool operator!=(Manifest const &lhs, Manifest const &rhs)
Zero allows classes to offer efficient comparisons to zero.
STAmount amountFromJson(SField const &name, Json::Value const &v)
bool isXRP(AccountID const &c)
void setIssue(Issue const &issue)
Set the Issue for this amount and update mIsNative.
static std::unique_ptr< STAmount > construct(SerialIter &, SField const &name)
STAmount amountFromQuality(std::uint64_t rate)
Currency const & getCurrency() const
AccountID const & getIssuer() const
STAmount multiply(STAmount const &amount, Rate const &rate)
bool isEquivalent(const STBase &t) const override
bool native() const noexcept
STAmount & operator+=(STAmount const &)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
STAmount amountFromString(Issue const &issue, std::string const &amount)
bool isDefault() const override
A type which can be exported to a well known binary format.
Issue const & issue() const
void add(Serializer &s) const override
STAmount const & value() const noexcept
bool negative() const noexcept
static const std::uint64_t cMaxNativeN
static const int cMaxOffset
bool operator<(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
static const std::uint64_t cPosNative
static const std::uint64_t uRateOne
SerializedTypeID getSType() const override
static const std::uint64_t cMaxValue
STAmount & operator=(beast::Zero)