Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_ENUM
pub type CFNumberFormatterKey = CFString;
#[doc(alias = "CFNumberFormatterRef")]
#[repr(C)]
pub struct CFNumberFormatter {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CFNumberFormatter {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CFNumberFormatter"> for CFNumberFormatter {}
);
unsafe impl ConcreteType for CFNumberFormatter {
#[doc(alias = "CFNumberFormatterGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CFNumberFormatterGetTypeID() -> CFTypeID;
}
unsafe { CFNumberFormatterGetTypeID() }
}
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFNumberFormatterStyle(pub CFIndex);
impl CFNumberFormatterStyle {
#[doc(alias = "kCFNumberFormatterNoStyle")]
pub const NoStyle: Self = Self(0);
#[doc(alias = "kCFNumberFormatterDecimalStyle")]
pub const DecimalStyle: Self = Self(1);
#[doc(alias = "kCFNumberFormatterCurrencyStyle")]
pub const CurrencyStyle: Self = Self(2);
#[doc(alias = "kCFNumberFormatterPercentStyle")]
pub const PercentStyle: Self = Self(3);
#[doc(alias = "kCFNumberFormatterScientificStyle")]
pub const ScientificStyle: Self = Self(4);
#[doc(alias = "kCFNumberFormatterSpellOutStyle")]
pub const SpellOutStyle: Self = Self(5);
#[doc(alias = "kCFNumberFormatterOrdinalStyle")]
pub const OrdinalStyle: Self = Self(6);
#[doc(alias = "kCFNumberFormatterCurrencyISOCodeStyle")]
pub const CurrencyISOCodeStyle: Self = Self(8);
#[doc(alias = "kCFNumberFormatterCurrencyPluralStyle")]
pub const CurrencyPluralStyle: Self = Self(9);
#[doc(alias = "kCFNumberFormatterCurrencyAccountingStyle")]
pub const CurrencyAccountingStyle: Self = Self(10);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CFNumberFormatterStyle {
const ENCODING: Encoding = CFIndex::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFNumberFormatterStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl CFNumberFormatter {
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `locale` might not allow `None`.
#[doc(alias = "CFNumberFormatterCreate")]
#[cfg(feature = "CFLocale")]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
locale: Option<&CFLocale>,
style: CFNumberFormatterStyle,
) -> Option<CFRetained<CFNumberFormatter>> {
extern "C-unwind" {
fn CFNumberFormatterCreate(
allocator: Option<&CFAllocator>,
locale: Option<&CFLocale>,
style: CFNumberFormatterStyle,
) -> Option<NonNull<CFNumberFormatter>>;
}
let ret = unsafe { CFNumberFormatterCreate(allocator, locale, style) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CFNumberFormatterGetLocale")]
#[cfg(feature = "CFLocale")]
#[inline]
pub fn locale(&self) -> Option<CFRetained<CFLocale>> {
extern "C-unwind" {
fn CFNumberFormatterGetLocale(
formatter: &CFNumberFormatter,
) -> Option<NonNull<CFLocale>>;
}
let ret = unsafe { CFNumberFormatterGetLocale(self) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[doc(alias = "CFNumberFormatterGetStyle")]
#[inline]
pub fn style(&self) -> CFNumberFormatterStyle {
extern "C-unwind" {
fn CFNumberFormatterGetStyle(formatter: &CFNumberFormatter) -> CFNumberFormatterStyle;
}
unsafe { CFNumberFormatterGetStyle(self) }
}
#[doc(alias = "CFNumberFormatterGetFormat")]
#[inline]
pub fn format(&self) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterGetFormat(
formatter: &CFNumberFormatter,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CFNumberFormatterGetFormat(self) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
/// # Safety
///
/// `format_string` might not allow `None`.
#[doc(alias = "CFNumberFormatterSetFormat")]
#[inline]
pub unsafe fn set_format(&self, format_string: Option<&CFString>) {
extern "C-unwind" {
fn CFNumberFormatterSetFormat(
formatter: &CFNumberFormatter,
format_string: Option<&CFString>,
);
}
unsafe { CFNumberFormatterSetFormat(self, format_string) }
}
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `formatter` might not allow `None`.
/// - `number` might not allow `None`.
#[doc(alias = "CFNumberFormatterCreateStringWithNumber")]
#[cfg(feature = "CFNumber")]
#[inline]
pub unsafe fn new_string_with_number(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number: Option<&CFNumber>,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterCreateStringWithNumber(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number: Option<&CFNumber>,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CFNumberFormatterCreateStringWithNumber(allocator, formatter, number) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `formatter` might not allow `None`.
/// - `value_ptr` must be a valid pointer.
#[doc(alias = "CFNumberFormatterCreateStringWithValue")]
#[cfg(feature = "CFNumber")]
#[inline]
pub unsafe fn new_string_with_value(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number_type: CFNumberType,
value_ptr: *const c_void,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterCreateStringWithValue(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number_type: CFNumberType,
value_ptr: *const c_void,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe {
CFNumberFormatterCreateStringWithValue(allocator, formatter, number_type, value_ptr)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFNumberFormatterOptionFlags(pub CFOptionFlags);
bitflags::bitflags! {
impl CFNumberFormatterOptionFlags: CFOptionFlags {
#[doc(alias = "kCFNumberFormatterParseIntegersOnly")]
const ParseIntegersOnly = 1;
}
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CFNumberFormatterOptionFlags {
const ENCODING: Encoding = CFOptionFlags::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFNumberFormatterOptionFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl CFNumberFormatter {
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `formatter` might not allow `None`.
/// - `string` might not allow `None`.
/// - `rangep` must be a valid pointer.
#[doc(alias = "CFNumberFormatterCreateNumberFromString")]
#[cfg(feature = "CFNumber")]
#[inline]
pub unsafe fn new_number_from_string(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
string: Option<&CFString>,
rangep: *mut CFRange,
options: CFOptionFlags,
) -> Option<CFRetained<CFNumber>> {
extern "C-unwind" {
fn CFNumberFormatterCreateNumberFromString(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
string: Option<&CFString>,
rangep: *mut CFRange,
options: CFOptionFlags,
) -> Option<NonNull<CFNumber>>;
}
let ret = unsafe {
CFNumberFormatterCreateNumberFromString(allocator, formatter, string, rangep, options)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
/// # Safety
///
/// - `string` might not allow `None`.
/// - `rangep` must be a valid pointer.
/// - `value_ptr` must be a valid pointer.
#[doc(alias = "CFNumberFormatterGetValueFromString")]
#[cfg(feature = "CFNumber")]
#[inline]
pub unsafe fn value_from_string(
&self,
string: Option<&CFString>,
rangep: *mut CFRange,
number_type: CFNumberType,
value_ptr: *mut c_void,
) -> bool {
extern "C-unwind" {
fn CFNumberFormatterGetValueFromString(
formatter: &CFNumberFormatter,
string: Option<&CFString>,
rangep: *mut CFRange,
number_type: CFNumberType,
value_ptr: *mut c_void,
) -> Boolean;
}
let ret = unsafe {
CFNumberFormatterGetValueFromString(self, string, rangep, number_type, value_ptr)
};
ret != 0
}
/// # Safety
///
/// - `key` might not allow `None`.
/// - `value` should be of the correct type.
/// - `value` might not allow `None`.
#[doc(alias = "CFNumberFormatterSetProperty")]
#[inline]
pub unsafe fn set_property(&self, key: Option<&CFNumberFormatterKey>, value: Option<&CFType>) {
extern "C-unwind" {
fn CFNumberFormatterSetProperty(
formatter: &CFNumberFormatter,
key: Option<&CFNumberFormatterKey>,
value: Option<&CFType>,
);
}
unsafe { CFNumberFormatterSetProperty(self, key, value) }
}
/// # Safety
///
/// `key` might not allow `None`.
#[doc(alias = "CFNumberFormatterCopyProperty")]
#[inline]
pub unsafe fn property(
&self,
key: Option<&CFNumberFormatterKey>,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn CFNumberFormatterCopyProperty(
formatter: &CFNumberFormatter,
key: Option<&CFNumberFormatterKey>,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { CFNumberFormatterCopyProperty(self, key) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
extern "C" {
pub static kCFNumberFormatterCurrencyCode: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterDecimalSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterCurrencyDecimalSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterAlwaysShowDecimalSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterGroupingSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterUseGroupingSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPercentSymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterZeroSymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterNaNSymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterInfinitySymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMinusSign: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPlusSign: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterCurrencySymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterExponentSymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMinIntegerDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMaxIntegerDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMinFractionDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMaxFractionDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterGroupingSize: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterSecondaryGroupingSize: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterRoundingMode: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterRoundingIncrement: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterFormatWidth: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPaddingPosition: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPaddingCharacter: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterDefaultFormat: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMultiplier: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPositivePrefix: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPositiveSuffix: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterNegativePrefix: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterNegativeSuffix: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterPerMillSymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterInternationalCurrencySymbol: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterCurrencyGroupingSeparator: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterIsLenient: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterUseSignificantDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMinSignificantDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMaxSignificantDigits: Option<&'static CFNumberFormatterKey>;
}
extern "C" {
pub static kCFNumberFormatterMinGroupingDigits: Option<&'static CFNumberFormatterKey>;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFNumberFormatterRoundingMode(pub CFIndex);
impl CFNumberFormatterRoundingMode {
#[doc(alias = "kCFNumberFormatterRoundCeiling")]
pub const RoundCeiling: Self = Self(0);
#[doc(alias = "kCFNumberFormatterRoundFloor")]
pub const RoundFloor: Self = Self(1);
#[doc(alias = "kCFNumberFormatterRoundDown")]
pub const RoundDown: Self = Self(2);
#[doc(alias = "kCFNumberFormatterRoundUp")]
pub const RoundUp: Self = Self(3);
#[doc(alias = "kCFNumberFormatterRoundHalfEven")]
pub const RoundHalfEven: Self = Self(4);
#[doc(alias = "kCFNumberFormatterRoundHalfDown")]
pub const RoundHalfDown: Self = Self(5);
#[doc(alias = "kCFNumberFormatterRoundHalfUp")]
pub const RoundHalfUp: Self = Self(6);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CFNumberFormatterRoundingMode {
const ENCODING: Encoding = CFIndex::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFNumberFormatterRoundingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFNumberFormatterPadPosition(pub CFIndex);
impl CFNumberFormatterPadPosition {
#[doc(alias = "kCFNumberFormatterPadBeforePrefix")]
pub const BeforePrefix: Self = Self(0);
#[doc(alias = "kCFNumberFormatterPadAfterPrefix")]
pub const AfterPrefix: Self = Self(1);
#[doc(alias = "kCFNumberFormatterPadBeforeSuffix")]
pub const BeforeSuffix: Self = Self(2);
#[doc(alias = "kCFNumberFormatterPadAfterSuffix")]
pub const AfterSuffix: Self = Self(3);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CFNumberFormatterPadPosition {
const ENCODING: Encoding = CFIndex::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CFNumberFormatterPadPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl CFNumberFormatter {
/// # Safety
///
/// - `currency_code` might not allow `None`.
/// - `default_fraction_digits` must be a valid pointer.
/// - `rounding_increment` must be a valid pointer.
#[doc(alias = "CFNumberFormatterGetDecimalInfoForCurrencyCode")]
#[inline]
pub unsafe fn decimal_info_for_currency_code(
currency_code: Option<&CFString>,
default_fraction_digits: *mut i32,
rounding_increment: *mut c_double,
) -> bool {
extern "C-unwind" {
fn CFNumberFormatterGetDecimalInfoForCurrencyCode(
currency_code: Option<&CFString>,
default_fraction_digits: *mut i32,
rounding_increment: *mut c_double,
) -> Boolean;
}
let ret = unsafe {
CFNumberFormatterGetDecimalInfoForCurrencyCode(
currency_code,
default_fraction_digits,
rounding_increment,
)
};
ret != 0
}
}
#[cfg(feature = "CFLocale")]
#[deprecated = "renamed to `CFNumberFormatter::new`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterCreate(
allocator: Option<&CFAllocator>,
locale: Option<&CFLocale>,
style: CFNumberFormatterStyle,
) -> Option<CFRetained<CFNumberFormatter>> {
extern "C-unwind" {
fn CFNumberFormatterCreate(
allocator: Option<&CFAllocator>,
locale: Option<&CFLocale>,
style: CFNumberFormatterStyle,
) -> Option<NonNull<CFNumberFormatter>>;
}
let ret = unsafe { CFNumberFormatterCreate(allocator, locale, style) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "CFLocale")]
#[deprecated = "renamed to `CFNumberFormatter::locale`"]
#[inline]
pub extern "C-unwind" fn CFNumberFormatterGetLocale(
formatter: &CFNumberFormatter,
) -> Option<CFRetained<CFLocale>> {
extern "C-unwind" {
fn CFNumberFormatterGetLocale(formatter: &CFNumberFormatter) -> Option<NonNull<CFLocale>>;
}
let ret = unsafe { CFNumberFormatterGetLocale(formatter) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[deprecated = "renamed to `CFNumberFormatter::style`"]
#[inline]
pub extern "C-unwind" fn CFNumberFormatterGetStyle(
formatter: &CFNumberFormatter,
) -> CFNumberFormatterStyle {
extern "C-unwind" {
fn CFNumberFormatterGetStyle(formatter: &CFNumberFormatter) -> CFNumberFormatterStyle;
}
unsafe { CFNumberFormatterGetStyle(formatter) }
}
#[deprecated = "renamed to `CFNumberFormatter::format`"]
#[inline]
pub extern "C-unwind" fn CFNumberFormatterGetFormat(
formatter: &CFNumberFormatter,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterGetFormat(formatter: &CFNumberFormatter) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CFNumberFormatterGetFormat(formatter) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `CFNumberFormatter::set_format`"]
pub fn CFNumberFormatterSetFormat(
formatter: &CFNumberFormatter,
format_string: Option<&CFString>,
);
}
#[cfg(feature = "CFNumber")]
#[deprecated = "renamed to `CFNumberFormatter::new_string_with_number`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterCreateStringWithNumber(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number: Option<&CFNumber>,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterCreateStringWithNumber(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number: Option<&CFNumber>,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CFNumberFormatterCreateStringWithNumber(allocator, formatter, number) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "CFNumber")]
#[deprecated = "renamed to `CFNumberFormatter::new_string_with_value`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterCreateStringWithValue(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number_type: CFNumberType,
value_ptr: *const c_void,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CFNumberFormatterCreateStringWithValue(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
number_type: CFNumberType,
value_ptr: *const c_void,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe {
CFNumberFormatterCreateStringWithValue(allocator, formatter, number_type, value_ptr)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "CFNumber")]
#[deprecated = "renamed to `CFNumberFormatter::new_number_from_string`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterCreateNumberFromString(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
string: Option<&CFString>,
rangep: *mut CFRange,
options: CFOptionFlags,
) -> Option<CFRetained<CFNumber>> {
extern "C-unwind" {
fn CFNumberFormatterCreateNumberFromString(
allocator: Option<&CFAllocator>,
formatter: Option<&CFNumberFormatter>,
string: Option<&CFString>,
rangep: *mut CFRange,
options: CFOptionFlags,
) -> Option<NonNull<CFNumber>>;
}
let ret = unsafe {
CFNumberFormatterCreateNumberFromString(allocator, formatter, string, rangep, options)
};
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "CFNumber")]
#[deprecated = "renamed to `CFNumberFormatter::value_from_string`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterGetValueFromString(
formatter: &CFNumberFormatter,
string: Option<&CFString>,
rangep: *mut CFRange,
number_type: CFNumberType,
value_ptr: *mut c_void,
) -> bool {
extern "C-unwind" {
fn CFNumberFormatterGetValueFromString(
formatter: &CFNumberFormatter,
string: Option<&CFString>,
rangep: *mut CFRange,
number_type: CFNumberType,
value_ptr: *mut c_void,
) -> Boolean;
}
let ret = unsafe {
CFNumberFormatterGetValueFromString(formatter, string, rangep, number_type, value_ptr)
};
ret != 0
}
extern "C-unwind" {
#[deprecated = "renamed to `CFNumberFormatter::set_property`"]
pub fn CFNumberFormatterSetProperty(
formatter: &CFNumberFormatter,
key: Option<&CFNumberFormatterKey>,
value: Option<&CFType>,
);
}
#[deprecated = "renamed to `CFNumberFormatter::property`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterCopyProperty(
formatter: &CFNumberFormatter,
key: Option<&CFNumberFormatterKey>,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn CFNumberFormatterCopyProperty(
formatter: &CFNumberFormatter,
key: Option<&CFNumberFormatterKey>,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { CFNumberFormatterCopyProperty(formatter, key) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `CFNumberFormatter::decimal_info_for_currency_code`"]
#[inline]
pub unsafe extern "C-unwind" fn CFNumberFormatterGetDecimalInfoForCurrencyCode(
currency_code: Option<&CFString>,
default_fraction_digits: *mut i32,
rounding_increment: *mut c_double,
) -> bool {
extern "C-unwind" {
fn CFNumberFormatterGetDecimalInfoForCurrencyCode(
currency_code: Option<&CFString>,
default_fraction_digits: *mut i32,
rounding_increment: *mut c_double,
) -> Boolean;
}
let ret = unsafe {
CFNumberFormatterGetDecimalInfoForCurrencyCode(
currency_code,
default_fraction_digits,
rounding_increment,
)
};
ret != 0
}