File: CoreFoundation.pxi

package info (click to toggle)
python-enable 4.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,280 kB
  • ctags: 13,899
  • sloc: cpp: 48,447; python: 28,502; ansic: 9,004; makefile: 315; sh: 44
file content (181 lines) | stat: -rw-r--r-- 6,995 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# :Author:    Robert Kern
# :Copyright: 2004, Enthought, Inc.
# :License:   BSD Style


cdef extern from "CoreFoundation/CoreFoundation.h":
    ctypedef int OSStatus

    cdef enum:
        noErr

    ctypedef enum CFStringEncoding:
        kCFStringEncodingMacRoman = 0
        kCFStringEncodingWindowsLatin1 = 0x0500
        kCFStringEncodingISOLatin1 = 0x0201
        kCFStringEncodingNextStepLatin = 0x0B01
        kCFStringEncodingASCII = 0x0600
        kCFStringEncodingUnicode = 0x0100
        kCFStringEncodingUTF8 = 0x08000100
        kCFStringEncodingNonLossyASCII = 0x0BFF

    ctypedef unsigned char UInt8
    ctypedef unsigned short UniChar
    ctypedef int bool
    ctypedef bool Boolean

    ctypedef void* CFTypeRef
    ctypedef unsigned int CFTypeID

    void CFRelease(CFTypeRef cf)

    ctypedef CFTypeRef CFStringRef

    ctypedef unsigned int CFIndex
    ctypedef CFIndex CFNumberType

    ctypedef unsigned long CFHashCode
    ctypedef struct CFRange:
        CFIndex location
        CFIndex length

    CFRange CFRangeMake(CFIndex location, CFIndex length)

    CFStringRef CFStringCreateWithCString(void* alloc, char* cStr,
        CFStringEncoding encoding)
    char* CFStringGetCStringPtr(CFStringRef string, CFStringEncoding encoding)
    Boolean CFStringGetCString(CFStringRef theString, char* buffer,
        CFIndex bufferSize, CFStringEncoding encoding)
    CFIndex CFStringGetLength(CFStringRef theString)
    void CFStringGetCharacters(CFStringRef theString, CFRange range, UniChar *buffer)

    ctypedef enum CFURLPathStyle:
        kCFURLPOSIXPathStyle = 0
        kCFURLHFSPathStyle = 1
        kCFURLWindowsPathStyle = 2

    ctypedef CFTypeRef CFURLRef

    CFURLRef CFURLCreateWithFileSystemPath(void* allocator,
        CFStringRef filePath, CFURLPathStyle pathStyle, bool isDirectory)
    void CFShow(CFTypeRef cf)
    CFTypeID CFGetTypeID(CFTypeRef cf)
    
    ctypedef struct CFArrayCallBacks:
        CFIndex version
        #CFArrayRetainCallBack retain
        #CFArrayReleaseCallBack release
        #CFArrayCopyDescriptionCallBack copyDescription
        #CFArrayEqualCallBack equal
    
    cdef CFArrayCallBacks kCFTypeArrayCallBacks
    #ctypedef void (*CFArrayApplierFunction)(void *value, void *context)
    ctypedef CFTypeRef CFArrayRef
    ctypedef CFTypeRef CFMutableArrayRef
    
    CFArrayRef CFArrayCreate(void* allocator, void **values,
        CFIndex numValues, CFArrayCallBacks *callBacks)
    CFArrayRef CFArrayCreateCopy(void* allocator, CFArrayRef theArray)
    CFMutableArrayRef CFArrayCreateMutable(void* allocator, CFIndex capacity,
        CFArrayCallBacks *callBacks)
    CFMutableArrayRef CFArrayCreateMutableCopy(void* allocator, CFIndex capacity,
        CFArrayRef theArray)
    CFIndex CFArrayGetCount(CFArrayRef theArray)
    CFIndex CFArrayGetCountOfValue(CFArrayRef theArray, CFRange range,
        void *value)
    Boolean CFArrayContainsValue(CFArrayRef theArray, CFRange range,
        void *value)
    void *CFArrayGetValueAtIndex(CFArrayRef theArray, CFIndex idx)
    void CFArrayGetValues(CFArrayRef theArray, CFRange range, void **values)
    #void CFArrayApplyFunction(CFArrayRef theArray, CFRange range,
    #    CFArrayApplierFunction applier, void *context)
    CFIndex CFArrayGetFirstIndexOfValue(CFArrayRef theArray, CFRange range,
        void *value)
    CFIndex CFArrayGetLastIndexOfValue(CFArrayRef theArray, CFRange range,
        void *value)
    #CFIndex CFArrayBSearchValues(CFArrayRef theArray, CFRange range,
    #    void *value, CFComparatorFunction comparator, void *context)
    void CFArrayAppendValue(CFMutableArrayRef theArray, void *value)
    void CFArrayInsertValueAtIndex(CFMutableArrayRef theArray, CFIndex idx,
        void *value)
    void CFArraySetValueAtIndex(CFMutableArrayRef theArray, CFIndex idx,
        void *value)
    void CFArrayRemoveValueAtIndex(CFMutableArrayRef theArray, CFIndex idx)
    void CFArrayRemoveAllValues(CFMutableArrayRef theArray)
    void CFArrayReplaceValues(CFMutableArrayRef theArray, CFRange range,
        void **newValues, CFIndex newCount)
    void CFArrayExchangeValuesAtIndices(CFMutableArrayRef theArray,
        CFIndex idx1, CFIndex idx2)
    #void CFArraySortValues(CFMutableArrayRef theArray, CFRange range,
    #    CFComparatorFunction comparator, void *context)
    void CFArrayAppendArray(CFMutableArrayRef theArray, CFArrayRef otherArray,
        CFRange otherRange)


    ctypedef CFTypeRef CFDictionaryRef
    ctypedef CFTypeRef CFMutableDictionaryRef

    ctypedef struct CFDictionaryKeyCallBacks:
        CFIndex version
        #CFDictionaryRetainCallBack retain
        #CFDictionaryReleaseCallBack release
        #CFDictionaryCopyDescriptionCallBack copyDescription
        #CFDictionaryEqualCallBack equal
        #CFDictionaryHashCallBack hash
    
    ctypedef struct CFDictionaryValueCallBacks:
        CFIndex version
        #CFDictionaryRetainCallBack retain
        #CFDictionaryReleaseCallBack release
        #CFDictionaryCopyDescriptionCallBack copyDescription
        #CFDictionaryEqualCallBack equal

    cdef CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks
    cdef CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks

    CFDictionaryRef CFDictionaryCreate(void* allocator,
        void** keys, void** values, CFIndex numValues,
        CFDictionaryKeyCallBacks* keyCallBacks,
        CFDictionaryValueCallBacks* valueCallBacks)    
    CFMutableDictionaryRef CFDictionaryCreateMutable(void* allocator,
        CFIndex capacity, CFDictionaryKeyCallBacks *keyCallBacks,
        CFDictionaryValueCallBacks *valueCallBacks)
    void CFDictionaryAddValue(CFMutableDictionaryRef theDict, void *key, void *value)
    void CFDictionarySetValue(CFMutableDictionaryRef theDict, void *key, void *value)

    ctypedef CFTypeRef CFAttributedStringRef
    ctypedef CFTypeRef CFMutableAttributedStringRef

    CFAttributedStringRef CFAttributedStringCreate(void* alloc,
        CFStringRef str, CFDictionaryRef attributes)
    CFMutableAttributedStringRef CFAttributedStringCreateMutable(void* alloc,
        CFIndex maxLength)
    void CFAttributedStringReplaceString(CFMutableAttributedStringRef aStr,
        CFRange range, CFStringRef replacement)
    void CFAttributedStringSetAttribute(CFMutableAttributedStringRef aStr,
        CFRange range, CFStringRef attrName, CFTypeRef value)

    ctypedef CFTypeRef CFNumberRef
    
    ctypedef enum CFNumberType_:
        kCFNumberSInt8Type = 1
        kCFNumberSInt16Type = 2
        kCFNumberSInt32Type = 3
        kCFNumberSInt64Type = 4
        kCFNumberFloat32Type = 5
        kCFNumberFloat64Type = 6
        kCFNumberCharType = 7
        kCFNumberShortType = 8
        kCFNumberIntType = 9
        kCFNumberLongType = 10
        kCFNumberLongLongType = 11
        kCFNumberFloatType = 12
        kCFNumberDoubleType = 13
        kCFNumberCFIndexType = 14

    CFNumberRef CFNumberCreate(void* allocator, CFNumberType theType, void *valuePtr)