icrate/generated/Foundation/
NSLengthFormatter.rs1use crate::common::*;
4use crate::Foundation::*;
5
6ns_enum!(
7 #[underlying(NSInteger)]
8 pub enum NSLengthFormatterUnit {
9 NSLengthFormatterUnitMillimeter = 8,
10 NSLengthFormatterUnitCentimeter = 9,
11 NSLengthFormatterUnitMeter = 11,
12 NSLengthFormatterUnitKilometer = 14,
13 NSLengthFormatterUnitInch = (5 << 8) + 1,
14 NSLengthFormatterUnitFoot = (5 << 8) + 2,
15 NSLengthFormatterUnitYard = (5 << 8) + 3,
16 NSLengthFormatterUnitMile = (5 << 8) + 4,
17 }
18);
19
20extern_class!(
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 #[cfg(feature = "Foundation_NSLengthFormatter")]
23 pub struct NSLengthFormatter;
24
25 #[cfg(feature = "Foundation_NSLengthFormatter")]
26 unsafe impl ClassType for NSLengthFormatter {
27 #[inherits(NSObject)]
28 type Super = NSFormatter;
29 type Mutability = InteriorMutable;
30 }
31);
32
33#[cfg(feature = "Foundation_NSLengthFormatter")]
34unsafe impl NSCoding for NSLengthFormatter {}
35
36#[cfg(feature = "Foundation_NSLengthFormatter")]
37unsafe impl NSCopying for NSLengthFormatter {}
38
39#[cfg(feature = "Foundation_NSLengthFormatter")]
40unsafe impl NSObjectProtocol for NSLengthFormatter {}
41
42extern_methods!(
43 #[cfg(feature = "Foundation_NSLengthFormatter")]
44 unsafe impl NSLengthFormatter {
45 #[cfg(feature = "Foundation_NSNumberFormatter")]
46 #[method_id(@__retain_semantics Other numberFormatter)]
47 pub unsafe fn numberFormatter(&self) -> Id<NSNumberFormatter>;
48
49 #[cfg(feature = "Foundation_NSNumberFormatter")]
50 #[method(setNumberFormatter:)]
51 pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
52
53 #[method(unitStyle)]
54 pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
55
56 #[method(setUnitStyle:)]
57 pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
58
59 #[method(isForPersonHeightUse)]
60 pub unsafe fn isForPersonHeightUse(&self) -> bool;
61
62 #[method(setForPersonHeightUse:)]
63 pub unsafe fn setForPersonHeightUse(&self, for_person_height_use: bool);
64
65 #[cfg(feature = "Foundation_NSString")]
66 #[method_id(@__retain_semantics Other stringFromValue:unit:)]
67 pub unsafe fn stringFromValue_unit(
68 &self,
69 value: c_double,
70 unit: NSLengthFormatterUnit,
71 ) -> Id<NSString>;
72
73 #[cfg(feature = "Foundation_NSString")]
74 #[method_id(@__retain_semantics Other stringFromMeters:)]
75 pub unsafe fn stringFromMeters(&self, number_in_meters: c_double) -> Id<NSString>;
76
77 #[cfg(feature = "Foundation_NSString")]
78 #[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
79 pub unsafe fn unitStringFromValue_unit(
80 &self,
81 value: c_double,
82 unit: NSLengthFormatterUnit,
83 ) -> Id<NSString>;
84
85 #[cfg(feature = "Foundation_NSString")]
86 #[method_id(@__retain_semantics Other unitStringFromMeters:usedUnit:)]
87 pub unsafe fn unitStringFromMeters_usedUnit(
88 &self,
89 number_in_meters: c_double,
90 unitp: *mut NSLengthFormatterUnit,
91 ) -> Id<NSString>;
92
93 #[cfg(feature = "Foundation_NSString")]
94 #[method(getObjectValue:forString:errorDescription:)]
95 pub unsafe fn getObjectValue_forString_errorDescription(
96 &self,
97 obj: Option<&mut Option<Id<AnyObject>>>,
98 string: &NSString,
99 error: Option<&mut Option<Id<NSString>>>,
100 ) -> bool;
101 }
102);
103
104extern_methods!(
105 #[cfg(feature = "Foundation_NSLengthFormatter")]
107 unsafe impl NSLengthFormatter {
108 #[method_id(@__retain_semantics Init init)]
109 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
110
111 #[method_id(@__retain_semantics New new)]
112 pub unsafe fn new() -> Id<Self>;
113 }
114);