Add CFURLGetTypeID() binding.

This commit is contained in:
Brian J. Burg
2012-11-08 15:21:53 -08:00
parent 22ff767266
commit 925aad58aa
2 changed files with 10 additions and 2 deletions
-2
View File
@@ -79,13 +79,11 @@ impl<T:Copy AbstractCFTypeRef,S:AbstractCFType<T>> S : CFTypeOps<T> {
self.get_ref().as_type_ref()
}
// FIXME: Should move, but there's a linearity bug.
static fn as_CFType(obj: S) -> CFType {
let tyref : CFTypeRef = base::unwrap(move obj).as_type_ref();
CFType { obj: tyref }
}
// FIXME: Should move, but there's a linearity bug.
fn clone_as_CFType(&self) -> CFType {
let tyref = self.get_ref().as_type_ref();
CFRetain(tyref);
+10
View File
@@ -4,12 +4,14 @@ use base::{
CFAllocatorRef,
CFRelease,
CFType,
CFTypeID,
CFTypeRef,
};
use data::{
CFDataRef,
};
use string::{
CFString,
CFStringRef,
CFStringEncoding,
};
@@ -43,6 +45,13 @@ impl CFURL : AbstractCFType<CFURLRef> {
}
}
impl CFURL : ToStr {
pure fn to_str() -> ~str unsafe {
let cfstr : CFString = base::wrap(CFURLGetString(self.obj));
cfstr.to_str()
}
}
#[link_args="-framework CoreFoundation"]
#[nolink]
@@ -57,5 +66,6 @@ extern {
encoding: CFStringEncoding, escapeWhitespace: bool) -> CFDataRef;
fn CFURLGetString(anURL: CFURLRef) -> CFStringRef;
fn CFURLGetBaseURL(anURL: CFURLRef) -> CFURLRef;
fn CFURLGetTypeID() -> CFTypeID;
}