Skip to main content

In-Person Payments

Decimal.hpp

Last updated: 16-Jul-2024

namespace verifone_sdk

struct Decimal : public verifone_sdk::DecimalBase

Public Functions

Decimal()
Decimal(int64_t value1)
Decimal(int32_t value1)
Decimal(uint32_t value1)
Decimal(int32_t scale1, int64_t value1)
Decimal(int32_t scale1, int32_t value1)
Decimal(int32_t scale1, uint32_t value1)
Decimal(const Decimal &other)
~Decimal() override = default
double GetValue() const
int32_t GetScale() const
int64_t GetUnscaledValue() const
bool IsZero() const
bool operator==(const Decimal &other) const
std::string ToString(const uint32_t display_precision = 2, const int trim_zeros_count = 0) const
std::string ToLocalizedString(const uint32_t display_precision = 2, const bool currency = false) const
std::string ToLocalizedCurrencyString(const bool use_currency_precision = false, const bool drop_symbol = false) const

Public Static Functions

static std::optional<Decimal> FromDecimalWithScale(const Decimal &other, int32_t scale1)
static std::optional<Decimal> FromDouble(double value1)
static std::optional<Decimal> FromDoubleWithScale(int32_t scale1, double value1)
static std::optional<Decimal> Parse(const std::string value, const bool locale_dependent = false)
static bool SetLocale(std::string locale_name)

Public Static Attributes

static const int kMaxScale

Private Functions

std::string ToStringPriv(const uint32_t display_precision, const int trim_zeros_count, const bool absolute = false, const char decimal_separator = '.') const
bool SetValue(double value1)

Private Static Functions

static int64_t AbsolutePowerOf10(int32_t x)
static bool Convert(const double &d, int64_t &i64)
static std::locale &GetLocale()
static double ScaleValue(const double &value1, int32_t scale1)
static std::optional<int64_t> ScaleValue(const int64_t &value1, int32_t scale1)
static int64_t ScaleDown(const int64_t &value1, int32_t scale1)
static double UnscaleValue(const int64_t value1, int32_t scale1)

Private Static Attributes

static std::unique_ptr<std::locale> locale_instance_
static const char *kDecimalChars
static const int kThousandsGrouping

Friends

friend PSDK_EXPORT friend std::ostream & operator<< (std::ostream &strm, const Decimal &a)
friend PSDK_EXPORT friend std::optional< Decimal > operator+ (const Decimal &lhs, const Decimal &rhs)
friend PSDK_EXPORT friend std::optional< Decimal > operator* (const Decimal &lhs, const Decimal &rhs)
friend PSDK_EXPORT friend std::optional< Decimal > operator- (const Decimal &lhs, const Decimal &rhs)
friend PSDK_EXPORT friend std::optional< Decimal > operator/ (const Decimal &lhs, const Decimal &rhs)

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo