1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSByteCountFormatterUnits {
        NSByteCountFormatterUseDefault = 0,
        NSByteCountFormatterUseBytes = 1 << 0,
        NSByteCountFormatterUseKB = 1 << 1,
        NSByteCountFormatterUseMB = 1 << 2,
        NSByteCountFormatterUseGB = 1 << 3,
        NSByteCountFormatterUseTB = 1 << 4,
        NSByteCountFormatterUsePB = 1 << 5,
        NSByteCountFormatterUseEB = 1 << 6,
        NSByteCountFormatterUseZB = 1 << 7,
        NSByteCountFormatterUseYBOrHigher = 0x0FF << 8,
        NSByteCountFormatterUseAll = 0x0FFFF,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSByteCountFormatterCountStyle {
        NSByteCountFormatterCountStyleFile = 0,
        NSByteCountFormatterCountStyleMemory = 1,
        NSByteCountFormatterCountStyleDecimal = 2,
        NSByteCountFormatterCountStyleBinary = 3,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "Foundation_NSByteCountFormatter")]
    pub struct NSByteCountFormatter;

    #[cfg(feature = "Foundation_NSByteCountFormatter")]
    unsafe impl ClassType for NSByteCountFormatter {
        #[inherits(NSObject)]
        type Super = NSFormatter;
    }
);

#[cfg(feature = "Foundation_NSByteCountFormatter")]
unsafe impl NSCoding for NSByteCountFormatter {}

#[cfg(feature = "Foundation_NSByteCountFormatter")]
unsafe impl NSObjectProtocol for NSByteCountFormatter {}

extern_methods!(
    #[cfg(feature = "Foundation_NSByteCountFormatter")]
    unsafe impl NSByteCountFormatter {
        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other stringFromByteCount:countStyle:)]
        pub unsafe fn stringFromByteCount_countStyle(
            byte_count: c_longlong,
            count_style: NSByteCountFormatterCountStyle,
        ) -> Id<NSString, Shared>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other stringFromByteCount:)]
        pub unsafe fn stringFromByteCount(&self, byte_count: c_longlong) -> Id<NSString, Shared>;

        #[cfg(all(
            feature = "Foundation_NSMeasurement",
            feature = "Foundation_NSString",
            feature = "Foundation_NSUnitInformationStorage"
        ))]
        #[method_id(@__retain_semantics Other stringFromMeasurement:countStyle:)]
        pub unsafe fn stringFromMeasurement_countStyle(
            measurement: &NSMeasurement<NSUnitInformationStorage>,
            count_style: NSByteCountFormatterCountStyle,
        ) -> Id<NSString, Shared>;

        #[cfg(all(
            feature = "Foundation_NSMeasurement",
            feature = "Foundation_NSString",
            feature = "Foundation_NSUnitInformationStorage"
        ))]
        #[method_id(@__retain_semantics Other stringFromMeasurement:)]
        pub unsafe fn stringFromMeasurement(
            &self,
            measurement: &NSMeasurement<NSUnitInformationStorage>,
        ) -> Id<NSString, Shared>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other stringForObjectValue:)]
        pub unsafe fn stringForObjectValue(
            &self,
            obj: Option<&Object>,
        ) -> Option<Id<NSString, Shared>>;

        #[method(allowedUnits)]
        pub unsafe fn allowedUnits(&self) -> NSByteCountFormatterUnits;

        #[method(setAllowedUnits:)]
        pub unsafe fn setAllowedUnits(&self, allowed_units: NSByteCountFormatterUnits);

        #[method(countStyle)]
        pub unsafe fn countStyle(&self) -> NSByteCountFormatterCountStyle;

        #[method(setCountStyle:)]
        pub unsafe fn setCountStyle(&self, count_style: NSByteCountFormatterCountStyle);

        #[method(allowsNonnumericFormatting)]
        pub unsafe fn allowsNonnumericFormatting(&self) -> bool;

        #[method(setAllowsNonnumericFormatting:)]
        pub unsafe fn setAllowsNonnumericFormatting(&self, allows_nonnumeric_formatting: bool);

        #[method(includesUnit)]
        pub unsafe fn includesUnit(&self) -> bool;

        #[method(setIncludesUnit:)]
        pub unsafe fn setIncludesUnit(&self, includes_unit: bool);

        #[method(includesCount)]
        pub unsafe fn includesCount(&self) -> bool;

        #[method(setIncludesCount:)]
        pub unsafe fn setIncludesCount(&self, includes_count: bool);

        #[method(includesActualByteCount)]
        pub unsafe fn includesActualByteCount(&self) -> bool;

        #[method(setIncludesActualByteCount:)]
        pub unsafe fn setIncludesActualByteCount(&self, includes_actual_byte_count: bool);

        #[method(isAdaptive)]
        pub unsafe fn isAdaptive(&self) -> bool;

        #[method(setAdaptive:)]
        pub unsafe fn setAdaptive(&self, adaptive: bool);

        #[method(zeroPadsFractionDigits)]
        pub unsafe fn zeroPadsFractionDigits(&self) -> bool;

        #[method(setZeroPadsFractionDigits:)]
        pub unsafe fn setZeroPadsFractionDigits(&self, zero_pads_fraction_digits: bool);

        #[method(formattingContext)]
        pub unsafe fn formattingContext(&self) -> NSFormattingContext;

        #[method(setFormattingContext:)]
        pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
    }
);