guard 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +17 -0
- data/README.md +50 -30
- data/bin/fsevent_watch_guard_guard +0 -0
- data/lib/guard.rb +44 -26
- data/lib/guard/cli.rb +23 -6
- data/lib/guard/dsl.rb +33 -15
- data/lib/guard/listener.rb +1 -1
- data/lib/guard/listeners/darwin.rb +1 -1
- data/lib/guard/notifier.rb +3 -1
- data/lib/guard/notifiers/notifysend.rb +81 -0
- data/lib/guard/version.rb +1 -1
- data/lib/guard/version.rbc +180 -0
- data/lib/vendor/darwin/README.rdoc +3 -2
- data/lib/vendor/darwin/bin/fsevent_watch +0 -0
- data/lib/vendor/darwin/ext/fsevent_watch/Info.plist +38 -0
- data/lib/vendor/darwin/ext/fsevent_watch/LICENSE +21 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj +254 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.c +394 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.h +74 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.c +160 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.h +45 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/common.h +34 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.c +20 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.h +40 -0
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/main.c +509 -0
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Common.xcconfig +82 -0
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Debug.xcconfig +19 -0
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Release.xcconfig +23 -0
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig +17 -0
- data/lib/vendor/darwin/ext/rakefile.rb +47 -0
- data/lib/vendor/darwin/ext/rb-fsevent.xcconfig +33 -0
- data/lib/vendor/darwin/lib/rb-fsevent/version.rb +1 -1
- data/lib/vendor/darwin/rb-fsevent.gemspec +3 -2
- data/lib/vendor/darwin/spec/spec_helper.rb +1 -2
- metadata +40 -25
- data/lib/vendor/darwin/ext/extconf.rb +0 -64
- data/lib/vendor/darwin/ext/fsevent/fsevent_watch.c +0 -226
@@ -0,0 +1,394 @@
|
|
1
|
+
//
|
2
|
+
// TSICTString.c
|
3
|
+
// TSITString
|
4
|
+
//
|
5
|
+
// Created by Travis Tilley on 9/27/11.
|
6
|
+
//
|
7
|
+
|
8
|
+
#include "TSICTString.h"
|
9
|
+
|
10
|
+
|
11
|
+
const char* const TNetstringTypes = ",#^!~}]Z";
|
12
|
+
const char* const OTNetstringTypes = ",#^!~{[Z";
|
13
|
+
const UInt8 TNetstringSeparator = ':';
|
14
|
+
|
15
|
+
TSITStringFormat TSITStringDefaultFormat = kTSITStringFormatTNetstring;
|
16
|
+
|
17
|
+
static const CFRange BeginningRange = {0,0};
|
18
|
+
|
19
|
+
static CFTypeID kCFDataTypeID = -1UL;
|
20
|
+
static CFTypeID kCFStringTypeID = -1UL;
|
21
|
+
static CFTypeID kCFNumberTypeID = -1UL;
|
22
|
+
static CFTypeID kCFBooleanTypeID = -1UL;
|
23
|
+
static CFTypeID kCFNullTypeID = -1UL;
|
24
|
+
static CFTypeID kCFArrayTypeID = -1UL;
|
25
|
+
static CFTypeID kCFDictionaryTypeID = -1UL;
|
26
|
+
|
27
|
+
|
28
|
+
__attribute__((constructor)) void Init_TSICTString(void)
|
29
|
+
{
|
30
|
+
kCFDataTypeID = CFDataGetTypeID();
|
31
|
+
kCFStringTypeID = CFStringGetTypeID();
|
32
|
+
kCFNumberTypeID = CFNumberGetTypeID();
|
33
|
+
kCFBooleanTypeID = CFBooleanGetTypeID();
|
34
|
+
kCFNullTypeID = CFNullGetTypeID();
|
35
|
+
kCFArrayTypeID = CFArrayGetTypeID();
|
36
|
+
kCFDictionaryTypeID = CFDictionaryGetTypeID();
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
void TSICTStringSetDefaultFormat(TSITStringFormat format)
|
41
|
+
{
|
42
|
+
if (format == kTSITStringFormatDefault) {
|
43
|
+
TSITStringDefaultFormat = kTSITStringFormatTNetstring;
|
44
|
+
} else {
|
45
|
+
TSITStringDefaultFormat = format;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
TSITStringFormat TSICTStringGetDefaultFormat(void)
|
50
|
+
{
|
51
|
+
return TSITStringDefaultFormat;
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
void TSICTStringDestroy(TStringIRep* rep)
|
56
|
+
{
|
57
|
+
CFRelease(rep->data);
|
58
|
+
free(rep->length);
|
59
|
+
free(rep);
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
static inline TStringIRep* TSICTStringCreateWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
|
64
|
+
{
|
65
|
+
if (format == kTSITStringFormatDefault) {
|
66
|
+
format = TSICTStringGetDefaultFormat();
|
67
|
+
}
|
68
|
+
|
69
|
+
TStringIRep* rep = calloc(1, sizeof(TStringIRep));
|
70
|
+
rep->data = CFDataCreateCopy(kCFAllocatorDefault, data);
|
71
|
+
rep->type = type;
|
72
|
+
rep->format = format;
|
73
|
+
rep->length = calloc(10, sizeof(char));
|
74
|
+
|
75
|
+
CFIndex len = CFDataGetLength(rep->data);
|
76
|
+
if (snprintf(rep->length, 10, "%lu", len)) {
|
77
|
+
return rep;
|
78
|
+
} else {
|
79
|
+
TSICTStringDestroy(rep);
|
80
|
+
return NULL;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
static inline CFDataRef TSICTStringCreateDataFromIntermediateRepresentation(TStringIRep* rep)
|
85
|
+
{
|
86
|
+
CFIndex len = CFDataGetLength(rep->data);
|
87
|
+
CFMutableDataRef buffer = CFDataCreateMutableCopy(kCFAllocatorDefault, (len + 12), rep->data);
|
88
|
+
UInt8* bufferBytes = CFDataGetMutableBytePtr(buffer);
|
89
|
+
|
90
|
+
size_t prefixLength = strlen(rep->length) + 1;
|
91
|
+
CFDataReplaceBytes(buffer, BeginningRange, (const UInt8*)rep->length, (CFIndex)prefixLength);
|
92
|
+
|
93
|
+
if (rep->format == kTSITStringFormatTNetstring) {
|
94
|
+
const UInt8 ftag = (UInt8)TNetstringTypes[rep->type];
|
95
|
+
CFDataAppendBytes(buffer, &ftag, 1);
|
96
|
+
bufferBytes[(prefixLength - 1)] = TNetstringSeparator;
|
97
|
+
} else if (rep->format == kTSITStringFormatOTNetstring) {
|
98
|
+
const UInt8 ftag = (UInt8)OTNetstringTypes[rep->type];
|
99
|
+
bufferBytes[(prefixLength - 1)] = ftag;
|
100
|
+
}
|
101
|
+
|
102
|
+
CFDataRef dataRep = CFDataCreateCopy(kCFAllocatorDefault, buffer);
|
103
|
+
CFRelease(buffer);
|
104
|
+
|
105
|
+
return dataRep;
|
106
|
+
}
|
107
|
+
|
108
|
+
static inline CFStringRef TSICTStringCreateStringFromIntermediateRepresentation(TStringIRep* rep)
|
109
|
+
{
|
110
|
+
CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
|
111
|
+
CFStringRef string = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, kCFStringEncodingUTF8);
|
112
|
+
CFRelease(data);
|
113
|
+
return string;
|
114
|
+
}
|
115
|
+
|
116
|
+
static inline CFDataRef TSICTStringCreateDataWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
|
117
|
+
{
|
118
|
+
CFRetain(data);
|
119
|
+
|
120
|
+
if (format == kTSITStringFormatDefault) {
|
121
|
+
format = TSICTStringGetDefaultFormat();
|
122
|
+
}
|
123
|
+
|
124
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, type, format);
|
125
|
+
if (rep == NULL) {
|
126
|
+
return NULL;
|
127
|
+
}
|
128
|
+
|
129
|
+
CFDataRef result = TSICTStringCreateDataFromIntermediateRepresentation(rep);
|
130
|
+
|
131
|
+
TSICTStringDestroy(rep);
|
132
|
+
CFRelease(data);
|
133
|
+
|
134
|
+
return result;
|
135
|
+
}
|
136
|
+
|
137
|
+
static inline void TSICTStringAppendObjectToMutableDataWithFormat(CFTypeRef object, CFMutableDataRef buffer, TSITStringFormat format)
|
138
|
+
{
|
139
|
+
if (object == NULL) {
|
140
|
+
object = kCFNull;
|
141
|
+
}
|
142
|
+
|
143
|
+
CFRetain(object);
|
144
|
+
|
145
|
+
TStringIRep* objRep = TSICTStringCreateWithObjectAndFormat(object, format);
|
146
|
+
CFDataRef objData = TSICTStringCreateDataFromIntermediateRepresentation(objRep);
|
147
|
+
CFDataAppendBytes(buffer, (CFDataGetBytePtr(objData)), CFDataGetLength(objData));
|
148
|
+
CFRelease(objData);
|
149
|
+
TSICTStringDestroy(objRep);
|
150
|
+
|
151
|
+
CFRelease(object);
|
152
|
+
}
|
153
|
+
|
154
|
+
static void ArrayBufferAppendCallback(const void* item, void* context)
|
155
|
+
{
|
156
|
+
TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
|
157
|
+
CFMutableDataRef buffer = cx->buffer;
|
158
|
+
TSITStringFormat format = cx->format;
|
159
|
+
|
160
|
+
TSICTStringAppendObjectToMutableDataWithFormat(item, buffer, format);
|
161
|
+
}
|
162
|
+
|
163
|
+
static void DictionaryBufferAppendCallback(const void* key, const void* value, void* context)
|
164
|
+
{
|
165
|
+
TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
|
166
|
+
CFMutableDataRef buffer = cx->buffer;
|
167
|
+
TSITStringFormat format = cx->format;
|
168
|
+
|
169
|
+
TSICTStringAppendObjectToMutableDataWithFormat(key, buffer, format);
|
170
|
+
TSICTStringAppendObjectToMutableDataWithFormat(value, buffer, format);
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
CFDataRef TSICTStringCreateRenderedData(TStringIRep* rep)
|
175
|
+
{
|
176
|
+
return TSICTStringCreateDataFromIntermediateRepresentation(rep);
|
177
|
+
}
|
178
|
+
|
179
|
+
CFDataRef TSICTStringCreateRenderedDataFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
|
180
|
+
{
|
181
|
+
if (object == NULL) {
|
182
|
+
object = kCFNull;
|
183
|
+
}
|
184
|
+
|
185
|
+
CFRetain(object);
|
186
|
+
|
187
|
+
TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
|
188
|
+
CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
|
189
|
+
|
190
|
+
TSICTStringDestroy(rep);
|
191
|
+
CFRelease(object);
|
192
|
+
|
193
|
+
return data;
|
194
|
+
}
|
195
|
+
|
196
|
+
CFStringRef TSICTStringCreateRenderedString(TStringIRep* rep)
|
197
|
+
{
|
198
|
+
return TSICTStringCreateStringFromIntermediateRepresentation(rep);
|
199
|
+
}
|
200
|
+
|
201
|
+
CFStringRef TSICTStringCreateRenderedStringFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
|
202
|
+
{
|
203
|
+
if (object == NULL) {
|
204
|
+
object = kCFNull;
|
205
|
+
}
|
206
|
+
|
207
|
+
CFRetain(object);
|
208
|
+
|
209
|
+
TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
|
210
|
+
CFStringRef string = TSICTStringCreateStringFromIntermediateRepresentation(rep);
|
211
|
+
|
212
|
+
TSICTStringDestroy(rep);
|
213
|
+
CFRelease(object);
|
214
|
+
|
215
|
+
return string;
|
216
|
+
}
|
217
|
+
|
218
|
+
|
219
|
+
TStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format)
|
220
|
+
{
|
221
|
+
if (object == NULL) {
|
222
|
+
return TSICTStringCreateNullWithFormat(format);
|
223
|
+
}
|
224
|
+
CFRetain(object);
|
225
|
+
|
226
|
+
CFTypeID cfType = CFGetTypeID(object);
|
227
|
+
TStringIRep* rep = NULL;
|
228
|
+
|
229
|
+
if (cfType == kCFDataTypeID) {
|
230
|
+
rep = TSICTStringCreateWithDataOfTypeAndFormat(object, kTSITStringTagString, format);
|
231
|
+
} else if (cfType == kCFStringTypeID) {
|
232
|
+
rep = TSICTStringCreateWithStringAndFormat(object, format);
|
233
|
+
} else if (cfType == kCFNumberTypeID) {
|
234
|
+
rep = TSICTStringCreateWithNumberAndFormat(object, format);
|
235
|
+
} else if (cfType == kCFBooleanTypeID) {
|
236
|
+
if (CFBooleanGetValue(object)) {
|
237
|
+
rep = TSICTStringCreateTrueWithFormat(format);
|
238
|
+
} else {
|
239
|
+
rep = TSICTStringCreateFalseWithFormat(format);
|
240
|
+
}
|
241
|
+
} else if (cfType == kCFNullTypeID) {
|
242
|
+
rep = TSICTStringCreateNullWithFormat(format);
|
243
|
+
} else if (cfType == kCFArrayTypeID) {
|
244
|
+
rep = TSICTStringCreateWithArrayAndFormat(object, format);
|
245
|
+
} else if (cfType == kCFDictionaryTypeID) {
|
246
|
+
rep = TSICTStringCreateWithDictionaryAndFormat(object, format);
|
247
|
+
} else {
|
248
|
+
rep = TSICTStringCreateInvalidWithFormat(format);
|
249
|
+
}
|
250
|
+
|
251
|
+
CFRelease(object);
|
252
|
+
return rep;
|
253
|
+
}
|
254
|
+
|
255
|
+
TStringIRep* TSICTStringCreateWithStringAndFormat(CFStringRef string, TSITStringFormat format)
|
256
|
+
{
|
257
|
+
CFRetain(string);
|
258
|
+
CFDataRef data = CFStringCreateExternalRepresentation(kCFAllocatorDefault, string, kCFStringEncodingUTF8, '?');
|
259
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagString, format);
|
260
|
+
CFRelease(data);
|
261
|
+
CFRelease(string);
|
262
|
+
return rep;
|
263
|
+
}
|
264
|
+
|
265
|
+
TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITStringFormat format)
|
266
|
+
{
|
267
|
+
CFRetain(number);
|
268
|
+
TSITStringTag tag = kTSITStringTagNumber;
|
269
|
+
CFDataRef data;
|
270
|
+
CFNumberType numType = CFNumberGetType(number);
|
271
|
+
|
272
|
+
switch(numType) {
|
273
|
+
case kCFNumberCharType:
|
274
|
+
{
|
275
|
+
int value;
|
276
|
+
if (CFNumberGetValue(number, kCFNumberIntType, &value)) {
|
277
|
+
if (value == 0 || value == 1) {
|
278
|
+
tag = kTSITStringTagBool;
|
279
|
+
} else {
|
280
|
+
tag = kTSITStringTagString;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
break;
|
284
|
+
}
|
285
|
+
case kCFNumberFloat32Type:
|
286
|
+
case kCFNumberFloat64Type:
|
287
|
+
case kCFNumberFloatType:
|
288
|
+
case kCFNumberDoubleType:
|
289
|
+
{
|
290
|
+
tag = kTSITStringTagFloat;
|
291
|
+
break;
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
if (tag == kTSITStringTagBool) {
|
296
|
+
bool value;
|
297
|
+
CFNumberGetValue(number, kCFNumberIntType, &value);
|
298
|
+
if (value) {
|
299
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
|
300
|
+
} else {
|
301
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
|
302
|
+
}
|
303
|
+
} else if (tag == kTSITStringTagFloat) {
|
304
|
+
char buf[32];
|
305
|
+
char *p, *e;
|
306
|
+
double value;
|
307
|
+
|
308
|
+
CFNumberGetValue(number, numType, &value);
|
309
|
+
sprintf(buf, "%#.15g", value);
|
310
|
+
|
311
|
+
e = buf + strlen(buf);
|
312
|
+
p = e;
|
313
|
+
while (p[-1]=='0' && ('0' <= p[-2] && p[-2] <= '9')) {
|
314
|
+
p--;
|
315
|
+
}
|
316
|
+
memmove(p, e, strlen(e)+1);
|
317
|
+
|
318
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
|
319
|
+
} else {
|
320
|
+
char buf[32];
|
321
|
+
SInt64 value;
|
322
|
+
CFNumberGetValue(number, numType, &value);
|
323
|
+
sprintf(buf, "%lli", value);
|
324
|
+
data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
|
325
|
+
}
|
326
|
+
|
327
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, tag, format);
|
328
|
+
CFRelease(data);
|
329
|
+
CFRelease(number);
|
330
|
+
return rep;
|
331
|
+
}
|
332
|
+
|
333
|
+
TStringIRep* TSICTStringCreateTrueWithFormat(TSITStringFormat format)
|
334
|
+
{
|
335
|
+
CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
|
336
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
|
337
|
+
CFRelease(data);
|
338
|
+
return rep;
|
339
|
+
}
|
340
|
+
|
341
|
+
TStringIRep* TSICTStringCreateFalseWithFormat(TSITStringFormat format)
|
342
|
+
{
|
343
|
+
CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
|
344
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
|
345
|
+
CFRelease(data);
|
346
|
+
return rep;
|
347
|
+
}
|
348
|
+
|
349
|
+
TStringIRep* TSICTStringCreateNullWithFormat(TSITStringFormat format)
|
350
|
+
{
|
351
|
+
CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
|
352
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagNull, format);
|
353
|
+
CFRelease(data);
|
354
|
+
return rep;
|
355
|
+
}
|
356
|
+
|
357
|
+
TStringIRep* TSICTStringCreateInvalidWithFormat(TSITStringFormat format)
|
358
|
+
{
|
359
|
+
CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
|
360
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagInvalid, format);
|
361
|
+
CFRelease(data);
|
362
|
+
return rep;
|
363
|
+
}
|
364
|
+
|
365
|
+
TStringIRep* TSICTStringCreateWithArrayAndFormat(CFArrayRef array, TSITStringFormat format)
|
366
|
+
{
|
367
|
+
CFRetain(array);
|
368
|
+
|
369
|
+
CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
370
|
+
|
371
|
+
CFRange all = CFRangeMake(0, CFArrayGetCount(array));
|
372
|
+
TStringCollectionCallbackContext cx = {buffer, format};
|
373
|
+
CFArrayApplyFunction(array, all, ArrayBufferAppendCallback, &cx);
|
374
|
+
|
375
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagList, format);
|
376
|
+
CFRelease(buffer);
|
377
|
+
CFRelease(array);
|
378
|
+
return rep;
|
379
|
+
}
|
380
|
+
|
381
|
+
TStringIRep* TSICTStringCreateWithDictionaryAndFormat(CFDictionaryRef dictionary, TSITStringFormat format)
|
382
|
+
{
|
383
|
+
CFRetain(dictionary);
|
384
|
+
|
385
|
+
CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
386
|
+
|
387
|
+
TStringCollectionCallbackContext cx = {buffer, format};
|
388
|
+
CFDictionaryApplyFunction(dictionary, DictionaryBufferAppendCallback, &cx);
|
389
|
+
|
390
|
+
TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagDict, format);
|
391
|
+
CFRelease(buffer);
|
392
|
+
CFRelease(dictionary);
|
393
|
+
return rep;
|
394
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
//
|
2
|
+
// TSICTString.h
|
3
|
+
// TSITString
|
4
|
+
//
|
5
|
+
// Created by Travis Tilley on 9/27/11.
|
6
|
+
//
|
7
|
+
|
8
|
+
#ifndef TSICTString_H
|
9
|
+
#define TSICTString_H
|
10
|
+
|
11
|
+
#include <CoreFoundation/CoreFoundation.h>
|
12
|
+
|
13
|
+
|
14
|
+
typedef enum {
|
15
|
+
kTSITStringTagString = 0,
|
16
|
+
kTSITStringTagNumber = 1,
|
17
|
+
kTSITStringTagFloat = 2,
|
18
|
+
kTSITStringTagBool = 3,
|
19
|
+
kTSITStringTagNull = 4,
|
20
|
+
kTSITStringTagDict = 5,
|
21
|
+
kTSITStringTagList = 6,
|
22
|
+
kTSITStringTagInvalid = 7,
|
23
|
+
} TSITStringTag;
|
24
|
+
|
25
|
+
extern const char* const TNetstringTypes;
|
26
|
+
extern const char* const OTNetstringTypes;
|
27
|
+
extern const UInt8 TNetstringSeparator;
|
28
|
+
|
29
|
+
typedef enum {
|
30
|
+
kTSITStringFormatDefault = 0,
|
31
|
+
kTSITStringFormatOTNetstring = 1,
|
32
|
+
kTSITStringFormatTNetstring = 2,
|
33
|
+
} TSITStringFormat;
|
34
|
+
|
35
|
+
extern TSITStringFormat TSITStringDefaultFormat;
|
36
|
+
|
37
|
+
typedef struct TSITStringIntermediate {
|
38
|
+
CFDataRef data;
|
39
|
+
char* length;
|
40
|
+
TSITStringTag type;
|
41
|
+
TSITStringFormat format;
|
42
|
+
} TStringIRep;
|
43
|
+
|
44
|
+
typedef struct {
|
45
|
+
CFMutableDataRef buffer;
|
46
|
+
TSITStringFormat format;
|
47
|
+
} TStringCollectionCallbackContext;
|
48
|
+
|
49
|
+
|
50
|
+
void Init_TSICTString(void);
|
51
|
+
|
52
|
+
void TSICTStringSetDefaultFormat(TSITStringFormat format);
|
53
|
+
TSITStringFormat TSICTStringGetDefaultFormat(void);
|
54
|
+
|
55
|
+
void TSICTStringDestroy(TStringIRep* rep);
|
56
|
+
|
57
|
+
CFDataRef TSICTStringCreateRenderedData(TStringIRep* rep);
|
58
|
+
CFDataRef TSICTStringCreateRenderedDataFromObjectWithFormat(CFTypeRef object, TSITStringFormat format);
|
59
|
+
|
60
|
+
CFStringRef TSICTStringCreateRenderedString(TStringIRep* rep);
|
61
|
+
CFStringRef TSICTStringCreateRenderedStringFromObjectWithFormat(CFTypeRef object, TSITStringFormat format);
|
62
|
+
|
63
|
+
TStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format);
|
64
|
+
TStringIRep* TSICTStringCreateWithStringAndFormat(CFStringRef string, TSITStringFormat format);
|
65
|
+
TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITStringFormat format);
|
66
|
+
TStringIRep* TSICTStringCreateTrueWithFormat(TSITStringFormat format);
|
67
|
+
TStringIRep* TSICTStringCreateFalseWithFormat(TSITStringFormat format);
|
68
|
+
TStringIRep* TSICTStringCreateNullWithFormat(TSITStringFormat format);
|
69
|
+
TStringIRep* TSICTStringCreateInvalidWithFormat(TSITStringFormat format);
|
70
|
+
TStringIRep* TSICTStringCreateWithArrayAndFormat(CFArrayRef array, TSITStringFormat format);
|
71
|
+
TStringIRep* TSICTStringCreateWithDictionaryAndFormat(CFDictionaryRef dictionary, TSITStringFormat format);
|
72
|
+
|
73
|
+
|
74
|
+
#endif
|