![]() |
Bitcoin Core
0.21.1
P2P Digital Currency
|
Bitcoin unit definitions. More...
#include <bitcoinunits.h>
Public Types | |
| enum | Unit { BTC, mBTC, uBTC, SAT } |
| Bitcoin units. More... | |
| enum | SeparatorStyle { SeparatorStyle::NEVER, SeparatorStyle::STANDARD, SeparatorStyle::ALWAYS } |
Public Member Functions | |
| BitcoinUnits (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< Unit > | availableUnits () |
| Get list of units, for drop-down box. More... | |
| static bool | valid (int unit) |
| Is unit ID valid? More... | |
| static QString | longName (int unit) |
| Long name. More... | |
| static QString | shortName (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 int | decimals (int unit) |
| Number of decimals left. More... | |
| static QString | format (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false) |
| Format as string. More... | |
| static QString | formatWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD) |
| Format as string (with unit) More... | |
| static QString | formatHtmlWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD) |
| Format as HTML string (with unit) More... | |
| static QString | formatWithPrivacy (int unit, const CAmount &amount, SeparatorStyle separators, bool privacy) |
| Format as string (with unit) of fixed length to preserve privacy, if it is set. More... | |
| static bool | parse (int unit, const QString &value, CAmount *val_out) |
| Parse string to coin amount. More... | |
| static QString | getAmountColumnTitle (int unit) |
| Gets title for amount column including current display unit if optionsModel reference available */. More... | |
Private Attributes | |
| QList< BitcoinUnits::Unit > | unitlist |
AbstractListModel implementation | |
| 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 31 of file bitcoinunits.h.
| Enumerator | |
|---|---|
| UnitRole |
Unit identifier. |
Definition at line 91 of file bitcoinunits.h.
|
strong |
| Enumerator | |
|---|---|
| NEVER | |
| STANDARD | |
| ALWAYS | |
Definition at line 49 of file bitcoinunits.h.
| enum BitcoinUnits::Unit |
Bitcoin units.
| Enumerator | |
|---|---|
| BTC | |
| mBTC | |
| uBTC | |
| SAT | |
Definition at line 41 of file bitcoinunits.h.
|
explicit |
Definition at line 11 of file bitcoinunits.cpp.
|
static |
Get list of units, for drop-down box.
Definition at line 17 of file bitcoinunits.cpp.
|
override |
|
static |
Number of decimals left.
Definition at line 87 of file bitcoinunits.cpp.
|
static |
Longer description.
Definition at line 63 of file bitcoinunits.cpp.
|
static |
Number of Satoshis (1e-8) per unit.
Definition at line 75 of file bitcoinunits.cpp.
|
static |
Format as string.
Definition at line 99 of file bitcoinunits.cpp.
|
static |
Format as HTML string (with unit)
Definition at line 149 of file bitcoinunits.cpp.
|
static |
Format as string (with unit) of fixed length to preserve privacy, if it is set.
Definition at line 156 of file bitcoinunits.cpp.
|
static |
Format as string (with unit)
Definition at line 144 of file bitcoinunits.cpp.
|
static |
Gets title for amount column including current display unit if optionsModel reference available */.
Definition at line 207 of file bitcoinunits.cpp.
|
static |
Long name.
Definition at line 41 of file bitcoinunits.cpp.
|
static |
Return maximum number of base units (Satoshis)
Definition at line 243 of file bitcoinunits.cpp.
|
static |
Parse string to coin amount.
Definition at line 168 of file bitcoinunits.cpp.
|
inlinestatic |
|
override |
Definition at line 217 of file bitcoinunits.cpp.
|
static |
Short name.
Definition at line 53 of file bitcoinunits.cpp.
|
static |
Is unit ID valid?
Definition at line 27 of file bitcoinunits.cpp.
|
private |
Definition at line 110 of file bitcoinunits.h.
1.8.8