|
xrpld
|
#include <STAmount.h>


Classes | |
| struct | Unchecked |
Public Types | |
| using | mantissa_type = std::uint64_t |
| using | exponent_type = int |
| using | rep = std::pair<mantissa_type, exponent_type> |
| using | value_type = STAmount |
Public Member Functions | |
| STAmount (SerialIter &sit, SField const &name) | |
| template<AssetType A> | |
| STAmount (SField const &name, A const &asset, mantissa_type mantissa, exponent_type exponent, bool negative, Unchecked) | |
| template<AssetType A> | |
| STAmount (A const &asset, mantissa_type mantissa, exponent_type exponent, bool negative, Unchecked) | |
| template<AssetType A> | |
| STAmount (SField const &name, A const &asset, mantissa_type mantissa=0, exponent_type exponent=0, bool negative=false) | |
| STAmount (SField const &name, std::int64_t mantissa) | |
| STAmount (SField const &name, std::uint64_t mantissa=0, bool negative=false) | |
| STAmount (std::uint64_t mantissa=0, bool negative=false) | |
| STAmount (SField const &name, STAmount const &amt) | |
| template<AssetType A> | |
| STAmount (A const &asset, std::uint64_t mantissa=0, int exponent=0, bool negative=false) | |
| template<AssetType A> | |
| STAmount (A const &asset, std::uint32_t mantissa, int exponent=0, bool negative=false) | |
| template<AssetType A> | |
| STAmount (A const &asset, std::int64_t mantissa, int exponent=0) | |
| template<AssetType A> | |
| STAmount (A const &asset, int mantissa, int exponent=0) | |
| template<AssetType A> | |
| STAmount (A const &asset, Number const &number) | |
| STAmount (IOUAmount const &amount, Issue const &issue) | |
| STAmount (XRPAmount const &amount) | |
| STAmount (MPTAmount const &amount, MPTIssue const &mptIssue) | |
| operator Number () const | |
| int | exponent () const noexcept |
| bool | integral () const noexcept |
| bool | native () const noexcept |
| template<ValidIssueType TIss> | |
| constexpr bool | holds () const noexcept |
| bool | negative () const noexcept |
| std::uint64_t | mantissa () const noexcept |
| Asset const & | asset () const |
| template<ValidIssueType TIss> | |
| constexpr TIss const & | get () const |
| template<ValidIssueType TIss> | |
| TIss & | get () |
| AccountID const & | getIssuer () const |
| int | signum () const noexcept |
| STAmount | zeroed () const |
| Returns a zero value with the same issuer and currency. | |
| void | setJson (json::Value &) const |
| STAmount const & | value () const noexcept |
| bool | isZeroAtScale (int scale) const |
| Checks if this amount evaluates to zero when constrained to a specific accounting scale. | |
| operator bool () const noexcept | |
| STAmount & | operator+= (STAmount const &) |
| STAmount & | operator-= (STAmount const &) |
| STAmount & | operator= (beast::Zero) |
| STAmount & | operator= (XRPAmount const &amount) |
| STAmount & | operator= (Number const &) |
| void | negate () |
| void | clear () |
| void | clear (Asset const &asset) |
| void | setIssue (Asset const &asset) |
| Set the Issue for this amount. | |
| SerializedTypeID | getSType () const override |
| std::string | getFullText () const override |
| std::string | getText () const override |
| json::Value | getJson (JsonOptions=JsonOptions::Values::None) const override |
| void | add (Serializer &s) const override |
| bool | isEquivalent (STBase const &t) const override |
| bool | isDefault () const override |
| XRPAmount | xrp () const |
| IOUAmount | iou () const |
| MPTAmount | mpt () const |
| template<ValidIssueType TIss> | |
| constexpr TIss const & | get () const |
| bool | operator== (STBase const &t) const |
| bool | operator!= (STBase const &t) const |
| template<class D> | |
| D & | downcast () |
| template<class D> | |
| D const & | downcast () const |
| template<class D> | |
| D const & | downcast () const |
| void | setFName (SField const &n) |
| A STBase is a field. | |
| SField const & | getFName () const |
| void | addFieldID (Serializer &s) const |
Public Attributes | |
| friend | Object |
Static Public Attributes | |
| static constexpr int | kMinOffset = -96 |
| static constexpr int | kMaxOffset = 80 |
| static constexpr std::uint64_t | kMinValue = 1'000'000'000'000'000ull |
| static constexpr std::uint64_t | kMaxValue = (kMinValue * 10) - 1 |
| static constexpr std::uint64_t | kMaxNative = 9'000'000'000'000'000'000ull |
| static constexpr std::uint64_t | kMaxNativeN = 100'000'000'000'000'000ull |
| static constexpr std::uint64_t | kIssuedCurrency = 0x8'000'000'000'000'000ull |
| static constexpr std::uint64_t | kPositive = 0x4'000'000'000'000'000ull |
| static constexpr std::uint64_t | kMpToken = 0x2'000'000'000'000'000ull |
| static constexpr std::uint64_t | kValueMask = ~(kPositive | kMpToken) |
| static std::uint64_t const | kURateOne = getRate(STAmount(1), STAmount(1)) |
Static Protected Member Functions | |
| template<class T> | |
| static STBase * | emplace (std::size_t n, void *buf, T &&val) |
Private Member Functions | |
| void | set (std::int64_t v) |
| void | canonicalize () |
| STBase * | copy (std::size_t n, void *buf) const override |
| STBase * | move (std::size_t n, void *buf) override |
| STAmount & | operator= (IOUAmount const &iou) |
Static Private Member Functions | |
| template<AssetType A> | |
| static STAmount | fromNumber (A const &asset, Number const &number) |
| static std::unique_ptr< STAmount > | construct (SerialIter &, SField const &name) |
| static auto & | getCounter () noexcept |
Private Attributes | |
| Asset | asset_ |
| mantissa_type | value_ {} |
| exponent_type | offset_ |
| bool | isNegative_ {} |
| SField const * | fName_ |
Friends | |
| class | detail::STVar |
| STAmount | operator+ (STAmount const &v1, STAmount const &v2) |
Definition at line 31 of file STAmount.h.
Definition at line 34 of file STAmount.h.
| using xrpl::STAmount::exponent_type = int |
Definition at line 35 of file STAmount.h.
Definition at line 36 of file STAmount.h.
| using xrpl::STAmount::value_type = STAmount |
Definition at line 45 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | SerialIter & | sit, |
| SField const & | name ) |
Definition at line 112 of file STAmount.cpp.
| xrpl::STAmount::STAmount | ( | SField const & | name, |
| A const & | asset, | ||
| mantissa_type | mantissa, | ||
| exponent_type | exponent, | ||
| bool | negative, | ||
| Unchecked | ) |
Definition at line 309 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| mantissa_type | mantissa, | ||
| exponent_type | exponent, | ||
| bool | negative, | ||
| Unchecked | ) |
Definition at line 321 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | SField const & | name, |
| A const & | asset, | ||
| mantissa_type | mantissa = 0, | ||
| exponent_type | exponent = 0, | ||
| bool | negative = false ) |
Definition at line 332 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | SField const & | name, |
| std::int64_t | mantissa ) |
Definition at line 193 of file STAmount.cpp.
| xrpl::STAmount::STAmount | ( | SField const & | name, |
| std::uint64_t | mantissa = 0, | ||
| bool | negative = false ) |
Definition at line 199 of file STAmount.cpp.
|
explicit |
Definition at line 223 of file STAmount.cpp.
|
explicit |
Definition at line 208 of file STAmount.cpp.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| std::uint64_t | mantissa = 0, | ||
| int | exponent = 0, | ||
| bool | negative = false ) |
Definition at line 110 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| std::uint32_t | mantissa, | ||
| int | exponent = 0, | ||
| bool | negative = false ) |
Definition at line 365 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| std::int64_t | mantissa, | ||
| int | exponent = 0 ) |
Definition at line 357 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| int | mantissa, | ||
| int | exponent = 0 ) |
Definition at line 371 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | A const & | asset, |
| Number const & | number ) |
Definition at line 127 of file STAmount.h.
Definition at line 377 of file STAmount.h.
| xrpl::STAmount::STAmount | ( | XRPAmount const & | amount | ) |
Definition at line 232 of file STAmount.cpp.
Definition at line 392 of file STAmount.h.
| xrpl::STAmount::operator Number | ( | ) | const |
Definition at line 523 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 441 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 447 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 453 of file STAmount.h.
|
nodiscardconstexprnoexcept |
Definition at line 460 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 466 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 472 of file STAmount.h.
|
nodiscard |
Definition at line 478 of file STAmount.h.
|
constexpr |
| TIss & xrpl::STAmount::get | ( | ) |
Definition at line 492 of file STAmount.h.
|
nodiscard |
Definition at line 498 of file STAmount.h.
|
nodiscardnoexcept |
Definition at line 504 of file STAmount.h.
|
nodiscard |
Returns a zero value with the same issuer and currency.
Definition at line 512 of file STAmount.h.
| void xrpl::STAmount::setJson | ( | json::Value & | elem | ) | const |
Definition at line 606 of file STAmount.cpp.
|
nodiscardnoexcept |
Definition at line 592 of file STAmount.h.
|
nodiscard |
Checks if this amount evaluates to zero when constrained to a specific accounting scale.
For XRP and MPT roundToScale is a no-op, returns true only when the amount itself is zero. The scale argument is ignored in that case. For IOU, the amount is rounded to the given scale using Number::RoundingMode::ToNearest mode and the result is checked for zero; if scale <= exponent(), roundToScale short-circuits and returns the value unchanged, so this returns false for any non-zero amount.
| scale | The target accounting scale to evaluate against. |
Definition at line 1658 of file STAmount.cpp.
|
explicitnoexcept |
Definition at line 517 of file STAmount.h.
Definition at line 358 of file STAmount.cpp.
Definition at line 365 of file STAmount.cpp.
| STAmount & xrpl::STAmount::operator= | ( | beast::Zero | ) |
Definition at line 536 of file STAmount.h.
Definition at line 543 of file STAmount.h.
Definition at line 333 of file STAmount.cpp.
| void xrpl::STAmount::negate | ( | ) |
Definition at line 568 of file STAmount.h.
| void xrpl::STAmount::clear | ( | ) |
Definition at line 575 of file STAmount.h.
| void xrpl::STAmount::clear | ( | Asset const & | asset | ) |
Definition at line 585 of file STAmount.h.
| void xrpl::STAmount::setIssue | ( | Asset const & | asset | ) |
Set the Issue for this amount.
Definition at line 407 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 630 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 636 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 646 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 734 of file STAmount.cpp.
|
overridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 742 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 790 of file STAmount.cpp.
|
nodiscardoverridevirtual |
Reimplemented from xrpl::STBase.
Definition at line 797 of file STAmount.cpp.
|
nodiscard |
Definition at line 271 of file STAmount.cpp.
|
nodiscard |
Definition at line 286 of file STAmount.cpp.
|
nodiscard |
Definition at line 301 of file STAmount.cpp.
|
staticprivate |
Definition at line 551 of file STAmount.h.
|
staticprivate |
Definition at line 248 of file STAmount.cpp.
|
private |
Definition at line 878 of file STAmount.cpp.
|
private |
Definition at line 821 of file STAmount.cpp.
|
overrideprivatevirtual |
Reimplemented from xrpl::STBase.
Definition at line 254 of file STAmount.cpp.
|
overrideprivatevirtual |
Reimplemented from xrpl::STBase.
Definition at line 260 of file STAmount.cpp.
Definition at line 316 of file STAmount.cpp.
|
nodiscardconstexpr |
Definition at line 485 of file STAmount.h.
|
inherited |
Definition at line 36 of file STBase.cpp.
|
inherited |
Definition at line 42 of file STBase.cpp.
|
inherited |
|
nodiscardinherited |
|
inherited |
|
nodiscardinherited |
Definition at line 126 of file STBase.cpp.
|
inherited |
Definition at line 132 of file STBase.cpp.
|
staticprotectedinherited |
|
staticprivatenoexceptinherited |
Definition at line 109 of file CountedObject.h.
|
friend |
Definition at line 302 of file STAmount.h.
Definition at line 372 of file STAmount.cpp.
|
private |
Definition at line 39 of file STAmount.h.
|
private |
Definition at line 40 of file STAmount.h.
|
private |
Definition at line 41 of file STAmount.h.
|
private |
Definition at line 42 of file STAmount.h.
|
staticconstexpr |
Definition at line 47 of file STAmount.h.
|
staticconstexpr |
Definition at line 48 of file STAmount.h.
|
staticconstexpr |
Definition at line 51 of file STAmount.h.
|
staticconstexpr |
Definition at line 53 of file STAmount.h.
|
staticconstexpr |
Definition at line 55 of file STAmount.h.
|
staticconstexpr |
Definition at line 58 of file STAmount.h.
|
staticconstexpr |
Definition at line 59 of file STAmount.h.
|
staticconstexpr |
Definition at line 60 of file STAmount.h.
|
staticconstexpr |
Definition at line 61 of file STAmount.h.
|
staticconstexpr |
Definition at line 62 of file STAmount.h.
|
static |
Definition at line 64 of file STAmount.h.
|
inherited |
Definition at line 134 of file CountedObject.h.