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"))]
50extern_conformance!(
51 unsafe impl NSCoding for NSLengthFormatter {}
52);
53
54#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
55extern_conformance!(
56 unsafe impl NSCopying for NSLengthFormatter {}
57);
58
59#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
60unsafe impl CopyingHelper for NSLengthFormatter {
61 type Result = Self;
62}
63
64#[cfg(feature = "NSFormatter")]
65extern_conformance!(
66 unsafe impl NSObjectProtocol for NSLengthFormatter {}
67);
68
69#[cfg(feature = "NSFormatter")]
70impl NSLengthFormatter {
71 extern_methods!(
72 #[cfg(feature = "NSNumberFormatter")]
73 #[unsafe(method(numberFormatter))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
76
77 #[cfg(feature = "NSNumberFormatter")]
78 #[unsafe(method(setNumberFormatter:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
82
83 #[unsafe(method(unitStyle))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
86
87 #[unsafe(method(setUnitStyle:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
91
92 #[unsafe(method(isForPersonHeightUse))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn isForPersonHeightUse(&self) -> bool;
95
96 #[unsafe(method(setForPersonHeightUse:))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn setForPersonHeightUse(&self, for_person_height_use: bool);
100
101 #[cfg(feature = "NSString")]
102 #[unsafe(method(stringFromValue:unit:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn stringFromValue_unit(
105 &self,
106 value: c_double,
107 unit: NSLengthFormatterUnit,
108 ) -> Retained<NSString>;
109
110 #[cfg(feature = "NSString")]
111 #[unsafe(method(stringFromMeters:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn stringFromMeters(&self, number_in_meters: c_double) -> Retained<NSString>;
114
115 #[cfg(feature = "NSString")]
116 #[unsafe(method(unitStringFromValue:unit:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn unitStringFromValue_unit(
119 &self,
120 value: c_double,
121 unit: NSLengthFormatterUnit,
122 ) -> Retained<NSString>;
123
124 #[cfg(feature = "NSString")]
125 #[unsafe(method(unitStringFromMeters:usedUnit:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn unitStringFromMeters_usedUnit(
128 &self,
129 number_in_meters: c_double,
130 unitp: *mut NSLengthFormatterUnit,
131 ) -> Retained<NSString>;
132
133 #[cfg(feature = "NSString")]
134 #[unsafe(method(getObjectValue:forString:errorDescription:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn getObjectValue_forString_errorDescription(
137 &self,
138 obj: Option<&mut Option<Retained<AnyObject>>>,
139 string: &NSString,
140 error: Option<&mut Option<Retained<NSString>>>,
141 ) -> bool;
142 );
143}
144
145#[cfg(feature = "NSFormatter")]
147impl NSLengthFormatter {
148 extern_methods!(
149 #[unsafe(method(init))]
150 #[unsafe(method_family = init)]
151 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153 #[unsafe(method(new))]
154 #[unsafe(method_family = new)]
155 pub unsafe fn new() -> Retained<Self>;
156 );
157}