objc2_foundation/generated/
NSMassFormatter.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 NSMassFormatterUnit(pub NSInteger);
14impl NSMassFormatterUnit {
15 #[doc(alias = "NSMassFormatterUnitGram")]
16 pub const Gram: Self = Self(11);
17 #[doc(alias = "NSMassFormatterUnitKilogram")]
18 pub const Kilogram: Self = Self(14);
19 #[doc(alias = "NSMassFormatterUnitOunce")]
20 pub const Ounce: Self = Self((6 << 8) + 1);
21 #[doc(alias = "NSMassFormatterUnitPound")]
22 pub const Pound: Self = Self((6 << 8) + 2);
23 #[doc(alias = "NSMassFormatterUnitStone")]
24 pub const Stone: Self = Self((6 << 8) + 3);
25}
26
27unsafe impl Encode for NSMassFormatterUnit {
28 const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSMassFormatterUnit {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(NSFormatter, NSObject))]
38 #[derive(Debug, PartialEq, Eq, Hash)]
39 #[cfg(feature = "NSFormatter")]
40 pub struct NSMassFormatter;
41);
42
43#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
44extern_conformance!(
45 unsafe impl NSCoding for NSMassFormatter {}
46);
47
48#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
49extern_conformance!(
50 unsafe impl NSCopying for NSMassFormatter {}
51);
52
53#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
54unsafe impl CopyingHelper for NSMassFormatter {
55 type Result = Self;
56}
57
58#[cfg(feature = "NSFormatter")]
59extern_conformance!(
60 unsafe impl NSObjectProtocol for NSMassFormatter {}
61);
62
63#[cfg(feature = "NSFormatter")]
64impl NSMassFormatter {
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(isForPersonMassUse))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn isForPersonMassUse(&self) -> bool;
89
90 #[unsafe(method(setForPersonMassUse:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn setForPersonMassUse(&self, for_person_mass_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: NSMassFormatterUnit,
102 ) -> Retained<NSString>;
103
104 #[cfg(feature = "NSString")]
105 #[unsafe(method(stringFromKilograms:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn stringFromKilograms(
108 &self,
109 number_in_kilograms: c_double,
110 ) -> Retained<NSString>;
111
112 #[cfg(feature = "NSString")]
113 #[unsafe(method(unitStringFromValue:unit:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn unitStringFromValue_unit(
116 &self,
117 value: c_double,
118 unit: NSMassFormatterUnit,
119 ) -> Retained<NSString>;
120
121 #[cfg(feature = "NSString")]
122 #[unsafe(method(unitStringFromKilograms:usedUnit:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn unitStringFromKilograms_usedUnit(
125 &self,
126 number_in_kilograms: c_double,
127 unitp: *mut NSMassFormatterUnit,
128 ) -> Retained<NSString>;
129
130 #[cfg(feature = "NSString")]
131 #[unsafe(method(getObjectValue:forString:errorDescription:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn getObjectValue_forString_errorDescription(
134 &self,
135 obj: Option<&mut Option<Retained<AnyObject>>>,
136 string: &NSString,
137 error: Option<&mut Option<Retained<NSString>>>,
138 ) -> bool;
139 );
140}
141
142#[cfg(feature = "NSFormatter")]
144impl NSMassFormatter {
145 extern_methods!(
146 #[unsafe(method(init))]
147 #[unsafe(method_family = init)]
148 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
149
150 #[unsafe(method(new))]
151 #[unsafe(method_family = new)]
152 pub unsafe fn new() -> Retained<Self>;
153 );
154}