cocoa_foundation/base.rs
1// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution.
3//
4// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7// option. This file may not be copied, modified, or distributed
8// except according to those terms.
9
10use objc::runtime;
11
12pub use objc::runtime::{BOOL, NO, YES};
13
14pub type Class = *mut runtime::Class;
15#[allow(non_camel_case_types)]
16pub type id = *mut runtime::Object;
17pub type SEL = runtime::Sel;
18
19#[allow(non_upper_case_globals)]
20pub const nil: id = 0 as id;
21#[allow(non_upper_case_globals)]
22pub const Nil: Class = 0 as Class;
23
24/// A convenience method to convert the name of a selector to the selector object.
25#[inline]
26pub fn selector(name: &str) -> SEL {
27 runtime::Sel::register(name)
28}