use crate::{arc, cf, define_cf_type};
pub type Id = cf::String;
define_cf_type!(Locale(cf::Type));
impl Locale {
#[inline]
pub fn type_id() -> cf::TypeId {
unsafe { CFLocaleGetTypeID() }
}
pub fn system() -> &'static Locale {
unsafe { CFLocaleGetSystem() }
}
pub fn current() -> arc::R<Self> {
unsafe { CFLocaleCopyCurrent() }
}
pub fn id(&self) -> &Id {
unsafe { CFLocaleGetIdentifier(self) }
}
}
unsafe extern "C-unwind" {
fn CFLocaleGetSystem() -> &'static Locale;
fn CFLocaleGetIdentifier(locale: &Locale) -> &Id;
fn CFLocaleCopyCurrent() -> arc::R<Locale>;
fn CFLocaleGetTypeID() -> cf::TypeId;
}