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;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSByteCountFormatter")]
unsafe impl NSCoding for NSByteCountFormatter {}
#[cfg(feature = "Foundation_NSByteCountFormatter")]
unsafe impl NSCopying 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>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other stringFromByteCount:)]
pub unsafe fn stringFromByteCount(&self, byte_count: c_longlong) -> Id<NSString>;
#[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>;
#[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>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other stringForObjectValue:)]
pub unsafe fn stringForObjectValue(&self, obj: Option<&AnyObject>) -> Option<Id<NSString>>;
#[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);
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSByteCountFormatter")]
unsafe impl NSByteCountFormatter {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);