objc2_foundation/generated/
NSLengthFormatter.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSLengthFormatterUnit(pub NSInteger);
14impl NSLengthFormatterUnit {
15 #[doc(alias = "NSLengthFormatterUnitMillimeter")]
16 pub const Millimeter: Self = Self(8);
17 #[doc(alias = "NSLengthFormatterUnitCentimeter")]
18 pub const Centimeter: Self = Self(9);
19 #[doc(alias = "NSLengthFormatterUnitMeter")]
20 pub const Meter: Self = Self(11);
21 #[doc(alias = "NSLengthFormatterUnitKilometer")]
22 pub const Kilometer: Self = Self(14);
23 #[doc(alias = "NSLengthFormatterUnitInch")]
24 pub const Inch: Self = Self((5 << 8) + 1);
25 #[doc(alias = "NSLengthFormatterUnitFoot")]
26 pub const Foot: Self = Self((5 << 8) + 2);
27 #[doc(alias = "NSLengthFormatterUnitYard")]
28 pub const Yard: Self = Self((5 << 8) + 3);
29 #[doc(alias = "NSLengthFormatterUnitMile")]
30 pub const Mile: Self = Self((5 << 8) + 4);
31}
32
33unsafe impl Encode for NSLengthFormatterUnit {
34 const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for NSLengthFormatterUnit {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_class!(
42 #[unsafe(super(NSFormatter, NSObject))]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 #[cfg(feature = "NSFormatter")]
46 pub struct NSLengthFormatter;
47);
48
49#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
50unsafe impl NSCoding for NSLengthFormatter {}
51
52#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
53unsafe impl NSCopying for NSLengthFormatter {}
54
55#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
56unsafe impl CopyingHelper for NSLengthFormatter {
57 type Result = Self;
58}
59
60#[cfg(feature = "NSFormatter")]
61unsafe impl NSObjectProtocol for NSLengthFormatter {}
62
63#[cfg(feature = "NSFormatter")]
64impl NSLengthFormatter {
65 extern_methods!(
66 #[cfg(feature = "NSNumberFormatter")]
67 #[unsafe(method(numberFormatter))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
70
71 #[cfg(feature = "NSNumberFormatter")]
72 #[unsafe(method(setNumberFormatter:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
76
77 #[unsafe(method(unitStyle))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
80
81 #[unsafe(method(setUnitStyle:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
85
86 #[unsafe(method(isForPersonHeightUse))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn isForPersonHeightUse(&self) -> bool;
89
90 #[unsafe(method(setForPersonHeightUse:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn setForPersonHeightUse(&self, for_person_height_use: bool);
94
95 #[cfg(feature = "NSString")]
96 #[unsafe(method(stringFromValue:unit:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn stringFromValue_unit(
99 &self,
100 value: c_double,
101 unit: NSLengthFormatterUnit,
102 ) -> Retained<NSString>;
103
104 #[cfg(feature = "NSString")]
105 #[unsafe(method(stringFromMeters:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn stringFromMeters(&self, number_in_meters: c_double) -> Retained<NSString>;
108
109 #[cfg(feature = "NSString")]
110 #[unsafe(method(unitStringFromValue:unit:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn unitStringFromValue_unit(
113 &self,
114 value: c_double,
115 unit: NSLengthFormatterUnit,
116 ) -> Retained<NSString>;
117
118 #[cfg(feature = "NSString")]
119 #[unsafe(method(unitStringFromMeters:usedUnit:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn unitStringFromMeters_usedUnit(
122 &self,
123 number_in_meters: c_double,
124 unitp: *mut NSLengthFormatterUnit,
125 ) -> Retained<NSString>;
126
127 #[cfg(feature = "NSString")]
128 #[unsafe(method(getObjectValue:forString:errorDescription:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn getObjectValue_forString_errorDescription(
131 &self,
132 obj: Option<&mut Option<Retained<AnyObject>>>,
133 string: &NSString,
134 error: Option<&mut Option<Retained<NSString>>>,
135 ) -> bool;
136 );
137}
138
139#[cfg(feature = "NSFormatter")]
141impl NSLengthFormatter {
142 extern_methods!(
143 #[unsafe(method(init))]
144 #[unsafe(method_family = init)]
145 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146
147 #[unsafe(method(new))]
148 #[unsafe(method_family = new)]
149 pub unsafe fn new() -> Retained<Self>;
150 );
151}