Module: OS::Mac::FFI::CoreFoundation Private
- Extended by:
- NativeLibrary
- Defined in:
- os/mac/ffi/core_foundation.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
CoreFoundation.framework wrapper
Class Method Summary collapse
-
.dictionary_create(hash) ⇒ Fiddle::Pointer
private
CoreFoundation/CFDictionary.h: CFDictionaryRef CFDictionaryCreate( CFAllocatorRef allocator, const void **keys, const void **values, CFIndex numValues, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);.
-
.string_create(string) ⇒ Fiddle::Pointer
private
CoreFoundation/CFString.h: CFStringRef CFStringCreateWithCString(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding);.
-
.type_dictionary_key_call_backs ⇒ Fiddle::Pointer
private
CoreFoundation/CFDictionary.h: extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;.
-
.type_dictionary_value_call_backs ⇒ Fiddle::Pointer
private
CoreFoundation/CFDictionary.h: extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks.
-
.url_create_with_file_system_path(path) ⇒ Fiddle::Pointer
private
CoreFoundation/CFURL.h: CFURLRef CFURLCreateWithFileSystemPath(CFAllocatorRef allocator, CFStringRef filePath, CFURLPathStyle pathStyle, Boolean isDirectory);.
-
.url_quarantine_properties_key ⇒ Fiddle::Pointer
private
CoreFoundation/CFURL.h: extern const CFStringRef kCFURLQuarantinePropertiesKey;.
-
.url_set_resource_property_for_key(url, key, value) ⇒ Boolean
private
CoreFoundation/CFURL.h: Boolean CFURLSetResourcePropertyForKey(CFURLRef url, CFStringRef key, CFTypeRef value, CFErrorRef *error);.
Class Method Details
.dictionary_create(hash) ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFDictionary.h:
CFDictionaryRef CFDictionaryCreate(
CFAllocatorRef allocator,
const void **keys,
const void **values,
CFIndex numValues,
const CFDictionaryKeyCallBacks *keyCallBacks,
const CFDictionaryValueCallBacks *valueCallBacks);
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'os/mac/ffi/core_foundation.rb', line 76 def self.dictionary_create(hash) size = Fiddle::SIZEOF_VOIDP * hash.size Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) do |keys| Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) do |values| # Convert array of pointers to continous stream of pointers in the C buffer keys[0, size] = hash.keys.pack("J*") values[0, size] = hash.values.pack("J*") return autorelease( function( "CFDictionaryCreate", [ Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP ], Fiddle::TYPE_VOIDP, ).call( nil, keys, values, hash.size, type_dictionary_key_call_backs, type_dictionary_value_call_backs ), ) end end end |
.string_create(string) ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFString.h:
CFStringRef CFStringCreateWithCString(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding);
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'os/mac/ffi/core_foundation.rb', line 43 def self.string_create(string) cf_encoding = case string.encoding when Encoding::UTF_8 0x08000100 # kCFStringEncodingUTF8 when Encoding::US_ASCII 0x0600 # kCFStringEncodingASCII when Encoding::ASCII_8BIT, Encoding::ISO8859_1 # ASCII-8BIT could be anything, so just use Latin-1 0x0201 # kCFStringEncodingISOLatin1 else # Try convert to UTF-8 and move on string = string.encode(Encoding::UTF_8) 0x08000100 end autorelease( function( "CFStringCreateWithCString", [Fiddle::TYPE_VOIDP, Fiddle::TYPE_CONST_STRING, Fiddle::TYPE_UINT32_T], Fiddle::TYPE_VOIDP, ).call(nil, string, cf_encoding), ) end |
.type_dictionary_key_call_backs ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFDictionary.h:
extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;
28 |
# File 'os/mac/ffi/core_foundation.rb', line 28 def self.type_dictionary_key_call_backs = constant("kCFTypeDictionaryKeyCallBacks") |
.type_dictionary_value_call_backs ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFDictionary.h:
extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks
33 |
# File 'os/mac/ffi/core_foundation.rb', line 33 def self.type_dictionary_value_call_backs = constant("kCFTypeDictionaryValueCallBacks") |
.url_create_with_file_system_path(path) ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFURL.h:
CFURLRef CFURLCreateWithFileSystemPath(CFAllocatorRef allocator,
CFStringRef filePath, CFURLPathStyle pathStyle, Boolean isDirectory);
103 104 105 106 107 108 109 110 111 |
# File 'os/mac/ffi/core_foundation.rb', line 103 def self.url_create_with_file_system_path(path) autorelease( function( "CFURLCreateWithFileSystemPath", [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG, Fiddle::TYPE_BOOL], Fiddle::TYPE_VOIDP, ).call(nil, path, 0, false), ) end |
.url_quarantine_properties_key ⇒ Fiddle::Pointer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFURL.h:
extern const CFStringRef kCFURLQuarantinePropertiesKey;
38 |
# File 'os/mac/ffi/core_foundation.rb', line 38 def self.url_quarantine_properties_key = constant("kCFURLQuarantinePropertiesKey", dereference: true) |
.url_set_resource_property_for_key(url, key, value) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
CoreFoundation/CFURL.h:
Boolean CFURLSetResourcePropertyForKey(CFURLRef url, CFStringRef key, CFTypeRef value, CFErrorRef *error);
116 117 118 119 120 121 122 |
# File 'os/mac/ffi/core_foundation.rb', line 116 def self.url_set_resource_property_for_key(url, key, value) function( "CFURLSetResourcePropertyForKey", [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP], Fiddle::TYPE_BOOL, ).call(url, key, value, nil) end |