1#ifndef ICU4XFixedDecimal_HPP
2#define ICU4XFixedDecimal_HPP
12#include "ICU4XFixedDecimal.h"
23struct ICU4XFixedDecimalDeleter {
24 void operator()(capi::ICU4XFixedDecimal* l)
const noexcept {
25 capi::ICU4XFixedDecimal_destroy(l);
110 uint8_t
digit_at(int16_t magnitude)
const;
183 void pad_end(int16_t position);
196 void trunc(int16_t position);
216 void expand(int16_t position);
236 void ceil(int16_t position);
256 void floor(int16_t position);
307 inline const capi::ICU4XFixedDecimal* AsFFI()
const {
return this->inner.get(); }
308 inline capi::ICU4XFixedDecimal* AsFFIMut() {
return this->inner.get(); }
331 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_create_from_f64_with_integer_precision(f);
333 if (diplomat_result_raw_out_value.is_ok) {
338 return diplomat_result_out_value;
341 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_create_from_f64_with_lower_magnitude(f, magnitude);
343 if (diplomat_result_raw_out_value.is_ok) {
348 return diplomat_result_out_value;
351 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_create_from_f64_with_significant_digits(f, digits);
353 if (diplomat_result_raw_out_value.is_ok) {
358 return diplomat_result_out_value;
361 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_create_from_f64_with_floating_precision(f);
363 if (diplomat_result_raw_out_value.is_ok) {
368 return diplomat_result_out_value;
371 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_create_from_string(v.data(), v.size());
373 if (diplomat_result_raw_out_value.is_ok) {
378 return diplomat_result_out_value;
381 return capi::ICU4XFixedDecimal_digit_at(this->inner.get(), magnitude);
384 return capi::ICU4XFixedDecimal_magnitude_start(this->inner.get());
387 return capi::ICU4XFixedDecimal_magnitude_end(this->inner.get());
390 return capi::ICU4XFixedDecimal_nonzero_magnitude_start(this->inner.get());
393 return capi::ICU4XFixedDecimal_nonzero_magnitude_end(this->inner.get());
396 return capi::ICU4XFixedDecimal_is_zero(this->inner.get());
399 capi::ICU4XFixedDecimal_multiply_pow10(this->inner.get(), power);
405 capi::ICU4XFixedDecimal_set_sign(this->inner.get(),
static_cast<capi::ICU4XFixedDecimalSign
>(
sign));
408 capi::ICU4XFixedDecimal_apply_sign_display(this->inner.get(),
static_cast<capi::ICU4XFixedDecimalSignDisplay
>(sign_display));
411 capi::ICU4XFixedDecimal_trim_start(this->inner.get());
414 capi::ICU4XFixedDecimal_trim_end(this->inner.get());
417 capi::ICU4XFixedDecimal_pad_start(this->inner.get(), position);
420 capi::ICU4XFixedDecimal_pad_end(this->inner.get(), position);
423 capi::ICU4XFixedDecimal_set_max_position(this->inner.get(), position);
426 capi::ICU4XFixedDecimal_trunc(this->inner.get(), position);
429 capi::ICU4XFixedDecimal_trunc_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
432 capi::ICU4XFixedDecimal_half_trunc(this->inner.get(), position);
435 capi::ICU4XFixedDecimal_half_trunc_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
438 capi::ICU4XFixedDecimal_expand(this->inner.get(), position);
441 capi::ICU4XFixedDecimal_expand_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
444 capi::ICU4XFixedDecimal_half_expand(this->inner.get(), position);
447 capi::ICU4XFixedDecimal_half_expand_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
450 capi::ICU4XFixedDecimal_ceil(this->inner.get(), position);
453 capi::ICU4XFixedDecimal_ceil_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
456 capi::ICU4XFixedDecimal_half_ceil(this->inner.get(), position);
459 capi::ICU4XFixedDecimal_half_ceil_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
462 capi::ICU4XFixedDecimal_floor(this->inner.get(), position);
465 capi::ICU4XFixedDecimal_floor_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
468 capi::ICU4XFixedDecimal_half_floor(this->inner.get(), position);
471 capi::ICU4XFixedDecimal_half_floor_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
474 capi::ICU4XFixedDecimal_half_even(this->inner.get(), position);
477 capi::ICU4XFixedDecimal_half_even_to_increment(this->inner.get(), position,
static_cast<capi::ICU4XRoundingIncrement
>(increment));
480 auto diplomat_result_raw_out_value = capi::ICU4XFixedDecimal_concatenate_end(this->inner.get(), other.AsFFIMut());
482 if (diplomat_result_raw_out_value.is_ok) {
487 return diplomat_result_out_value;
490 capi::DiplomatWriteable to_writer = diplomat::WriteableTrait<W>::Construct(to);
491 capi::ICU4XFixedDecimal_to_string(this->inner.get(), &to_writer);
494 std::string diplomat_writeable_string;
496 capi::ICU4XFixedDecimal_to_string(this->inner.get(), &diplomat_writeable_out);
497 return diplomat_writeable_string;
ICU4XError
Definition ICU4XError.hpp:23
ICU4XFixedDecimalSignDisplay
Definition ICU4XFixedDecimalSignDisplay.hpp:21
ICU4XFixedDecimalSign
Definition ICU4XFixedDecimalSign.hpp:21
ICU4XRoundingIncrement
Definition ICU4XRoundingIncrement.hpp:21
Definition ICU4XFixedDecimal.hpp:32
void floor(int16_t position)
Definition ICU4XFixedDecimal.hpp:461
ICU4XFixedDecimal(capi::ICU4XFixedDecimal *i)
Definition ICU4XFixedDecimal.hpp:309
void half_even_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:476
void pad_start(int16_t position)
Definition ICU4XFixedDecimal.hpp:416
diplomat::result< std::monostate, std::monostate > concatenate_end(ICU4XFixedDecimal &other)
Definition ICU4XFixedDecimal.hpp:479
void floor_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:464
void half_trunc_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:434
static ICU4XFixedDecimal create_from_i32(int32_t v)
Definition ICU4XFixedDecimal.hpp:318
static ICU4XFixedDecimal create_from_u32(uint32_t v)
Definition ICU4XFixedDecimal.hpp:321
void trim_end()
Definition ICU4XFixedDecimal.hpp:413
void ceil(int16_t position)
Definition ICU4XFixedDecimal.hpp:449
void half_expand_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:446
void to_string_to_writeable(W &to) const
Definition ICU4XFixedDecimal.hpp:489
std::string to_string() const
Definition ICU4XFixedDecimal.hpp:493
void ceil_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:452
ICU4XFixedDecimalSign sign() const
Definition ICU4XFixedDecimal.hpp:401
void half_floor_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:470
void multiply_pow10(int16_t power)
Definition ICU4XFixedDecimal.hpp:398
ICU4XFixedDecimal()=default
ICU4XFixedDecimal(ICU4XFixedDecimal &&) noexcept=default
void set_max_position(int16_t position)
Definition ICU4XFixedDecimal.hpp:422
int16_t magnitude_end() const
Definition ICU4XFixedDecimal.hpp:386
static ICU4XFixedDecimal create_from_u64(uint64_t v)
Definition ICU4XFixedDecimal.hpp:327
void trunc_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:428
int16_t magnitude_start() const
Definition ICU4XFixedDecimal.hpp:383
void trunc(int16_t position)
Definition ICU4XFixedDecimal.hpp:425
void set_sign(ICU4XFixedDecimalSign sign)
Definition ICU4XFixedDecimal.hpp:404
void half_trunc(int16_t position)
Definition ICU4XFixedDecimal.hpp:431
void expand_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:440
void pad_end(int16_t position)
Definition ICU4XFixedDecimal.hpp:419
void trim_start()
Definition ICU4XFixedDecimal.hpp:410
bool is_zero() const
Definition ICU4XFixedDecimal.hpp:395
int16_t nonzero_magnitude_end() const
Definition ICU4XFixedDecimal.hpp:392
void expand(int16_t position)
Definition ICU4XFixedDecimal.hpp:437
static ICU4XFixedDecimal create_from_i64(int64_t v)
Definition ICU4XFixedDecimal.hpp:324
static diplomat::result< ICU4XFixedDecimal, ICU4XError > create_from_f64_with_lower_magnitude(double f, int16_t magnitude)
Definition ICU4XFixedDecimal.hpp:340
void apply_sign_display(ICU4XFixedDecimalSignDisplay sign_display)
Definition ICU4XFixedDecimal.hpp:407
void half_ceil(int16_t position)
Definition ICU4XFixedDecimal.hpp:455
static diplomat::result< ICU4XFixedDecimal, ICU4XError > create_from_string(const std::string_view v)
Definition ICU4XFixedDecimal.hpp:370
void half_floor(int16_t position)
Definition ICU4XFixedDecimal.hpp:467
static diplomat::result< ICU4XFixedDecimal, ICU4XError > create_from_f64_with_significant_digits(double f, uint8_t digits)
Definition ICU4XFixedDecimal.hpp:350
static diplomat::result< ICU4XFixedDecimal, ICU4XError > create_from_f64_with_floating_precision(double f)
Definition ICU4XFixedDecimal.hpp:360
void half_even(int16_t position)
Definition ICU4XFixedDecimal.hpp:473
void half_ceil_to_increment(int16_t position, ICU4XRoundingIncrement increment)
Definition ICU4XFixedDecimal.hpp:458
int16_t nonzero_magnitude_start() const
Definition ICU4XFixedDecimal.hpp:389
void half_expand(int16_t position)
Definition ICU4XFixedDecimal.hpp:443
static diplomat::result< ICU4XFixedDecimal, ICU4XError > create_from_f64_with_integer_precision(double f)
Definition ICU4XFixedDecimal.hpp:330
uint8_t digit_at(int16_t magnitude) const
Definition ICU4XFixedDecimal.hpp:380
Definition diplomat_runtime.hpp:84
capi::DiplomatWriteable WriteableFromString(std::string &string)
Definition diplomat_runtime.hpp:31
Definition diplomat_runtime.hpp:69
Definition diplomat_runtime.hpp:55