aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoinunits.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-25 21:35:45 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-25 21:38:54 +0200
commite285ffcd052a42a6e870f093e7663671a2a3b147 (patch)
treed9c5237ba0d2c6617d6202cbf1fda666a0b33d78 /src/qt/bitcoinunits.h
parentbbae0fc9efa6eb7155d679a1cc3eeb451d594d14 (diff)
preparations for multiple unit (uBTC, mBTC, BTC) support, fix amount entry issue
Diffstat (limited to 'src/qt/bitcoinunits.h')
-rw-r--r--src/qt/bitcoinunits.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h
new file mode 100644
index 0000000000..fa85755ad4
--- /dev/null
+++ b/src/qt/bitcoinunits.h
@@ -0,0 +1,34 @@
+#ifndef BITCOINUNITS_H
+#define BITCOINUNITS_H
+
+#include <QString>
+
+// Bitcoin unit definitions
+class BitcoinUnits
+{
+public:
+ enum Unit
+ {
+ BTC,
+ mBTC,
+ uBTC
+ };
+
+ // Short name
+ static QString name(Unit unit);
+ // Longer description
+ static QString description(Unit unit);
+ // Number of satoshis / unit
+ static qint64 factor(Unit unit);
+ // Number of decimals left
+ static int decimals(Unit unit);
+ // Format as string
+ static QString format(Unit unit, qint64 amount, bool plussign=false);
+ // Format as string (with unit)
+ static QString formatWithUnit(Unit unit, qint64 amount, bool plussign=false);
+ // Parse string to coin amount
+ static bool parse(Unit unit, const QString &value, qint64 *val_out);
+
+};
+
+#endif // BITCOINUNITS_H