From 6a36607f7f4845e6023c2019381e9221f75929ea Mon Sep 17 00:00:00 2001 From: michaelwright235 Date: Wed, 31 May 2023 22:22:16 +0300 Subject: [PATCH] sys: propertylist: Add missing functions and sort them Adds missing functions of CFPropertyList and sorts them in Apple docs order. Some of them are commented out because some types are not implemented yet. --- core-foundation-sys/src/propertylist.rs | 39 +++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/core-foundation-sys/src/propertylist.rs b/core-foundation-sys/src/propertylist.rs index da6026f..07fc113 100644 --- a/core-foundation-sys/src/propertylist.rs +++ b/core-foundation-sys/src/propertylist.rs @@ -7,9 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef}; +use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef, Boolean}; use data::CFDataRef; use error::CFErrorRef; +use string::CFStringRef; pub type CFPropertyListRef = CFTypeRef; @@ -30,23 +31,23 @@ pub const kCFPropertyListReadStreamError: CFIndex = 3842; pub const kCFPropertyListWriteStreamError: CFIndex = 3851; extern "C" { - // CFPropertyList.h - // + /* + * CFPropertyList.h + */ - // fn CFPropertyListCreateDeepCopy - // fn CFPropertyListIsValid - pub fn CFPropertyListCreateWithData(allocator: CFAllocatorRef, - data: CFDataRef, - options: CFPropertyListMutabilityOptions, - format: *mut CFPropertyListFormat, - error: *mut CFErrorRef) - -> CFPropertyListRef; - // fn CFPropertyListCreateWithStream - // fn CFPropertyListWrite - pub fn CFPropertyListCreateData(allocator: CFAllocatorRef, - propertyList: CFPropertyListRef, - format: CFPropertyListFormat, - options: CFOptionFlags, - error: *mut CFErrorRef) - -> CFDataRef; + /* Creating a Property List */ + pub fn CFPropertyListCreateWithData(allocator: CFAllocatorRef, data: CFDataRef, options: CFPropertyListMutabilityOptions, format: *mut CFPropertyListFormat, error: *mut CFErrorRef) -> CFPropertyListRef; + //pub fn CFPropertyListCreateWithStream(allocator: CFAllocatorRef, stream: CFReadStreamRef, streamLength: CFIndex, options: CFOptionFlags, format: *mut CFPropertyListFormat, error: *mut CFErrorRef) -> CFPropertyListRef; + pub fn CFPropertyListCreateDeepCopy(allocator: CFAllocatorRef, propertyList: CFPropertyListRef, mutabilityOption: CFOptionFlags) -> CFPropertyListRef; + pub fn CFPropertyListCreateFromXMLData(allocator: CFAllocatorRef, xmlData: CFDataRef, mutabilityOption: CFOptionFlags, errorString: *mut CFStringRef) -> CFPropertyListRef; // deprecated + //pub fn CFPropertyListCreateFromStream(allocator: CFAllocatorRef, stream: CFReadStreamRef, streamLength: CFIndex, mutabilityOption: CFOptionFlags, format: *mut CFPropertyListFormat, errorString: *mut CFStringRef) -> CFPropertyListRef; // deprecated + + /* Exporting a Property List */ + pub fn CFPropertyListCreateData(allocator: CFAllocatorRef, propertyList: CFPropertyListRef, format: CFPropertyListFormat, options: CFOptionFlags, error: *mut CFErrorRef) -> CFDataRef; + //pub fn CFPropertyListWrite(propertyList: CFPropertyListRef, stream: CFWriteStreamRef, format: CFPropertyListFormat, options: CFOptionFlags, error: *mut CFErrorRef) -> CFIndex; + pub fn CFPropertyListCreateXMLData(allocator: CFAllocatorRef, propertyList: CFPropertyListRef) -> CFDataRef; // deprecated + //pub fn CFPropertyListWriteToStream(propertyList: CFPropertyListRef, stream: CFWriteStreamRef, format: CFPropertyListFormat, errorString: *mut CFStringRef) -> CFIndex; + + /* Validating a Property List */ + pub fn CFPropertyListIsValid(plist: CFPropertyListRef, format: CFPropertyListFormat) -> Boolean; }