Changeset View
Changeset View
Standalone View
Standalone View
src/amount.h
Show All 16 Lines | |||||
struct Amount { | struct Amount { | ||||
private: | private: | ||||
int64_t amount; | int64_t amount; | ||||
explicit constexpr Amount(int64_t _amount) : amount(_amount) {} | explicit constexpr Amount(int64_t _amount) : amount(_amount) {} | ||||
public: | public: | ||||
constexpr Amount() : amount(0) {} | constexpr Amount() : amount(0) {} | ||||
constexpr Amount(const Amount &_camount) : amount(_camount.amount) {} | constexpr Amount(const Amount &other) : amount(other.amount) {} | ||||
/** | |||||
* Assignement operator. | |||||
*/ | |||||
constexpr Amount &operator=(const Amount &other) { | |||||
amount = other.amount; | |||||
return *this; | |||||
} | |||||
static constexpr Amount zero() { return Amount(0); } | static constexpr Amount zero() { return Amount(0); } | ||||
static constexpr Amount satoshi() { return Amount(1); } | static constexpr Amount satoshi() { return Amount(1); } | ||||
/** | /** | ||||
* Implement standard operators | * Implement standard operators | ||||
*/ | */ | ||||
Amount &operator+=(const Amount a) { | Amount &operator+=(const Amount a) { | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |