Move dictionary and number to sys crate
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
use libc::{c_void};
|
||||
|
||||
use base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean};
|
||||
|
||||
pub type CFDictionaryApplierFunction = *const u8;
|
||||
pub type CFDictionaryCopyDescriptionCallBack = *const u8;
|
||||
pub type CFDictionaryEqualCallBack = *const u8;
|
||||
pub type CFDictionaryHashCallBack = *const u8;
|
||||
pub type CFDictionaryReleaseCallBack = *const u8;
|
||||
pub type CFDictionaryRetainCallBack = *const u8;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CFDictionaryKeyCallBacks {
|
||||
pub version: CFIndex,
|
||||
pub retain: CFDictionaryRetainCallBack,
|
||||
pub release: CFDictionaryReleaseCallBack,
|
||||
pub copyDescription: CFDictionaryCopyDescriptionCallBack,
|
||||
pub equal: CFDictionaryEqualCallBack,
|
||||
pub hash: CFDictionaryHashCallBack
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CFDictionaryValueCallBacks {
|
||||
pub version: CFIndex,
|
||||
pub retain: CFDictionaryRetainCallBack,
|
||||
pub release: CFDictionaryReleaseCallBack,
|
||||
pub copyDescription: CFDictionaryCopyDescriptionCallBack,
|
||||
pub equal: CFDictionaryEqualCallBack
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct __CFDictionary;
|
||||
|
||||
pub type CFDictionaryRef = *const __CFDictionary;
|
||||
|
||||
extern {
|
||||
/*
|
||||
* CFDictionary.h
|
||||
*/
|
||||
|
||||
pub static kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
|
||||
pub static kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks;
|
||||
|
||||
pub fn CFDictionaryContainsKey(theDict: CFDictionaryRef, key: *const c_void) -> Boolean;
|
||||
pub fn CFDictionaryCreate(allocator: CFAllocatorRef, keys: *const *const c_void, values: *const *const c_void,
|
||||
numValues: CFIndex, keyCallBacks: *const CFDictionaryKeyCallBacks,
|
||||
valueCallBacks: *const CFDictionaryValueCallBacks)
|
||||
-> CFDictionaryRef;
|
||||
pub fn CFDictionaryGetCount(theDict: CFDictionaryRef) -> CFIndex;
|
||||
pub fn CFDictionaryGetTypeID() -> CFTypeID;
|
||||
pub fn CFDictionaryGetValueIfPresent(theDict: CFDictionaryRef, key: *const c_void, value: *mut *const c_void)
|
||||
-> Boolean;
|
||||
}
|
||||
@@ -7,5 +7,6 @@ pub mod base;
|
||||
pub mod bundle;
|
||||
pub mod data;
|
||||
pub mod date;
|
||||
pub mod dictionary;
|
||||
pub mod number;
|
||||
pub mod string;
|
||||
|
||||
@@ -1,12 +1,47 @@
|
||||
use libc::c_void;
|
||||
|
||||
use base::CFTypeID;
|
||||
use base::{CFAllocatorRef, CFTypeID};
|
||||
|
||||
pub type CFBooleanRef = *const c_void;
|
||||
|
||||
pub type CFNumberType = u32;
|
||||
|
||||
// members of enum CFNumberType
|
||||
// static kCFNumberSInt8Type: CFNumberType = 1;
|
||||
// static kCFNumberSInt16Type: CFNumberType = 2;
|
||||
pub static kCFNumberSInt32Type: CFNumberType = 3;
|
||||
pub static kCFNumberSInt64Type: CFNumberType = 4;
|
||||
// static kCFNumberFloat32Type: CFNumberType = 5;
|
||||
pub static kCFNumberFloat64Type: CFNumberType = 6;
|
||||
// static kCFNumberCharType: CFNumberType = 7;
|
||||
// static kCFNumberShortType: CFNumberType = 8;
|
||||
// static kCFNumberIntType: CFNumberType = 9;
|
||||
// static kCFNumberLongType: CFNumberType = 10;
|
||||
// static kCFNumberLongLongType: CFNumberType = 11;
|
||||
// static kCFNumberFloatType: CFNumberType = 12;
|
||||
// static kCFNumberDoubleType: CFNumberType = 13;
|
||||
// static kCFNumberCFIndexType: CFNumberType = 14;
|
||||
// static kCFNumberNSIntegerType: CFNumberType = 15;
|
||||
// static kCFNumberCGFloatType: CFNumberType = 16;
|
||||
// static kCFNumberMaxType: CFNumberType = 16;
|
||||
|
||||
#[repr(C)]
|
||||
struct __CFNumber;
|
||||
|
||||
pub type CFNumberRef = *const __CFNumber;
|
||||
|
||||
extern {
|
||||
/*
|
||||
* CFNumber.h
|
||||
*/
|
||||
pub static kCFBooleanTrue: CFBooleanRef;
|
||||
pub static kCFBooleanFalse: CFBooleanRef;
|
||||
|
||||
pub fn CFBooleanGetTypeID() -> CFTypeID;
|
||||
pub fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePtr: *const c_void)
|
||||
-> CFNumberRef;
|
||||
//fn CFNumberGetByteSize
|
||||
pub fn CFNumberGetValue(number: CFNumberRef, theType: CFNumberType, valuePtr: *mut c_void) -> bool;
|
||||
//fn CFNumberCompare
|
||||
pub fn CFNumberGetTypeID() -> CFTypeID;
|
||||
}
|
||||
|
||||
@@ -9,49 +9,15 @@
|
||||
|
||||
//! Dictionaries of key-value pairs.
|
||||
|
||||
use core_foundation_sys::base::{Boolean, CFAllocatorRef, CFIndex, CFRelease};
|
||||
use core_foundation_sys::base::{CFTypeID, CFTypeRef, kCFAllocatorDefault};
|
||||
use core_foundation_sys::base::CFRelease;
|
||||
use core_foundation_sys::base::{CFTypeRef, kCFAllocatorDefault};
|
||||
use core_foundation_sys::dictionary::*;
|
||||
use libc::c_void;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use base::{CFType, CFIndexConvertible, TCFType};
|
||||
|
||||
pub type CFDictionaryApplierFunction = *const u8;
|
||||
pub type CFDictionaryCopyDescriptionCallBack = *const u8;
|
||||
pub type CFDictionaryEqualCallBack = *const u8;
|
||||
pub type CFDictionaryHashCallBack = *const u8;
|
||||
pub type CFDictionaryReleaseCallBack = *const u8;
|
||||
pub type CFDictionaryRetainCallBack = *const u8;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CFDictionaryKeyCallBacks {
|
||||
version: CFIndex,
|
||||
retain: CFDictionaryRetainCallBack,
|
||||
release: CFDictionaryReleaseCallBack,
|
||||
copyDescription: CFDictionaryCopyDescriptionCallBack,
|
||||
equal: CFDictionaryEqualCallBack,
|
||||
hash: CFDictionaryHashCallBack
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CFDictionaryValueCallBacks {
|
||||
version: CFIndex,
|
||||
retain: CFDictionaryRetainCallBack,
|
||||
release: CFDictionaryReleaseCallBack,
|
||||
copyDescription: CFDictionaryCopyDescriptionCallBack,
|
||||
equal: CFDictionaryEqualCallBack
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct __CFDictionary;
|
||||
|
||||
pub type CFDictionaryRef = *const __CFDictionary;
|
||||
|
||||
/// An immutable dictionary of key-value pairs.
|
||||
pub struct CFDictionary(CFDictionaryRef);
|
||||
|
||||
@@ -131,23 +97,3 @@ impl CFDictionary {
|
||||
TCFType::wrap_under_get_rule(value)
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreFoundation", kind = "framework")]
|
||||
extern {
|
||||
/*
|
||||
* CFDictionary.h
|
||||
*/
|
||||
|
||||
static kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
|
||||
static kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks;
|
||||
|
||||
fn CFDictionaryContainsKey(theDict: CFDictionaryRef, key: *const c_void) -> Boolean;
|
||||
fn CFDictionaryCreate(allocator: CFAllocatorRef, keys: *const *const c_void, values: *const *const c_void,
|
||||
numValues: CFIndex, keyCallBacks: *const CFDictionaryKeyCallBacks,
|
||||
valueCallBacks: *const CFDictionaryValueCallBacks)
|
||||
-> CFDictionaryRef;
|
||||
fn CFDictionaryGetCount(theDict: CFDictionaryRef) -> CFIndex;
|
||||
fn CFDictionaryGetTypeID() -> CFTypeID;
|
||||
fn CFDictionaryGetValueIfPresent(theDict: CFDictionaryRef, key: *const c_void, value: *mut *const c_void)
|
||||
-> Boolean;
|
||||
}
|
||||
|
||||
@@ -11,39 +11,12 @@
|
||||
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
use core_foundation_sys::base::{CFAllocatorRef, CFRelease, CFTypeID};
|
||||
use core_foundation_sys::base::{kCFAllocatorDefault};
|
||||
use libc::c_void;
|
||||
use core_foundation_sys::base::{CFRelease, kCFAllocatorDefault};
|
||||
use core_foundation_sys::number::*;
|
||||
use std::mem;
|
||||
|
||||
use base::{TCFType};
|
||||
|
||||
pub type CFNumberType = u32;
|
||||
|
||||
// members of enum CFNumberType
|
||||
// static kCFNumberSInt8Type: CFNumberType = 1;
|
||||
// static kCFNumberSInt16Type: CFNumberType = 2;
|
||||
static kCFNumberSInt32Type: CFNumberType = 3;
|
||||
static kCFNumberSInt64Type: CFNumberType = 4;
|
||||
// static kCFNumberFloat32Type: CFNumberType = 5;
|
||||
static kCFNumberFloat64Type: CFNumberType = 6;
|
||||
// static kCFNumberCharType: CFNumberType = 7;
|
||||
// static kCFNumberShortType: CFNumberType = 8;
|
||||
// static kCFNumberIntType: CFNumberType = 9;
|
||||
// static kCFNumberLongType: CFNumberType = 10;
|
||||
// static kCFNumberLongLongType: CFNumberType = 11;
|
||||
// static kCFNumberFloatType: CFNumberType = 12;
|
||||
// static kCFNumberDoubleType: CFNumberType = 13;
|
||||
// static kCFNumberCFIndexType: CFNumberType = 14;
|
||||
// static kCFNumberNSIntegerType: CFNumberType = 15;
|
||||
// static kCFNumberCGFloatType: CFNumberType = 16;
|
||||
// static kCFNumberMaxType: CFNumberType = 16;
|
||||
|
||||
#[repr(C)]
|
||||
struct __CFNumber;
|
||||
|
||||
pub type CFNumberRef = *const __CFNumber;
|
||||
|
||||
/// An immutable numeric value.
|
||||
pub struct CFNumber(CFNumberRef);
|
||||
|
||||
@@ -112,18 +85,3 @@ impl CFNumber {
|
||||
pub fn number(value: i64) -> CFNumber {
|
||||
CFNumber::from_i64(value)
|
||||
}
|
||||
|
||||
#[link(name = "CoreFoundation", kind = "framework")]
|
||||
extern {
|
||||
/*
|
||||
* CFNumber.h
|
||||
*/
|
||||
|
||||
|
||||
fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePtr: *const c_void)
|
||||
-> CFNumberRef;
|
||||
//fn CFNumberGetByteSize
|
||||
fn CFNumberGetValue(number: CFNumberRef, theType: CFNumberType, valuePtr: *mut c_void) -> bool;
|
||||
//fn CFNumberCompare
|
||||
fn CFNumberGetTypeID() -> CFTypeID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user