CFArray.h
authorPHO <pho@cielonegro.org>
Fri, 15 Oct 2010 13:40:17 +0000 (22:40 +0900)
committerPHO <pho@cielonegro.org>
Fri, 15 Oct 2010 13:40:17 +0000 (22:40 +0900)
Bindings/CoreFoundation/CFArray.hsc [new file with mode: 0644]
bindings-CoreFoundation.cabal
cbits/helper_CFArray.c [new file with mode: 0644]

diff --git a/Bindings/CoreFoundation/CFArray.hsc b/Bindings/CoreFoundation/CFArray.hsc
new file mode 100644 (file)
index 0000000..b60aaee
--- /dev/null
@@ -0,0 +1,49 @@
+#include <bindings.dsl.h>
+#include <CoreFoundation/CFArray.h>
+
+module Bindings.CoreFoundation.CFArray where
+#strict_import
+import Bindings.CoreFoundation.CFBase
+
+#callback CFArrayRetainCallBack         , <CFAllocatorRef> -> Ptr () -> IO (Ptr ())
+#callback CFArrayReleaseCallBack        , <CFAllocatorRef> -> Ptr () -> IO ()
+#callback CFArrayCopyDescriptionCallBack, Ptr () -> IO <CFStringRef>
+#callback CFArrayEqualCallBack          , Ptr () -> Ptr () -> IO <Boolean>
+#starttype CFArrayCallBacks
+#  field version        , <CFIndex>
+#  field retain         , <CFArrayRetainCallBack>
+#  field release        , <CFArrayReleaseCallBack>
+#  field copyDescription, <CFArrayEqualCallBack>
+#stoptype
+
+#cinline kCFTypeArrayCallBacks, IO (Ptr <CFArrayCallBacks>)
+
+#callback CFArrayApplierFunction, Ptr () -> Ptr () -> IO ()
+
+#opaque_t  __CFArray
+#synonym_t CFArrayRef       , Ptr <__CFArray>
+#synonym_t CFMutableArrayRef, Ptr <__CFArray>
+
+#ccall   CFArrayGetTypeID           , IO <CFTypeID>
+#ccall   CFArrayCreate              , <CFAllocatorRef> -> Ptr (Ptr ()) -> <CFIndex> -> Ptr <CFArrayCallBacks> -> IO <CFArrayRef>
+#ccall   CFArrayCreateCopy          , <CFAllocatorRef> -> <CFArrayRef> -> IO <CFArrayRef>
+#ccall   CFArrayCreateMutable       , <CFAllocatorRef> -> <CFIndex> -> Ptr <CFArrayCallBacks> -> IO <CFMutableArrayRef>
+#ccall   CFArrayCreateMutableCopy   , <CFAllocatorRef> -> <CFIndex> -> <CFArrayRef> -> IO <CFMutableArrayRef>
+#ccall   CFArrayGetCount            , <CFArrayRef> -> IO <CFIndex>
+#cinline CFArrayGetCountOfValue     , <CFArrayRef> -> Ptr <CFRange> -> Ptr () -> IO <CFIndex>
+#cinline CFArrayContainsValue       , <CFArrayRef> -> Ptr <CFRange> -> Ptr () -> IO <Boolean>
+#ccall   CFArrayGetValueAtIndex     , <CFArrayRef> -> <CFIndex> -> IO (Ptr ())
+#cinline CFArrayGetValues           , <CFArrayRef> -> Ptr <CFRange> -> Ptr (Ptr ()) -> IO ()
+#cinline CFArrayApplyFunction       , <CFArrayRef> -> Ptr <CFRange> -> <CFArrayApplierFunction> -> Ptr () -> IO ()
+#cinline CFArrayGetFirstIndexOfValue, <CFArrayRef> -> Ptr <CFRange> -> Ptr () -> IO <CFIndex>
+#cinline CFArrayGetLastIndexOfValue , <CFArrayRef> -> Ptr <CFRange> -> Ptr () -> IO <CFIndex>
+#cinline CFArrayBSearchValues       , <CFArrayRef> -> Ptr <CFRange> -> Ptr () -> <CFComparatorFunction> -> Ptr () -> IO <CFIndex>
+#ccall   CFArrayAppendValue         , <CFMutableArrayRef> -> Ptr () -> IO ()
+#ccall   CFArrayInsertValueAtIndex  , <CFMutableArrayRef> -> <CFIndex> -> Ptr () -> IO ()
+#ccall   CFArraySetValueAtIndex     , <CFMutableArrayRef> -> <CFIndex> -> Ptr () -> IO ()
+#ccall   CFArrayRemoveValueAtIndex  , <CFMutableArrayRef> -> <CFIndex> -> IO ()
+#ccall   CFArrayRemoveAllValues     , <CFMutableArrayRef> -> IO ()
+#cinline CFArrayReplaceValues       , <CFMutableArrayRef> -> Ptr <CFRange> -> Ptr (Ptr ()) -> <CFIndex> -> IO ()
+#ccall   CFArrayExchangeValuesAtIndices, <CFMutableArrayRef> -> <CFIndex> -> <CFIndex> -> IO ()
+#cinline CFArraySortValues          , <CFMutableArrayRef> -> Ptr <CFRange> -> <CFComparatorFunction> -> Ptr () -> IO ()
+#cinline CFArrayAppendArray         , <CFMutableArrayRef> -> <CFArrayRef> -> Ptr <CFRange> -> IO ()
index 3691af75f9c25494b3664c02626561bfa2bfc170..21c84cedc62a57177814efab6137ed3efdfac0eb 100644 (file)
@@ -29,9 +29,11 @@ Library
         CoreFoundation
 
     Exposed-Modules:
+        Bindings.CoreFoundation.CFArray
         Bindings.CoreFoundation.CFBase
 
     C-Sources:
+        cbits/helper_CFArray.c
         cbits/helper_CFBase.c
 
     Extensions:
diff --git a/cbits/helper_CFArray.c b/cbits/helper_CFArray.c
new file mode 100644 (file)
index 0000000..83309be
--- /dev/null
@@ -0,0 +1,82 @@
+#include <bindings.cmacros.h>
+#include <CoreFoundation/CFArray.h>
+
+const CFArrayCallBacks*
+inline_kCFTypeArrayCallBacks() {
+    return &kCFTypeArrayCallBacks;
+}
+
+CFIndex
+inline_CFArrayGetCountOfValue(CFArrayRef theArray,
+                              CFRange* range,
+                              const void* value) {
+    return CFArrayGetCountOfValue(theArray, *range, value);
+}
+
+Boolean
+inline_CFArrayContainsValue(CFArrayRef theArray,
+                            CFRange* range,
+                            const void* value) {
+    return CFArrayContainsValue(theArray, *range, value);
+}
+
+void
+inline_CFArrayGetValues(CFArrayRef theArray,
+                        CFRange* range,
+                        const void** values) {
+    return CFArrayGetValues(theArray, *range, values);
+}
+
+void
+inline_CFArrayApplyFunction(CFArrayRef theArray,
+                            CFRange* range,
+                            CFArrayApplierFunction applier,
+                            void* context) {
+    return CFArrayApplyFunction(theArray, *range, applier, context);
+}
+
+CFIndex
+inline_CFArrayGetFirstIndexOfValue(CFArrayRef theArray,
+                                   CFRange* range,
+                                   const void *value) {
+    return CFArrayGetFirstIndexOfValue(theArray, *range, value);
+}
+
+CFIndex
+inline_CFArrayGetLastIndexOfValue(CFArrayRef theArray,
+                                  CFRange* range,
+                                  const void *value) {
+    return CFArrayGetLastIndexOfValue(theArray, *range, value);
+}
+
+CFIndex
+inline_CFArrayBSearchValues(CFArrayRef theArray,
+                            CFRange* range,
+                            const void *value,
+                            CFComparatorFunction comparator,
+                            void *context) {
+    return CFArrayBSearchValues(theArray, *range, value, comparator, context);
+}
+
+void
+inline_CFArrayReplaceValues(CFMutableArrayRef theArray,
+                            CFRange* range,
+                            const void **newValues,
+                            CFIndex newCount) {
+    return CFArrayReplaceValues(theArray, *range, newValues, newCount);
+}
+
+void
+inline_CFArraySortValues(CFMutableArrayRef theArray,
+                         CFRange* range,
+                         CFComparatorFunction comparator,
+                         void *context) {
+    return CFArraySortValues(theArray, *range, comparator, context);
+}
+
+void
+inline_CFArrayAppendArray(CFMutableArrayRef theArray,
+                          CFArrayRef otherArray,
+                          CFRange* otherRange) {
+    return CFArrayAppendArray(theArray, otherArray, *otherRange);
+}