//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ffi::*; use core::ptr::NonNull; use objc2::__framework_prelude::*; use crate::*; /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nslengthformatterunit?language=objc) // NS_ENUM #[repr(transparent)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct NSLengthFormatterUnit(pub NSInteger); impl NSLengthFormatterUnit { #[doc(alias = "NSLengthFormatterUnitMillimeter")] pub const Millimeter: Self = Self(8); #[doc(alias = "NSLengthFormatterUnitCentimeter")] pub const Centimeter: Self = Self(9); #[doc(alias = "NSLengthFormatterUnitMeter")] pub const Meter: Self = Self(11); #[doc(alias = "NSLengthFormatterUnitKilometer")] pub const Kilometer: Self = Self(14); #[doc(alias = "NSLengthFormatterUnitInch")] pub const Inch: Self = Self((5 << 8) + 1); #[doc(alias = "NSLengthFormatterUnitFoot")] pub const Foot: Self = Self((5 << 8) + 2); #[doc(alias = "NSLengthFormatterUnitYard")] pub const Yard: Self = Self((5 << 8) + 3); #[doc(alias = "NSLengthFormatterUnitMile")] pub const Mile: Self = Self((5 << 8) + 4); } unsafe impl Encode for NSLengthFormatterUnit { const ENCODING: Encoding = NSInteger::ENCODING; } unsafe impl RefEncode for NSLengthFormatterUnit { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } extern_class!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nslengthformatter?language=objc) #[unsafe(super(NSFormatter, NSObject))] #[derive(Debug, PartialEq, Eq, Hash)] #[cfg(feature = "NSFormatter")] pub struct NSLengthFormatter; ); #[cfg(all(feature = "NSFormatter", feature = "NSObject"))] extern_conformance!( unsafe impl NSCoding for NSLengthFormatter {} ); #[cfg(all(feature = "NSFormatter", feature = "NSObject"))] extern_conformance!( unsafe impl NSCopying for NSLengthFormatter {} ); #[cfg(all(feature = "NSFormatter", feature = "NSObject"))] unsafe impl CopyingHelper for NSLengthFormatter { type Result = Self; } #[cfg(feature = "NSFormatter")] extern_conformance!( unsafe impl NSObjectProtocol for NSLengthFormatter {} ); #[cfg(feature = "NSFormatter")] impl NSLengthFormatter { extern_methods!( #[cfg(feature = "NSNumberFormatter")] #[unsafe(method(numberFormatter))] #[unsafe(method_family = none)] pub fn numberFormatter(&self) -> Retained; #[cfg(feature = "NSNumberFormatter")] /// Setter for [`numberFormatter`][Self::numberFormatter]. /// /// This is [copied][crate::NSCopying::copy] when set. #[unsafe(method(setNumberFormatter:))] #[unsafe(method_family = none)] pub fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>); #[unsafe(method(unitStyle))] #[unsafe(method_family = none)] pub fn unitStyle(&self) -> NSFormattingUnitStyle; /// Setter for [`unitStyle`][Self::unitStyle]. #[unsafe(method(setUnitStyle:))] #[unsafe(method_family = none)] pub fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle); #[unsafe(method(isForPersonHeightUse))] #[unsafe(method_family = none)] pub fn isForPersonHeightUse(&self) -> bool; /// Setter for [`isForPersonHeightUse`][Self::isForPersonHeightUse]. #[unsafe(method(setForPersonHeightUse:))] #[unsafe(method_family = none)] pub fn setForPersonHeightUse(&self, for_person_height_use: bool); #[cfg(feature = "NSString")] #[unsafe(method(stringFromValue:unit:))] #[unsafe(method_family = none)] pub fn stringFromValue_unit( &self, value: c_double, unit: NSLengthFormatterUnit, ) -> Retained; #[cfg(feature = "NSString")] #[unsafe(method(stringFromMeters:))] #[unsafe(method_family = none)] pub fn stringFromMeters(&self, number_in_meters: c_double) -> Retained; #[cfg(feature = "NSString")] #[unsafe(method(unitStringFromValue:unit:))] #[unsafe(method_family = none)] pub fn unitStringFromValue_unit( &self, value: c_double, unit: NSLengthFormatterUnit, ) -> Retained; #[cfg(feature = "NSString")] /// # Safety /// /// `unitp` must be a valid pointer or null. #[unsafe(method(unitStringFromMeters:usedUnit:))] #[unsafe(method_family = none)] pub unsafe fn unitStringFromMeters_usedUnit( &self, number_in_meters: c_double, unitp: *mut NSLengthFormatterUnit, ) -> Retained; #[cfg(feature = "NSString")] /// # Safety /// /// `obj` should be of the correct type. #[unsafe(method(getObjectValue:forString:errorDescription:))] #[unsafe(method_family = none)] pub unsafe fn getObjectValue_forString_errorDescription( &self, obj: Option<&mut Option>>, string: &NSString, error: Option<&mut Option>>, ) -> bool; ); } /// Methods declared on superclass `NSObject`. #[cfg(feature = "NSFormatter")] impl NSLengthFormatter { extern_methods!( #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } #[cfg(feature = "NSFormatter")] impl DefaultRetained for NSLengthFormatter { #[inline] fn default_retained() -> Retained { Self::new() } }