icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSMassFormatterUnit {
        NSMassFormatterUnitGram = 11,
        NSMassFormatterUnitKilogram = 14,
        NSMassFormatterUnitOunce = (6 << 8) + 1,
        NSMassFormatterUnitPound = (6 << 8) + 2,
        NSMassFormatterUnitStone = (6 << 8) + 3,
    }
);

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

    #[cfg(feature = "Foundation_NSMassFormatter")]
    unsafe impl ClassType for NSMassFormatter {
        #[inherits(NSObject)]
        type Super = NSFormatter;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "Foundation_NSMassFormatter")]
unsafe impl NSCoding for NSMassFormatter {}

#[cfg(feature = "Foundation_NSMassFormatter")]
unsafe impl NSCopying for NSMassFormatter {}

#[cfg(feature = "Foundation_NSMassFormatter")]
unsafe impl NSObjectProtocol for NSMassFormatter {}

extern_methods!(
    #[cfg(feature = "Foundation_NSMassFormatter")]
    unsafe impl NSMassFormatter {
        #[cfg(feature = "Foundation_NSNumberFormatter")]
        #[method_id(@__retain_semantics Other numberFormatter)]
        pub unsafe fn numberFormatter(&self) -> Id<NSNumberFormatter>;

        #[cfg(feature = "Foundation_NSNumberFormatter")]
        #[method(setNumberFormatter:)]
        pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);

        #[method(unitStyle)]
        pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;

        #[method(setUnitStyle:)]
        pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);

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

        #[method(setForPersonMassUse:)]
        pub unsafe fn setForPersonMassUse(&self, for_person_mass_use: bool);

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other stringFromValue:unit:)]
        pub unsafe fn stringFromValue_unit(
            &self,
            value: c_double,
            unit: NSMassFormatterUnit,
        ) -> Id<NSString>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other stringFromKilograms:)]
        pub unsafe fn stringFromKilograms(&self, number_in_kilograms: c_double) -> Id<NSString>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
        pub unsafe fn unitStringFromValue_unit(
            &self,
            value: c_double,
            unit: NSMassFormatterUnit,
        ) -> Id<NSString>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other unitStringFromKilograms:usedUnit:)]
        pub unsafe fn unitStringFromKilograms_usedUnit(
            &self,
            number_in_kilograms: c_double,
            unitp: *mut NSMassFormatterUnit,
        ) -> Id<NSString>;

        #[cfg(feature = "Foundation_NSString")]
        #[method(getObjectValue:forString:errorDescription:)]
        pub unsafe fn getObjectValue_forString_errorDescription(
            &self,
            obj: Option<&mut Option<Id<AnyObject>>>,
            string: &NSString,
            error: Option<&mut Option<Id<NSString>>>,
        ) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "Foundation_NSMassFormatter")]
    unsafe impl NSMassFormatter {
        #[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>;
    }
);