Schnittstelle CoreFoundation
- Alle Superschnittstellen:
Library
Core Foundation functions have names that indicate when you own a returned
object: Object-creation functions have “Create” embedded in the name, and
Object-duplication functions that have “Copy” embedded in the name. If you
own an object, it is your responsibility to relinquish ownership (using
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
) when you have finished with it.
If you receive an object from any Core Foundation function other than a
creation or copy function—such as a Get function—you do not own it and cannot
be certain of the object’s life span. If you want to ensure that such an
object is not disposed of while you are using it, you must claim ownership
(with the CFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
function).
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypSchnittstelleBeschreibungstatic class
A reference type used in many Core Foundation parameters and function results.static class
A reference to an immutableCFArray
object.static class
A reference to aCFBoolean
object.static class
A reference to an immutableCFData
object.static class
A reference to an immutableCFDictionary
object.static class
A wrapper for theNativeLong
type, used forCoreFoundation.CFNumberRef
types,CoreFoundation.CFStringRef
lengths, andCoreFoundation.CFArrayRef
sizes and indices.static class
A reference to a mutableCFDictionary
object.static class
A reference to aCFNumber
object.static enum
static class
A reference to aCFString
object, which “encapsulates” a Unicode string along with its length.static class
A type for unique, constant integer values that identify particular Core Foundation opaque types.static class
TheCFTypeRef
type is the base type defined in Core Foundation.Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen com.sun.jna.Library
Library.Handler
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final CoreFoundation.CFTypeID
static final CoreFoundation.CFTypeID
static final CoreFoundation.CFTypeID
static final CoreFoundation.CFTypeID
static final CoreFoundation.CFTypeID
static final CoreFoundation
static final int
static final int
static final int
static final CoreFoundation.CFTypeID
static final CoreFoundation.CFTypeID
Von Schnittstelle geerbte Felder com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungGets the default allocator object for the current thread.CFArrayCreate
(CoreFoundation.CFAllocatorRef alloc, Pointer values, CoreFoundation.CFIndex numValues, Pointer callBacks) Creates a new immutable array with the given values.CFArrayGetCount
(CoreFoundation.CFArrayRef theArray) Returns the number of values currently in an array.Retrieves a value at a given index.byte
Returns the value of aCFBoolean
object.Returns a textual description of a Core Foundation object.CFDataCreate
(CoreFoundation.CFAllocatorRef alloc, Pointer bytes, CoreFoundation.CFIndex length) Creates an immutableCFData
object using data copied from a specified byte buffer.CFDataGetBytePtr
(CoreFoundation.CFDataRef theData) Returns a read-only pointer to the bytes of aCFData
object.CFDataGetLength
(CoreFoundation.CFDataRef theData) Returns the number of bytes contained by aCFData
object.CFDictionaryCreateMutable
(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex capacity, Pointer keyCallBacks, Pointer valueCallBacks) Creates a new mutable dictionary.Returns the number of key-value pairs in a dictionary.CFDictionaryGetValue
(CoreFoundation.CFDictionaryRef theDict, PointerType key) Returns the value associated with a given key.byte
CFDictionaryGetValueIfPresent
(CoreFoundation.CFDictionaryRef theDict, PointerType key, PointerByReference value) Returns a boolean value that indicates whether a given value for a given key is in a dictionary, and returns that value indirectly if it exists.void
CFDictionarySetValue
(CoreFoundation.CFMutableDictionaryRef theDict, PointerType key, PointerType value) Sets the value corresponding to a given key.boolean
Determines whether two Core Foundation objects are considered equal.Returns the reference count of a Core Foundation object.CFGetTypeID
(CoreFoundation.CFTypeRef theObject) Returns the type of aCFType
object.CFGetTypeID
(Pointer theObject) Returns the type of aCFType
object presented as a pointer.CFNumberCreate
(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex theType, ByReference valuePtr) Creates aCFNumber
object using a specified value.Returns the type used by aCFNumber
object to store its value.byte
CFNumberGetValue
(CoreFoundation.CFNumberRef number, CoreFoundation.CFIndex theType, ByReference valuePtr) Obtains the value of aCFNumber
object cast to a specified type.void
Releases a Core Foundation object.Retains a Core Foundation object.CFStringCreateWithCharacters
(CoreFoundation.CFAllocatorRef alloc, char[] chars, CoreFoundation.CFIndex length) Creates a string from a buffer of Unicode characters.byte
CFStringGetCString
(CoreFoundation.CFStringRef theString, Pointer bufferToFill, CoreFoundation.CFIndex bufferSize, int encoding) Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.CFStringGetLength
(CoreFoundation.CFStringRef theString) Returns the number (in terms of UTF-16 code pairs) of Unicode characters in a string.CFStringGetMaximumSizeForEncoding
(CoreFoundation.CFIndex length, int encoding) Returns the maximum number of bytes a string of a specified length (in Unicode characters) will take up if encoded in a specified encoding.
-
Felddetails
-
INSTANCE
-
kCFNotFound
static final int kCFNotFound- Siehe auch:
-
kCFStringEncodingASCII
static final int kCFStringEncodingASCII- Siehe auch:
-
kCFStringEncodingUTF8
static final int kCFStringEncodingUTF8- Siehe auch:
-
ARRAY_TYPE_ID
-
BOOLEAN_TYPE_ID
-
DATA_TYPE_ID
-
DATE_TYPE_ID
-
DICTIONARY_TYPE_ID
-
NUMBER_TYPE_ID
-
STRING_TYPE_ID
-
-
Methodendetails
-
CFStringCreateWithCharacters
CoreFoundation.CFStringRef CFStringCreateWithCharacters(CoreFoundation.CFAllocatorRef alloc, char[] chars, CoreFoundation.CFIndex length) Creates a string from a buffer of Unicode characters.This reference must be released with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
to avoid leaking references.- Parameter:
alloc
- The allocator to use to allocate memory for the new string. Passnull
orkCFAllocatorDefault
to use the current default allocator.chars
- The buffer of Unicode characters to copy into the new string.length
- The number of characters in the buffer pointed to by chars. Only this number of characters will be copied to internal storage.- Gibt zurück:
- An immutable string containing
chars
, ornull
if there was a problem creating the object.
-
CFNumberCreate
CoreFoundation.CFNumberRef CFNumberCreate(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex theType, ByReference valuePtr) Creates aCFNumber
object using a specified value.This reference must be released with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
to avoid leaking references.- Parameter:
alloc
- The allocator to use to allocate memory for the new object. Passnull
orkCFAllocatorDefault
to use the current default allocator.theType
- A constant that specifies the data type of the value to convert. The ordinal value of the enum.The
theType
parameter is not necessarily preserved when creating a newCFNumber
object. TheCFNumber
object will be created using whatever internal storage type the creation function deems appropriate. Use the functionCFNumberGetType(com.sun.jna.platform.mac.CoreFoundation.CFNumberRef)
to find out what type theCFNumber
object used to store your value.valuePtr
- A pointer to the value for the returned number object.- Gibt zurück:
- A new number with the value specified by
valuePtr
.
-
CFArrayCreate
CoreFoundation.CFArrayRef CFArrayCreate(CoreFoundation.CFAllocatorRef alloc, Pointer values, CoreFoundation.CFIndex numValues, Pointer callBacks) Creates a new immutable array with the given values.This reference must be released with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
to avoid leaking references.- Parameter:
alloc
- The allocator to use to allocate memory for the new array and its storage for values. Passnull
orkCFAllocatorDefault
to use the current default allocator.values
- A C array of the pointer-sized values to be in the new array. The values in the new array are ordered in the same order in which they appear in this C array. This value may benull
ifnumValues
is 0. This C array is not changed or freed by this function. Ifvalues
is not a valid pointer to a C array of at leastnumValues
elements, the behavior is undefined.numValues
- The number of values to copy from thevalues
C array into the new array. This number will be the count of the new array—it must not be negative or greater than the number of elements in values.callBacks
- A pointer to aCFArrayCallBacks
structure initialized with the callbacks for the array to use on each value in the collection. The retain callback is used within this function, for example, to retain all of the new values from thevalues
C array. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.This value may be
null
, which is treated as if a valid structure of version 0 with all fieldsnull
had been passed in.- Gibt zurück:
- A new immutable array containing
numValues
fromvalues
, ornull
if there was a problem creating the object.
-
CFDataCreate
CoreFoundation.CFDataRef CFDataCreate(CoreFoundation.CFAllocatorRef alloc, Pointer bytes, CoreFoundation.CFIndex length) Creates an immutableCFData
object using data copied from a specified byte buffer.This reference must be released with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
to avoid leaking references.- Parameter:
alloc
- The allocator to use to allocate memory for the new object. Passnull
orkCFAllocatorDefault
to use the current default allocator.bytes
- A pointer to the byte buffer that contains the raw data to be copied into the Data.length
- The number of bytes in the buffer (bytes
).- Gibt zurück:
- A new
CFData
object, ornull
if there was a problem creating the object.
-
CFDictionaryCreateMutable
CoreFoundation.CFMutableDictionaryRef CFDictionaryCreateMutable(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex capacity, Pointer keyCallBacks, Pointer valueCallBacks) Creates a new mutable dictionary.This reference must be released with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
to avoid leaking references.- Parameter:
alloc
- The allocator to use to allocate memory for the new string. Passnull
orkCFAllocatorDefault
to use the current default allocator.capacity
- The maximum number of key-value pairs that can be contained by the new dictionary. The dictionary starts empty and can grow to this number of key-value pairs (and it can have less).Pass 0 to specify that the maximum capacity is not limited. The value must not be negative.
keyCallBacks
- A pointer to aCFDictionaryKeyCallBacks
structure initialized with the callbacks to use to retain, release, describe, and compare keys in the dictionary. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.This value may be
null
, which is treated as a valid structure of version 0 with all fieldsnull
.valueCallBacks
- A pointer to aCFDictionaryValueCallBacks
structure initialized with the callbacks to use to retain, release, describe, and compare values in the dictionary. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.This value may be
null
, which is treated as a valid structure of version 0 with all fieldsnull
.- Gibt zurück:
- A new dictionary, or
null
if there was a problem creating the object.
-
CFCopyDescription
Returns a textual description of a Core Foundation object.The nature of the description differs by object. For example, a description of a CFArray object would include descriptions of each of the elements in the collection.
You can use this function for debugging Core Foundation objects in your code. Note, however, that the description for a given object may be different in different releases of the operating system. Do not create dependencies in your code on the content or format of the information returned by this function.
- Parameter:
cf
- TheCFType
object (a generic reference of typeCFTypeRef
) from which to derive a description.- Gibt zurück:
- A string that contains a description of
cf
.
-
CFRelease
Releases a Core Foundation object.If the retain count of
cf
becomes zero the memory allocated to the object is deallocated and the object is destroyed. If you create, copy, or explicitly retain (see theCFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
function) a Core Foundation object, you are responsible for releasing it when you no longer need it.- Parameter:
cf
- ACFType
object to release. This value must not benull
.
-
CFRetain
Retains a Core Foundation object. You should retain a Core Foundation object when you receive it from elsewhere (that is, you did not create or copy it) and you want it to persist.If you retain a Core Foundation object you are responsible for releasing it with
CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
.- Parameter:
cf
- TheCFType
object to retain. This value must not benull
.- Gibt zurück:
- The input value, {code cf}.
-
CFGetRetainCount
Returns the reference count of a Core Foundation object.- Parameter:
cf
- TheCFType
object to examine.- Gibt zurück:
- A number representing the reference count of {code cf}.
-
CFDictionaryGetCount
Returns the number of key-value pairs in a dictionary.- Parameter:
theDict
- The dictionary to examine.- Gibt zurück:
- The number of key-value pairs in theDict.
-
CFDictionaryGetValue
Returns the value associated with a given key.- Parameter:
theDict
- The dictionary to examine.key
- The key for which to find a match intheDict
. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback wasnull
, the key is treated as a pointer and converted to an integer. If the equal callback wasnull
, pointer equality (in C, ==) is used. Ifkey
, or any of the keys intheDict
, is not understood by the equal callback, the behavior is undefined.- Gibt zurück:
- The value associated with key in
theDict
, ornull
if no key-value pair matching key exists. Sincenull
is also a valid value in some dictionaries, useCFDictionaryGetValueIfPresent(com.sun.jna.platform.mac.CoreFoundation.CFDictionaryRef, com.sun.jna.PointerType, com.sun.jna.ptr.PointerByReference)
to distinguish between a value that is not found, and anull
value.
-
CFDictionaryGetValueIfPresent
byte CFDictionaryGetValueIfPresent(CoreFoundation.CFDictionaryRef theDict, PointerType key, PointerByReference value) Returns a boolean value that indicates whether a given value for a given key is in a dictionary, and returns that value indirectly if it exists.- Parameter:
theDict
- The dictionary to examine.key
- The key for which to find a match intheDict
. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback wasnull
, the key is treated as a pointer and converted to an integer. If the equal callback wasnull
, pointer equality (in C, ==) is used. Ifkey
, or any of the keys intheDict
, is not understood by the equal callback, the behavior is undefined.value
- A pointer to memory which, on return, is filled with the pointer-sized value if a matching key is found. If no key match is found, the contents of the storage pointed to by this parameter are undefined. This value may benull
, in which case the value from the dictionary is not returned (but the return value of this function still indicates whether or not the key-value pair was present).- Gibt zurück:
- 1 if a matching key was found, otherwise 0.
-
CFDictionarySetValue
void CFDictionarySetValue(CoreFoundation.CFMutableDictionaryRef theDict, PointerType key, PointerType value) Sets the value corresponding to a given key.- Parameter:
theDict
- The dictionary to modify. If this parameter is a fixed-capacity dictionary and it is full before this operation, and the key does not exist in the dictionary, the behavior is undefined.key
- The key of the value to set intheDict
. If a key which matcheskey
is already present in the dictionary, only the value for the key is changed ("add if absent, replace if present"). If no key matcheskey
, the key-value pair is added to the dictionary.If a key-value pair is added, both key and value are retained by the dictionary, using the retain callback provided when
theDict
was created.key
must be of the type expected by the key retain callback.value
- The value to add to or replace intheDict
.value
is retained using the value retain callback provided whentheDict
was created, and the previous value if any is released.value
must be of the type expected by the retain and release callbacks.
-
CFStringGetCString
byte CFStringGetCString(CoreFoundation.CFStringRef theString, Pointer bufferToFill, CoreFoundation.CFIndex bufferSize, int encoding) Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.- Parameter:
theString
- The string whose contents you wish to access.bufferToFill
- The C string buffer into which to copy the string. On return, the buffer contains the converted characters. If there is an error in conversion, the buffer contains only partial results.The buffer must be large enough to contain the converted characters and a NUL terminator.
bufferSize
- The length ofbuffer
in bytes.encoding
- The string encoding to which the character contents oftheString
should be converted. The encoding must specify an 8-bit encoding.- Gibt zurück:
- 1 upon success or 0 if the conversion fails or the provided buffer is too small.
-
CFBooleanGetValue
Returns the value of aCFBoolean
object.- Parameter:
bool
- The boolean to examine.- Gibt zurück:
- 1 if the value of
bool
istrue
, 0 otherwise.
-
CFArrayGetCount
Returns the number of values currently in an array.- Parameter:
theArray
- aCoreFoundation.CFArrayRef
object.- Gibt zurück:
- The number of values in
array
.
-
CFArrayGetValueAtIndex
Retrieves a value at a given index.- Parameter:
theArray
- The array to examine.idx
- The index of the value to retrieve. If the index is outside the index space oftheArray
(0 to N-1 inclusive (where N is the count oftheArray
)), the behavior is undefined.- Gibt zurück:
- The value at the
idx
index intheArray
).
-
CFNumberGetType
Returns the type used by aCFNumber
object to store its value.- Parameter:
number
- TheCFNumber
object to examine.- Gibt zurück:
- A constant that indicates the data type of the value contained in
number. See
CoreFoundation.CFNumberType
for a list of possible values.
-
CFNumberGetValue
byte CFNumberGetValue(CoreFoundation.CFNumberRef number, CoreFoundation.CFIndex theType, ByReference valuePtr) Obtains the value of aCFNumber
object cast to a specified type.- Parameter:
number
- TheCFNumber
object to examine.theType
- A constant that specifies the data type to return. SeeCoreFoundation.CFNumberType
for a list of possible values.valuePtr
- On return, contains the value ofnumber
.- Gibt zurück:
- 1 if the operation was successful, otherwise 0.
-
CFStringGetLength
Returns the number (in terms of UTF-16 code pairs) of Unicode characters in a string.- Parameter:
theString
- The string to examine.- Gibt zurück:
- The number (in terms of UTF-16 code pairs) of characters stored in
theString
.
-
CFStringGetMaximumSizeForEncoding
CoreFoundation.CFIndex CFStringGetMaximumSizeForEncoding(CoreFoundation.CFIndex length, int encoding) Returns the maximum number of bytes a string of a specified length (in Unicode characters) will take up if encoded in a specified encoding.- Parameter:
length
- The number of Unicode characters to evaluate.encoding
- The string encoding for the number of characters specified by length.- Gibt zurück:
- The maximum number of bytes that could be needed to represent length
number of Unicode characters with the string encoding encoding, or
kCFNotFound
if the number exceedsLong.MAX_VALUE
.
-
CFEqual
Determines whether two Core Foundation objects are considered equal.- Parameter:
cf1
- A CFType object to compare to cf2.cf2
- A CFType object to compare to cf1.- Gibt zurück:
- true if cf1 and cf2 are of the same type and considered equal, otherwise false.
-
CFAllocatorGetDefault
CoreFoundation.CFAllocatorRef CFAllocatorGetDefault()Gets the default allocator object for the current thread.- Gibt zurück:
- A reference to the default allocator for the current thread. If none
has been explicitly set, returns the generic system allocator.
The default allocator can never be released, so it is not necessary to
CFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)
this reference.
-
CFDataGetLength
Returns the number of bytes contained by aCFData
object.- Parameter:
theData
- TheCFData
object to examine.- Gibt zurück:
- An index that specifies the number of bytes in
theData
.
-
CFDataGetBytePtr
Returns a read-only pointer to the bytes of aCFData
object.- Parameter:
theData
- TheCFData
object to examine.- Gibt zurück:
- A read-only pointer to the bytes associated with
theData
.
-
CFGetTypeID
Returns the type of aCFType
object.- Parameter:
theObject
- TheCFData
object to examine.- Gibt zurück:
- A value of type
CoreFoundation.CFTypeID
that identifies the opaque type ofcf
.
-
CFGetTypeID
Returns the type of aCFType
object presented as a pointer. Allows to inspect object type without creating aCoreFoundation.CFTypeRef
wrapper.- Parameter:
theObject
- The pointer toCFData
object to examine.- Gibt zurück:
- A value of type
CoreFoundation.CFTypeID
that identifies the opaque type ofcf
.
-
CFArrayGetTypeID
CoreFoundation.CFTypeID CFArrayGetTypeID()- Gibt zurück:
- The type identifier for the
CFArray
opaque type.
-
CFBooleanGetTypeID
CoreFoundation.CFTypeID CFBooleanGetTypeID()- Gibt zurück:
- The type identifier for the
CFBoolean
opaque type.
-
CFDateGetTypeID
CoreFoundation.CFTypeID CFDateGetTypeID()- Gibt zurück:
- The type identifier for the
CFDate
opaque type.
-
CFDataGetTypeID
CoreFoundation.CFTypeID CFDataGetTypeID()- Gibt zurück:
- The type identifier for the
CFData
opaque type.CFMutableData
objects have the same type identifier asCFData
objects.
-
CFDictionaryGetTypeID
CoreFoundation.CFTypeID CFDictionaryGetTypeID()- Gibt zurück:
- The type identifier for the
CFDictionary
opaque type.CFMutableDictionary
objects have the same type identifier asCFDictionary
objects.
-
CFNumberGetTypeID
CoreFoundation.CFTypeID CFNumberGetTypeID()- Gibt zurück:
- The type identifier for the
CFNumber
opaque type.
-
CFStringGetTypeID
CoreFoundation.CFTypeID CFStringGetTypeID()- Gibt zurück:
- The type identifier for the
CFString
opaque type.
-