From 303ab74e1c1f6e8abce247c8b7e25084ac04e588 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Tue, 24 Jan 2017 21:47:44 -0500 Subject: [PATCH] Expose CFURL accessor functions --- core-foundation-sys/src/base.rs | 3 ++- core-foundation-sys/src/url.rs | 36 ++++++++++++++++----------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/core-foundation-sys/src/base.rs b/core-foundation-sys/src/base.rs index 5f29cd5..42e2946 100644 --- a/core-foundation-sys/src/base.rs +++ b/core-foundation-sys/src/base.rs @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use libc::{c_uint, c_long, c_ulong, c_void}; +use libc::{c_uint, c_long, c_ulong, c_void, c_int}; pub type Boolean = u8; pub type CFIndex = c_long; @@ -19,6 +19,7 @@ pub type CFTypeID = c_ulong; pub type CFTypeRef = *const c_void; pub type CFOptionFlags = u32; pub type OSStatus = i32; +pub type SInt32 = c_int; #[repr(C)] #[derive(Clone, Copy)] diff --git a/core-foundation-sys/src/url.rs b/core-foundation-sys/src/url.rs index 443f893..68d0f3a 100644 --- a/core-foundation-sys/src/url.rs +++ b/core-foundation-sys/src/url.rs @@ -8,7 +8,7 @@ // except according to those terms. use libc::c_void; -use base::{CFOptionFlags, CFIndex, CFAllocatorRef, Boolean, CFTypeID}; +use base::{CFOptionFlags, CFIndex, CFAllocatorRef, Boolean, CFTypeID, SInt32}; use string::CFStringRef; #[repr(C)] @@ -100,23 +100,23 @@ extern { // baseURL: CFURLRef) -> CFURLRef; /* Accessing the Parts of a URL */ - //fn CFURLCanBeDecomposed - //fn CFURLCopyFileSystemPath - //fn CFURLCopyFragment - //fn CFURLCopyHostName - //fn CFURLCopyLastPathComponent - //fn CFURLCopyNetLocation - //fn CFURLCopyParameterString - //fn CFURLCopyPassword - //fn CFURLCopyPath - //fn CFURLCopyPathExtension - //fn CFURLCopyQueryString - //fn CFURLCopyResourceSpecifier - //fn CFURLCopyScheme - //fn CFURLCopyStrictPath - //fn CFURLCopyUserName - //fn CFURLGetPortNumber - //fn CFURLHasDirectoryPath + pub fn CFURLCanBeDecomposed(anURL: CFURLRef) -> Boolean; + pub fn CFURLCopyFileSystemPath(anURL: CFURLRef, pathStyle: CFURLPathStyle) -> CFStringRef; + pub fn CFURLCopyFragment(anURL: CFURLRef, charactersToLeaveEscaped: CFStringRef) -> CFStringRef; + pub fn CFURLCopyHostName(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyLastPathComponent(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyNetLocation(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyParameterString(anURL: CFURLRef, charactersToLeaveEscaped: CFStringRef) -> CFStringRef; + pub fn CFURLCopyPassword(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyPath(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyPathExtension(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyQueryString(anURL: CFURLRef, charactersToLeaveEscaped: CFStringRef) -> CFStringRef; + pub fn CFURLCopyResourceSpecifier(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyScheme(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLCopyStrictPath(anURL: CFURLRef, isAbsolute: *mut Boolean) -> CFStringRef; + pub fn CFURLCopyUserName(anURL: CFURLRef) -> CFStringRef; + pub fn CFURLGetPortNumber(anURL: CFURLRef) -> SInt32; + pub fn CFURLHasDirectoryPath(anURL: CFURLRef) -> Boolean; /* Converting URLs to Other Representations */ //fn CFURLCreateData(allocator: CFAllocatorRef, url: CFURLRef,