xrpld
Loading...
Searching...
No Matches
xrpl::Asset Class Reference

#include <Asset.h>

Collaboration diagram for xrpl::Asset:

Public Types

using value_type = std::variant<Issue, MPTIssue>
using token_type = std::variant<Currency, MPTID>
using AmtType

Public Member Functions

 Asset ()=default
 Asset (Issue const &issue)
 Conversions to Asset are implicit and conversions to specific issue type are explicit.
 Asset (MPTIssue const &mptIssue)
 Asset (MPTID const &issuanceID)
AccountID const & getIssuer () const
template<ValidIssueType TIss>
constexpr TIss const & get () const
template<ValidIssueType TIss>
TIss & get ()
template<ValidIssueType TIss>
constexpr bool holds () const
std::string getText () const
constexpr value_type const & value () const
constexpr token_type token () const
void setJson (json::Value &jv) const
STAmount operator() (Number const &) const
constexpr AmtType getAmountType () const
template<typename... Visitors>
constexpr auto visit (Visitors &&... visitors) const -> decltype(auto)
constexpr bool native () const
bool integral () const
template<ValidIssueType TIss>
constexpr TIss const & get () const

Private Attributes

value_type issue_

Friends

constexpr bool operator== (Asset const &lhs, Asset const &rhs)
constexpr std::weak_ordering operator<=> (Asset const &lhs, Asset const &rhs)
constexpr bool operator== (Currency const &lhs, Asset const &rhs)
constexpr bool operator== (BadAsset const &lhs, Asset const &rhs)
constexpr bool equalTokens (Asset const &lhs, Asset const &rhs)
 Return true if both assets refer to the same currency (regardless of issuer) or MPT issuance.

Detailed Description

Definition at line 42 of file Asset.h.

Member Typedef Documentation

◆ value_type

Definition at line 45 of file Asset.h.

◆ token_type

Definition at line 46 of file Asset.h.

◆ AmtType

Constructor & Destructor Documentation

◆ Asset() [1/4]

xrpl::Asset::Asset ( )
default

◆ Asset() [2/4]

xrpl::Asset::Asset ( Issue const & issue)

Conversions to Asset are implicit and conversions to specific issue type are explicit.

This design facilitates the use of Asset.

Definition at line 59 of file Asset.h.

◆ Asset() [3/4]

xrpl::Asset::Asset ( MPTIssue const & mptIssue)

Definition at line 63 of file Asset.h.

◆ Asset() [4/4]

xrpl::Asset::Asset ( MPTID const & issuanceID)

Definition at line 67 of file Asset.h.

Member Function Documentation

◆ getIssuer()

AccountID const & xrpl::Asset::getIssuer ( ) const
nodiscard

Definition at line 21 of file Asset.cpp.

◆ get() [1/3]

template<ValidIssueType TIss>
TIss const & xrpl::Asset::get ( ) const
constexpr

◆ get() [2/3]

template<ValidIssueType TIss>
TIss & xrpl::Asset::get ( )

Definition at line 182 of file Asset.h.

◆ holds()

template<ValidIssueType TIss>
bool xrpl::Asset::holds ( ) const
nodiscardconstexpr

Definition at line 166 of file Asset.h.

◆ getText()

std::string xrpl::Asset::getText ( ) const
nodiscard

Definition at line 27 of file Asset.cpp.

◆ value()

Asset::value_type const & xrpl::Asset::value ( ) const
nodiscardconstexpr

Definition at line 190 of file Asset.h.

◆ token()

Asset::token_type xrpl::Asset::token ( ) const
nodiscardconstexpr

Definition at line 196 of file Asset.h.

◆ setJson()

void xrpl::Asset::setJson ( json::Value & jv) const

Definition at line 33 of file Asset.cpp.

◆ operator()()

STAmount xrpl::Asset::operator() ( Number const & number) const

Definition at line 39 of file Asset.cpp.

◆ getAmountType()

Asset::AmtType xrpl::Asset::getAmountType ( ) const
nodiscardconstexpr

Definition at line 204 of file Asset.h.

◆ visit()

template<typename... Visitors>
auto xrpl::Asset::visit ( Visitors &&... visitors) const -> decltype(auto)
constexpr

Definition at line 107 of file Asset.h.

◆ native()

bool xrpl::Asset::native ( ) const
nodiscardconstexpr

Definition at line 115 of file Asset.h.

◆ integral()

bool xrpl::Asset::integral ( ) const
nodiscard

Definition at line 123 of file Asset.h.

◆ get() [3/3]

template<ValidIssueType TIss>
TIss const & xrpl::Asset::get ( ) const
nodiscardconstexpr

Definition at line 173 of file Asset.h.

◆ operator== [1/3]

bool operator== ( Asset const & lhs,
Asset const & rhs )
friend

Definition at line 219 of file Asset.h.

◆ operator<=>

std::weak_ordering operator<=> ( Asset const & lhs,
Asset const & rhs )
friend

Definition at line 236 of file Asset.h.

◆ operator== [2/3]

bool operator== ( Currency const & lhs,
Asset const & rhs )
friend

Definition at line 259 of file Asset.h.

◆ operator== [3/3]

bool operator== ( BadAsset const & lhs,
Asset const & rhs )
friend

Definition at line 267 of file Asset.h.

◆ equalTokens

bool equalTokens ( Asset const & lhs,
Asset const & rhs )
friend

Return true if both assets refer to the same currency (regardless of issuer) or MPT issuance.

Otherwise return false.

Definition at line 275 of file Asset.h.

Member Data Documentation

◆ issue_

value_type xrpl::Asset::issue_
private

Definition at line 51 of file Asset.h.