use crate::common::*;
use crate::Foundation::*;
ns_enum!(
#[underlying(NSInteger)]
pub enum NSEnergyFormatterUnit {
NSEnergyFormatterUnitJoule = 11,
NSEnergyFormatterUnitKilojoule = 14,
NSEnergyFormatterUnitCalorie = (7 << 8) + 1,
NSEnergyFormatterUnitKilocalorie = (7 << 8) + 2,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSEnergyFormatter;
unsafe impl ClassType for NSEnergyFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
}
);
extern_methods!(
unsafe impl NSEnergyFormatter {
#[method_id(@__retain_semantics Other numberFormatter)]
pub unsafe fn numberFormatter(&self) -> Id<NSNumberFormatter, Shared>;
#[method(setNumberFormatter:)]
pub unsafe fn setNumberFormatter(&self, numberFormatter: Option<&NSNumberFormatter>);
#[method(unitStyle)]
pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
#[method(setUnitStyle:)]
pub unsafe fn setUnitStyle(&self, unitStyle: NSFormattingUnitStyle);
#[method(isForFoodEnergyUse)]
pub unsafe fn isForFoodEnergyUse(&self) -> bool;
#[method(setForFoodEnergyUse:)]
pub unsafe fn setForFoodEnergyUse(&self, forFoodEnergyUse: bool);
#[method_id(@__retain_semantics Other stringFromValue:unit:)]
pub unsafe fn stringFromValue_unit(
&self,
value: c_double,
unit: NSEnergyFormatterUnit,
) -> Id<NSString, Shared>;
#[method_id(@__retain_semantics Other stringFromJoules:)]
pub unsafe fn stringFromJoules(&self, numberInJoules: c_double) -> Id<NSString, Shared>;
#[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
pub unsafe fn unitStringFromValue_unit(
&self,
value: c_double,
unit: NSEnergyFormatterUnit,
) -> Id<NSString, Shared>;
#[method_id(@__retain_semantics Other unitStringFromJoules:usedUnit:)]
pub unsafe fn unitStringFromJoules_usedUnit(
&self,
numberInJoules: c_double,
unitp: *mut NSEnergyFormatterUnit,
) -> Id<NSString, Shared>;
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: *mut *mut Object,
string: &NSString,
error: *mut *mut NSString,
) -> bool;
}
);