rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::STNumber Class Reference

A serializable number. More...

#include <STNumber.h>

Inheritance diagram for ripple::STNumber:
Inheritance graph
[legend]
Collaboration diagram for ripple::STNumber:
Collaboration graph
[legend]

Public Types

using value_type = Number
 

Public Member Functions

 STNumber ()=default
 
 STNumber (SField const &field, Number const &value=Number())
 
 STNumber (SerialIter &sit, SField const &field)
 
SerializedTypeID getSType () const override
 
std::string getText () const override
 
void add (Serializer &s) const override
 
Number const & value () const
 
void setValue (Number const &v)
 
bool isEquivalent (STBase const &t) const override
 
bool isDefault () const override
 
 operator Number () const
 
bool operator== (const STBase &t) const
 
bool operator!= (const STBase &t) const
 
template<class D >
D & downcast ()
 
template<class D >
D const & downcast () const
 
template<class D >
D const & downcast () const
 
virtual std::string getFullText () const
 
virtual Json::Value getJson (JsonOptions) const
 
void setFName (SField const &n)
 A STBase is a field. More...
 
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)
 

Private Member Functions

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

Static Private Member Functions

static auto & getCounter () noexcept
 

Private Attributes

Number value_
 
SField const * fName
 

Detailed Description

A serializable number.

This type is-a Number, and can be used everywhere that is accepted. This type simply integrates Number with the serialization framework, letting it be used for fields in ledger entries and transactions. It is effectively an STAmount sans Asset: it can represent a value of any token type (XRP, IOU, or MPT) without paying the storage cost of duplicating asset information that may be deduced from the context.

Definition at line 42 of file STNumber.h.

Member Typedef Documentation

◆ value_type

Definition at line 48 of file STNumber.h.

Constructor & Destructor Documentation

◆ STNumber() [1/3]

ripple::STNumber::STNumber ( )
default

◆ STNumber() [2/3]

ripple::STNumber::STNumber ( SField const &  field,
Number const &  value = Number() 
)
explicit

Definition at line 34 of file STNumber.cpp.

◆ STNumber() [3/3]

ripple::STNumber::STNumber ( SerialIter sit,
SField const &  field 
)

Definition at line 39 of file STNumber.cpp.

Member Function Documentation

◆ getSType()

SerializedTypeID ripple::STNumber::getSType ( ) const
overridevirtual

Reimplemented from ripple::STBase.

Definition at line 49 of file STNumber.cpp.

◆ getText()

std::string ripple::STNumber::getText ( ) const
overridevirtual

Reimplemented from ripple::STBase.

Definition at line 55 of file STNumber.cpp.

◆ add()

void ripple::STNumber::add ( Serializer s) const
overridevirtual

Reimplemented from ripple::STBase.

Definition at line 61 of file STNumber.cpp.

◆ value()

Number const & ripple::STNumber::value ( ) const

Definition at line 73 of file STNumber.cpp.

◆ setValue()

void ripple::STNumber::setValue ( Number const &  v)

Definition at line 79 of file STNumber.cpp.

◆ isEquivalent()

bool ripple::STNumber::isEquivalent ( STBase const &  t) const
overridevirtual

Reimplemented from ripple::STBase.

Definition at line 97 of file STNumber.cpp.

◆ isDefault()

bool ripple::STNumber::isDefault ( ) const
overridevirtual

Reimplemented from ripple::STBase.

Definition at line 107 of file STNumber.cpp.

◆ operator Number()

ripple::STNumber::operator Number ( ) const

Definition at line 71 of file STNumber.h.

◆ copy()

STBase * ripple::STNumber::copy ( std::size_t  n,
void *  buf 
) const
overrideprivatevirtual

Reimplemented from ripple::STBase.

Definition at line 85 of file STNumber.cpp.

◆ move()

STBase * ripple::STNumber::move ( std::size_t  n,
void *  buf 
)
overrideprivatevirtual

Reimplemented from ripple::STBase.

Definition at line 91 of file STNumber.cpp.

◆ operator==()

bool ripple::STBase::operator== ( const STBase t) const
inherited

Definition at line 51 of file STBase.cpp.

◆ operator!=()

bool ripple::STBase::operator!= ( const STBase t) const
inherited

Definition at line 57 of file STBase.cpp.

◆ downcast() [1/3]

template<class D >
D & ripple::STBase::downcast
inherited

Definition at line 204 of file STBase.h.

◆ downcast() [2/3]

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

◆ downcast() [3/3]

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

Definition at line 214 of file STBase.h.

◆ getFullText()

std::string ripple::STBase::getFullText ( ) const
virtualinherited

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

Definition at line 81 of file STBase.cpp.

◆ getJson()

Json::Value ripple::STBase::getJson ( JsonOptions  ) const
virtualinherited

◆ setFName()

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

A STBase is a field.

This sets the name.

Definition at line 134 of file STBase.cpp.

◆ getFName()

SField const & ripple::STBase::getFName ( ) const
inherited

Definition at line 141 of file STBase.cpp.

◆ addFieldID()

void ripple::STBase::addFieldID ( Serializer s) const
inherited

Definition at line 147 of file STBase.cpp.

◆ emplace()

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

Definition at line 224 of file STBase.h.

◆ getCounter()

static auto & ripple::CountedObject< STNumber >::getCounter ( )
staticprivatenoexceptinherited

Definition at line 129 of file CountedObject.h.

Member Data Documentation

◆ value_

Number ripple::STNumber::value_
private

Definition at line 45 of file STNumber.h.

◆ fName

SField const* ripple::STBase::fName
privateinherited

Definition at line 127 of file STBase.h.