Mercurial > projects > dstep
comparison dstep/corefoundation/CFStream.d @ 11:07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 01 Aug 2009 15:03:28 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
10:27e00625790b | 11:07194b026fa4 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Jul 12, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.corefoundation.CFStream; | |
8 | |
9 import dstep.corefoundation.CFBase; | |
10 import dstep.corefoundation.CFDictionary; | |
11 import dstep.corefoundation.CFError; | |
12 import dstep.corefoundation.CFRunLoop; | |
13 import dstep.corefoundation.CFSocket; | |
14 import dstep.corefoundation.CFString; | |
15 import dstep.corefoundation.CFURL; | |
16 import dstep.objc.bridge.Bridge; | |
17 import dstep.objc.objc : id; | |
18 | |
19 alias int CFStreamStatus; | |
20 alias uint CFStreamEventType; | |
21 struct __CFReadStream; | |
22 alias __CFReadStream* CFReadStreamRef; | |
23 struct __CFWriteStream; | |
24 alias __CFWriteStream* CFWriteStreamRef; | |
25 alias int CFStreamErrorDomain; | |
26 | |
27 extern (C) | |
28 { | |
29 alias void function (CFWriteStreamRef, uint, void*) CFWriteStreamClientCallBack; | |
30 alias void function (CFReadStreamRef, uint, void*) CFReadStreamClientCallBack; | |
31 } | |
32 | |
33 extern (C) | |
34 { | |
35 extern | |
36 { | |
37 const CFStringRef kCFStreamPropertyDataWritten; | |
38 const CFStringRef kCFStreamPropertyAppendToFile; | |
39 const CFStringRef kCFStreamPropertyFileCurrentOffset; | |
40 const CFStringRef kCFStreamPropertySocketNativeHandle; | |
41 const CFStringRef kCFStreamPropertySocketRemoteHostName; | |
42 const CFStringRef kCFStreamPropertySocketRemotePortNumber; | |
43 } | |
44 } | |
45 | |
46 enum | |
47 { | |
48 kCFStreamStatusNotOpen = 0, | |
49 kCFStreamStatusOpening, | |
50 kCFStreamStatusOpen, | |
51 kCFStreamStatusReading, | |
52 kCFStreamStatusWriting, | |
53 kCFStreamStatusAtEnd, | |
54 kCFStreamStatusClosed, | |
55 kCFStreamStatusError | |
56 } | |
57 | |
58 enum | |
59 { | |
60 kCFStreamEventNone = 0, | |
61 kCFStreamEventOpenCompleted = 1, | |
62 kCFStreamEventHasBytesAvailable = 2, | |
63 kCFStreamEventCanAcceptBytes = 4, | |
64 kCFStreamEventErrorOccurred = 8, | |
65 kCFStreamEventEndEncountered = 16 | |
66 } | |
67 | |
68 enum | |
69 { | |
70 kCFStreamErrorDomainCustom = -1, | |
71 kCFStreamErrorDomainPOSIX = 1, | |
72 kCFStreamErrorDomainMacOSStatus | |
73 } | |
74 | |
75 struct CFStreamClientContext | |
76 { | |
77 int version_; | |
78 void* info; | |
79 } | |
80 | |
81 | |
82 struct CFStreamError | |
83 { | |
84 int domain; | |
85 int error; | |
86 } | |
87 | |
88 extern (C) | |
89 { | |
90 uint CFReadStreamGetTypeID (); | |
91 uint CFWriteStreamGetTypeID (); | |
92 CFReadStreamRef CFReadStreamCreateWithBytesNoCopy (CFAllocatorRef alloc, char* bytes, int length, CFAllocatorRef bytesDeallocator); | |
93 CFWriteStreamRef CFWriteStreamCreateWithBuffer (CFAllocatorRef alloc, char* buffer, int bufferCapacity); | |
94 CFWriteStreamRef CFWriteStreamCreateWithAllocatedBuffers (CFAllocatorRef alloc, CFAllocatorRef bufferAllocator); | |
95 CFReadStreamRef CFReadStreamCreateWithFile (CFAllocatorRef alloc, CFURLRef fileURL); | |
96 CFWriteStreamRef CFWriteStreamCreateWithFile (CFAllocatorRef alloc, CFURLRef fileURL); | |
97 void CFStreamCreateBoundPair (CFAllocatorRef alloc, CFReadStreamRef* readStream, CFWriteStreamRef* writeStream, int transferBufferSize); | |
98 void CFStreamCreatePairWithSocket (CFAllocatorRef alloc, int sock, CFReadStreamRef* readStream, CFWriteStreamRef* writeStream); | |
99 void CFStreamCreatePairWithSocketToHost (CFAllocatorRef alloc, CFStringRef host, uint port, CFReadStreamRef* readStream, CFWriteStreamRef* writeStream); | |
100 void CFStreamCreatePairWithPeerSocketSignature (CFAllocatorRef alloc, CFSocketSignature* signature, CFReadStreamRef* readStream, CFWriteStreamRef* writeStream); | |
101 int CFReadStreamGetStatus (CFReadStreamRef stream); | |
102 int CFWriteStreamGetStatus (CFWriteStreamRef stream); | |
103 CFErrorRef CFReadStreamCopyError (CFReadStreamRef stream); | |
104 CFErrorRef CFWriteStreamCopyError (CFWriteStreamRef stream); | |
105 ubyte CFReadStreamOpen (CFReadStreamRef stream); | |
106 ubyte CFWriteStreamOpen (CFWriteStreamRef stream); | |
107 void CFReadStreamClose (CFReadStreamRef stream); | |
108 void CFWriteStreamClose (CFWriteStreamRef stream); | |
109 ubyte CFReadStreamHasBytesAvailable (CFReadStreamRef stream); | |
110 int CFReadStreamRead (CFReadStreamRef stream, char* buffer, int bufferLength); | |
111 char* CFReadStreamGetBuffer (CFReadStreamRef stream, int maxBytesToRead, int* numBytesRead); | |
112 ubyte CFWriteStreamCanAcceptBytes (CFWriteStreamRef stream); | |
113 int CFWriteStreamWrite (CFWriteStreamRef stream, char* buffer, int bufferLength); | |
114 void* CFReadStreamCopyProperty (CFReadStreamRef stream, CFStringRef propertyName); | |
115 void* CFWriteStreamCopyProperty (CFWriteStreamRef stream, CFStringRef propertyName); | |
116 ubyte CFReadStreamSetProperty (CFReadStreamRef stream, CFStringRef propertyName, void* propertyValue); | |
117 ubyte CFWriteStreamSetProperty (CFWriteStreamRef stream, CFStringRef propertyName, void* propertyValue); | |
118 ubyte CFReadStreamSetClient (CFReadStreamRef stream, uint streamEvents, CFReadStreamClientCallBack* clientCB, CFStreamClientContext* clientContext); | |
119 ubyte CFWriteStreamSetClient (CFWriteStreamRef stream, uint streamEvents, CFWriteStreamClientCallBack* clientCB, CFStreamClientContext* clientContext); | |
120 void CFReadStreamScheduleWithRunLoop (CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode); | |
121 void CFWriteStreamScheduleWithRunLoop (CFWriteStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode); | |
122 void CFReadStreamUnscheduleFromRunLoop (CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode); | |
123 void CFWriteStreamUnscheduleFromRunLoop (CFWriteStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode); | |
124 CFStreamError CFReadStreamGetError (CFReadStreamRef stream); | |
125 CFStreamError CFWriteStreamGetError (CFWriteStreamRef stream); | |
126 } |