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

Intermediate class for any STBase-derived class to store an Asset. More...

#include <STTakesAsset.h>

Inheritance diagram for xrpl::STTakesAsset:
Collaboration diagram for xrpl::STTakesAsset:

Public Member Functions

virtual void associateAsset (Asset const &a)
 STBase ()
 STBase (STBase const &)=default
 STBase (SField const &n)
STBaseoperator= (STBase const &t)
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
virtual SerializedTypeID getSType () const
virtual std::string getFullText () const
virtual std::string getText () const
virtual json::Value getJson (JsonOptions=JsonOptions::Values::None) const
virtual void add (Serializer &s) const
virtual bool isEquivalent (STBase const &t) const
virtual bool isDefault () const
void setFName (SField const &n)
 A STBase is a field.
SField const & getFName () const
void addFieldID (Serializer &s) const

Static Protected Member Functions

template<class T>
static STBaseemplace (std::size_t n, void *buf, T &&val)

Protected Attributes

std::optional< Assetasset_

Private Member Functions

virtual STBasecopy (std::size_t n, void *buf) const
virtual STBasemove (std::size_t n, void *buf)

Private Attributes

SField const * fName_

Detailed Description

Intermediate class for any STBase-derived class to store an Asset.

In the class definition, this class should be specified as a base class instead of STBase.

Specifically, the Asset is only stored and used at runtime. It should not be serialized to the ledger.

The derived class decides what to do with the Asset, and when. It will not necessarily be set at any given time. As of this writing, only STNumber uses it to round the stored Number to the Asset's precision both when associated, and when serializing the Number.

Definition at line 21 of file STTakesAsset.h.

Member Function Documentation

◆ associateAsset()

void xrpl::STTakesAsset::associateAsset ( Asset const & a)
virtual

Reimplemented in xrpl::STNumber.

Definition at line 35 of file STTakesAsset.h.

◆ STBase() [1/3]

Definition at line 122 of file STBase.cpp.

◆ STBase() [2/3]

xrpl::STBase::STBase ( STBase const & )
default

◆ STBase() [3/3]

xrpl::STBase::STBase ( SField const & n)
explicit

Definition at line 127 of file STBase.cpp.

◆ operator=()

STBase & xrpl::STBase::operator= ( STBase const & t)

Definition at line 125 of file STBase.cpp.

◆ operator==()

bool xrpl::STBase::operator== ( STBase const & t) const
inherited

Definition at line 36 of file STBase.cpp.

◆ operator!=()

bool xrpl::STBase::operator!= ( STBase const & t) const
inherited

Definition at line 42 of file STBase.cpp.

◆ downcast() [1/3]

template<class D>
D & xrpl::STBase::downcast ( )
inherited

Definition at line 195 of file STBase.h.

◆ downcast() [2/3]

template<class D>
D const & xrpl::STBase::downcast ( ) const
inherited

◆ downcast() [3/3]

template<class D>
D const & xrpl::STBase::downcast ( ) const
nodiscardinherited

Definition at line 205 of file STBase.h.

◆ getSType()

◆ getFullText()

std::string xrpl::STBase::getFullText ( ) const
nodiscardvirtualinherited

Reimplemented in xrpl::STAmount, xrpl::STArray, xrpl::STLedgerEntry, xrpl::STObject, and xrpl::STTx.

Definition at line 66 of file STBase.cpp.

◆ getText()

◆ getJson()

◆ add()

◆ isEquivalent()

◆ isDefault()

◆ setFName()

void xrpl::STBase::setFName ( SField const & n)
inherited

A STBase is a field.

This sets the name.

Definition at line 119 of file STBase.cpp.

◆ getFName()

SField const & xrpl::STBase::getFName ( ) const
nodiscardinherited

Definition at line 126 of file STBase.cpp.

◆ addFieldID()

void xrpl::STBase::addFieldID ( Serializer & s) const
inherited

Definition at line 132 of file STBase.cpp.

◆ emplace()

template<class T>
STBase * xrpl::STBase::emplace ( std::size_t n,
void * buf,
T && val )
staticprotectedinherited

Definition at line 215 of file STBase.h.

◆ copy()

◆ move()

Member Data Documentation

◆ asset_

std::optional<Asset> xrpl::STTakesAsset::asset_
protected

Definition at line 24 of file STTakesAsset.h.

◆ fName_

SField const* xrpl::STBase::fName_
privateinherited

Definition at line 118 of file STBase.h.