20 #ifndef RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
21 #define RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED
23 #include <ripple/basics/CountedObject.h>
24 #include <ripple/basics/IOUAmount.h>
25 #include <ripple/basics/LocalValue.h>
26 #include <ripple/basics/Number.h>
27 #include <ripple/basics/XRPAmount.h>
28 #include <ripple/protocol/Issue.h>
29 #include <ripple/protocol/SField.h>
30 #include <ripple/protocol/STBase.h>
31 #include <ripple/protocol/Serializer.h>
189 value() const noexcept;
197 explicit operator
bool() const noexcept;
276 copy(
std::
size_t n,
void* buf) const override;
278 move(
std::
size_t n,
void* buf) override;
283 friend class detail::STVar;
376 inline STAmount::operator bool() const noexcept
378 return *
this != beast::zero;
404 if (*
this != beast::zero)
465 return !(lhs == rhs);
STBase * move(std::size_t n, void *buf) override
STBase * copy(std::size_t n, void *buf) const override
bool amountFromJsonNoThrow(STAmount &result, Json::Value const &jvSource)
RAII class to set and restore the STAmount canonicalize switchover.
Tracks the number of instances of an object.
A currency issued by an account.
static const std::uint64_t cMinValue
Issue const & issue() const
std::uint64_t mantissa() const noexcept
std::string getText() const override
Json::Value getJson(JsonOptions) const override
Number operator-(Number const &x, Number const &y)
static const std::uint64_t cMaxNative
int signum() const noexcept
static const int cMinOffset
bool isLegalNet(STAmount const &value)
static const std::uint64_t cNotNative
Floating point representation of amounts with high dynamic range.
STAmount & operator=(beast::Zero)
void setIssuer(AccountID const &uIssuer)
STAmount zeroed() const
Returns a zero value with the same issuer and currency.
friend STAmount operator+(STAmount const &v1, STAmount const &v2)
STAmount mulRound(STAmount const &v1, STAmount const &v2, Issue const &issue, bool roundUp)
AccountID const & getIssuer() const
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
STAmount divide(STAmount const &amount, Rate const &rate)
std::string getFullText() const override
int exponent() const noexcept
JSON (JavaScript Object Notation).
bool operator<=(STAmount const &lhs, STAmount const &rhs)
void setJson(Json::Value &) const
STAmount(SerialIter &sit, SField const &name)
bool operator>(STAmount const &lhs, STAmount const &rhs)
void setSTAmountCanonicalizeSwitchover(bool v)
bool operator<(CanonicalTXSet::Key const &lhs, CanonicalTXSet::Key const &rhs)
STAmount divRound(STAmount const &num, STAmount const &den, Issue const &issue, bool roundUp)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
STAmount const & value() const noexcept
bool operator>=(STAmount const &lhs, STAmount const &rhs)
Zero allows classes to offer efficient comparisons to zero.
bool getSTAmountCanonicalizeSwitchover()
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)
STAmount multiply(STAmount const &amount, Rate const &rate)
bool isEquivalent(const STBase &t) const override
bool native() const noexcept
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.
bool operator!=(const STBase &t) const
void add(Serializer &s) const override
bool negative() const noexcept
bool operator==(const STBase &t) const
static const std::uint64_t cMaxNativeN
static const int cMaxOffset
Currency const & getCurrency() const
static const std::uint64_t cPosNative
static const std::uint64_t uRateOne
SerializedTypeID getSType() const override
static const std::uint64_t cMaxValue