UnitsConverter.d.hpp (2383B)
1 #ifndef icu4x_UnitsConverter_D_HPP 2 #define icu4x_UnitsConverter_D_HPP 3 4 #include <stdio.h> 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <stdbool.h> 8 #include <memory> 9 #include <functional> 10 #include <optional> 11 #include <cstdlib> 12 #include "../diplomat_runtime.hpp" 13 14 namespace icu4x { 15 namespace capi { struct UnitsConverter; } 16 class UnitsConverter; 17 } 18 19 20 namespace icu4x { 21 namespace capi { 22 struct UnitsConverter; 23 } // namespace capi 24 } // namespace 25 26 namespace icu4x { 27 /** 28 * An ICU4X Units Converter object, capable of converting between two [`MeasureUnit`]s. 29 * 30 * You can create an instance of this object using [`UnitsConverterFactory`] by calling the `converter` method. 31 * 32 * See the [Rust documentation for `UnitsConverter`](https://docs.rs/icu/latest/icu/experimental/units/converter/struct.UnitsConverter.html) for more information. 33 */ 34 class UnitsConverter { 35 public: 36 37 /** 38 * Converts the input value from the input unit to the output unit (that have been used to create this converter). 39 * NOTE: 40 * The conversion using floating-point operations is not as accurate as the conversion using ratios. 41 * 42 * See the [Rust documentation for `convert`](https://docs.rs/icu/latest/icu/experimental/units/converter/struct.UnitsConverter.html#method.convert) for more information. 43 */ 44 inline double convert(double value) const; 45 46 /** 47 * Clones the current [`UnitsConverter`] object. 48 * 49 * See the [Rust documentation for `clone`](https://docs.rs/icu/latest/icu/experimental/units/converter/struct.UnitsConverter.html#method.clone) for more information. 50 */ 51 inline std::unique_ptr<icu4x::UnitsConverter> clone() const; 52 53 inline const icu4x::capi::UnitsConverter* AsFFI() const; 54 inline icu4x::capi::UnitsConverter* AsFFI(); 55 inline static const icu4x::UnitsConverter* FromFFI(const icu4x::capi::UnitsConverter* ptr); 56 inline static icu4x::UnitsConverter* FromFFI(icu4x::capi::UnitsConverter* ptr); 57 inline static void operator delete(void* ptr); 58 private: 59 UnitsConverter() = delete; 60 UnitsConverter(const icu4x::UnitsConverter&) = delete; 61 UnitsConverter(icu4x::UnitsConverter&&) noexcept = delete; 62 UnitsConverter operator=(const icu4x::UnitsConverter&) = delete; 63 UnitsConverter operator=(icu4x::UnitsConverter&&) noexcept = delete; 64 static void operator delete[](void*, size_t) = delete; 65 }; 66 67 } // namespace 68 #endif // icu4x_UnitsConverter_D_HPP