Raven Core  3.0.0
P2P Digital Currency
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
RavenUnits Class Reference

Raven unit definitions. More...

#include <ravenunits.h>

Inheritance diagram for RavenUnits:
[legend]
Collaboration diagram for RavenUnits:
[legend]

Public Types

enum  Unit { RVN, mRVN, uRVN }
 Raven units. More...
 
enum  SeparatorStyle { separatorNever, separatorStandard, separatorAlways }
 

Public Member Functions

 RavenUnits (QObject *parent)
 

Static Public Member Functions

static QString removeSpaces (QString text)
 
static CAmount maxMoney ()
 Return maximum number of base units (Satoshis) More...
 
Static API

Unit conversion and formatting

static QList< UnitavailableUnits ()
 Get list of units, for drop-down box. More...
 
static bool valid (int unit)
 Is unit ID valid? More...
 
static QString name (int unit)
 Short name. More...
 
static QString description (int unit)
 Longer description. More...
 
static qint64 factor (int unit)
 Number of Satoshis (1e-8) per unit. More...
 
static qint64 factorAsset (int unit)
 Number of Satoshis (1e-8) per unit for assets. More...
 
static int decimals (int unit)
 Number of decimals left. More...
 
static QString format (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, const int nAssetUnit=MIN_ASSET_UNITS - 1)
 Format as string. More...
 
static QString formatWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
 Format as string (with unit) More...
 
static QString formatWithCustomName (QString customName, const CAmount &amount, int unit=MAX_ASSET_UNITS, bool plussign=false, SeparatorStyle separators=separatorStandard)
 Format as string (with custom name) More...
 
static QString formatHtmlWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
 Format as HTML string (with unit) More...
 
static bool parse (int unit, const QString &value, CAmount *val_out)
 Parse string to coin amount. More...
 
static bool assetParse (int assetUnit, const QString &value, CAmount *val_out)
 
static QString getAmountColumnTitle (int unit)
 Gets title for amount column including current display unit if optionsModel reference available */. More...
 

Private Attributes

QList< RavenUnits::Unitunitlist
 

AbstractListModel implementation

List model for unit drop-down selection box.

enum  RoleIndex { UnitRole = Qt::UserRole }
 
int rowCount (const QModelIndex &parent) const
 
QVariant data (const QModelIndex &index, int role) const
 

Detailed Description

Raven unit definitions.

Encapsulates parsing and formatting and serves as list model for drop-down selection boxes.

Definition at line 53 of file ravenunits.h.

Member Enumeration Documentation

◆ RoleIndex

Enumerator
UnitRole 

Unit identifier.

Definition at line 113 of file ravenunits.h.

◆ SeparatorStyle

Enumerator
separatorNever 
separatorStandard 
separatorAlways 

Definition at line 70 of file ravenunits.h.

◆ Unit

Raven units.

Note
Source: https://en.raven.it/wiki/Units . Please add only sensible ones
Enumerator
RVN 
mRVN 
uRVN 

Definition at line 63 of file ravenunits.h.

Constructor & Destructor Documentation

◆ RavenUnits()

RavenUnits::RavenUnits ( QObject *  parent)
explicit

Definition at line 12 of file ravenunits.cpp.

Member Function Documentation

◆ assetParse()

bool RavenUnits::assetParse ( int  assetUnit,
const QString &  value,
CAmount val_out 
)
static

Definition at line 203 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ availableUnits()

QList< RavenUnits::Unit > RavenUnits::availableUnits ( )
static

Get list of units, for drop-down box.

Definition at line 18 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ data()

QVariant RavenUnits::data ( const QModelIndex &  index,
int  role 
) const

Definition at line 258 of file ravenunits.cpp.

Here is the call graph for this function:

◆ decimals()

int RavenUnits::decimals ( int  unit)
static

Number of decimals left.

Definition at line 90 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ description()

QString RavenUnits::description ( int  unit)
static

Longer description.

Definition at line 51 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ factor()

qint64 RavenUnits::factor ( int  unit)
static

Number of Satoshis (1e-8) per unit.

Definition at line 62 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ factorAsset()

qint64 RavenUnits::factorAsset ( int  unit)
static

Number of Satoshis (1e-8) per unit for assets.

Definition at line 73 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ format()

QString RavenUnits::format ( int  unit,
const CAmount amount,
bool  plussign = false,
SeparatorStyle  separators = separatorStandard,
const int  nAssetUnit = MIN_ASSET_UNITS - 1 
)
static

Format as string.

Definition at line 101 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatHtmlWithUnit()

QString RavenUnits::formatHtmlWithUnit ( int  unit,
const CAmount amount,
bool  plussign = false,
SeparatorStyle  separators = separatorStandard 
)
static

Format as HTML string (with unit)

Definition at line 156 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatWithCustomName()

QString RavenUnits::formatWithCustomName ( QString  customName,
const CAmount amount,
int  unit = MAX_ASSET_UNITS,
bool  plussign = false,
SeparatorStyle  separators = separatorStandard 
)
static

Format as string (with custom name)

Definition at line 151 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatWithUnit()

QString RavenUnits::formatWithUnit ( int  unit,
const CAmount amount,
bool  plussign = false,
SeparatorStyle  separators = separatorStandard 
)
static

Format as string (with unit)

Definition at line 146 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAmountColumnTitle()

QString RavenUnits::getAmountColumnTitle ( int  unit)
static

Gets title for amount column including current display unit if optionsModel reference available */.

Definition at line 242 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxMoney()

CAmount RavenUnits::maxMoney ( )
static

Return maximum number of base units (Satoshis)

Definition at line 278 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ name()

QString RavenUnits::name ( int  unit)
static

Short name.

Definition at line 40 of file ravenunits.cpp.

Here is the caller graph for this function:

◆ parse()

bool RavenUnits::parse ( int  unit,
const QString &  value,
CAmount val_out 
)
static

Parse string to coin amount.

Definition at line 164 of file ravenunits.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSpaces()

static QString RavenUnits::removeSpaces ( QString  text)
inlinestatic

Definition at line 121 of file ravenunits.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowCount()

int RavenUnits::rowCount ( const QModelIndex &  parent) const

Definition at line 252 of file ravenunits.cpp.

◆ valid()

bool RavenUnits::valid ( int  unit)
static

Is unit ID valid?

Definition at line 27 of file ravenunits.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ unitlist

QList<RavenUnits::Unit> RavenUnits::unitlist
private

Definition at line 135 of file ravenunits.h.


The documentation for this class was generated from the following files: