rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
xrpl::Asset Class Reference

#include <Asset.h>

Collaboration diagram for xrpl::Asset:
Collaboration graph
[legend]

Public Types

using value_type = std::variant< Issue, MPTIssue >
 

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
 
void setJson (Json::Value &jv) const
 
STAmount operator() (Number const &) const
 
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 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 25 of file Asset.h.

Member Typedef Documentation

◆ value_type

Definition at line 28 of file Asset.h.

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 39 of file Asset.h.

◆ Asset() [3/4]

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

Definition at line 43 of file Asset.h.

◆ Asset() [4/4]

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

Definition at line 47 of file Asset.h.

Member Function Documentation

◆ getIssuer()

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

Definition at line 17 of file Asset.cpp.

◆ get() [1/3]

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

◆ get() [2/3]

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

Definition at line 146 of file Asset.h.

◆ holds()

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

Definition at line 130 of file Asset.h.

◆ getText()

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

Definition at line 23 of file Asset.cpp.

◆ value()

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

Definition at line 154 of file Asset.h.

◆ setJson()

void xrpl::Asset::setJson ( Json::Value jv) const

Definition at line 29 of file Asset.cpp.

◆ operator()()

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

Definition at line 35 of file Asset.cpp.

◆ native()

bool xrpl::Asset::native ( ) const

Definition at line 79 of file Asset.h.

◆ integral()

bool xrpl::Asset::integral ( ) const

Definition at line 92 of file Asset.h.

◆ get() [3/3]

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

Definition at line 137 of file Asset.h.

Friends And Related Symbol Documentation

◆ operator== [1/2]

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

Definition at line 160 of file Asset.h.

◆ operator<=>

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

Definition at line 173 of file Asset.h.

◆ operator== [2/2]

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

Definition at line 190 of file Asset.h.

◆ equalTokens

constexpr 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 196 of file Asset.h.

Member Data Documentation

◆ issue_

value_type xrpl::Asset::issue_
private

Definition at line 31 of file Asset.h.