Bitcoin ABC 0.26.3
P2P Digital Currency
|
Bitcoin unit definitions. More...
#include <bitcoinunits.h>
Public Types | |
enum | Unit { base , sub } |
Currency units Please add only sensible ones. More... | |
enum class | SeparatorStyle { NEVER , STANDARD , ALWAYS } |
Public Member Functions | |
BitcoinUnits (QObject *parent) | |
Static Public Member Functions | |
static QString | removeSpaces (QString text) |
static Amount | maxMoney () |
Return maximum number of base units (Satoshis) | |
Static API | |
Unit conversion and formatting | |
static QList< Unit > | availableUnits () |
Get list of units, for drop-down box. | |
static bool | valid (int unit) |
Is unit ID valid? | |
static QString | longName (int unit) |
Long name. | |
static QString | shortName (int unit) |
Short name. | |
static QString | description (int unit) |
Longer description. | |
static Amount | factor (int unit) |
Number of Satoshis (1e-8) per unit. | |
static int | decimals (int unit) |
Number of decimals left. | |
static QString | format (int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false) |
Format as string. | |
static QString | formatWithUnit (int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD) |
Format as string (with unit) | |
static QString | formatHtmlWithUnit (int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD) |
Format as HTML string (with unit) | |
static QString | formatWithPrivacy (int unit, const Amount &amount, SeparatorStyle separators, bool privacy) |
Format as string (with unit) of fixed length to preserve privacy, if it is set. | |
static bool | parse (int unit, const QString &value, Amount *val_out) |
Parse string to coin amount. | |
static QString | getAmountColumnTitle (int unit) |
Gets title for amount column including current display unit if optionsModel reference available */. | |
Private Attributes | |
QList< BitcoinUnits::Unit > | unitlist |
AbstractListModel implementation | |
List model for unit drop-down selection box. | |
enum | RoleIndex { UnitRole = Qt::UserRole } |
int | rowCount (const QModelIndex &parent) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Bitcoin unit definitions.
Encapsulates parsing and formatting and serves as list model for drop-down selection boxes.
Definition at line 32 of file bitcoinunits.h.
Enumerator | |
---|---|
UnitRole | Unit identifier. |
Definition at line 90 of file bitcoinunits.h.
Enumerator | |
---|---|
NEVER | |
STANDARD | |
ALWAYS |
Definition at line 44 of file bitcoinunits.h.
Currency units Please add only sensible ones.
Enumerator | |
---|---|
base | |
sub |
Definition at line 42 of file bitcoinunits.h.
|
explicit |
Definition at line 46 of file bitcoinunits.cpp.
|
static |
Get list of units, for drop-down box.
Definition at line 49 of file bitcoinunits.cpp.
|
override |
Number of decimals left.
Definition at line 97 of file bitcoinunits.cpp.
Longer description.
Definition at line 79 of file bitcoinunits.cpp.
Number of Satoshis (1e-8) per unit.
Definition at line 85 of file bitcoinunits.cpp.
|
static |
Format as string.
Definition at line 108 of file bitcoinunits.cpp.
|
static |
Format as HTML string (with unit)
Definition at line 167 of file bitcoinunits.cpp.
|
static |
Format as string (with unit) of fixed length to preserve privacy, if it is set.
Definition at line 175 of file bitcoinunits.cpp.
|
static |
Format as string (with unit)
Definition at line 161 of file bitcoinunits.cpp.
Gets title for amount column including current display unit if optionsModel reference available */.
Definition at line 227 of file bitcoinunits.cpp.
Long name.
Definition at line 66 of file bitcoinunits.cpp.
|
static |
Return maximum number of base units (Satoshis)
Definition at line 257 of file bitcoinunits.cpp.
Parse string to coin amount.
Definition at line 189 of file bitcoinunits.cpp.
Definition at line 98 of file bitcoinunits.h.
|
override |
Short name.
Definition at line 72 of file bitcoinunits.cpp.
Is unit ID valid?
Definition at line 56 of file bitcoinunits.cpp.
|
private |
Definition at line 108 of file bitcoinunits.h.