forked from swiftlang/swift-corelibs-foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForSwiftFoundationOnly.h
216 lines (172 loc) · 10 KB
/
ForSwiftFoundationOnly.h
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
#ifndef __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__
#define __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ 1
#define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
#define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#include <CoreFoundation/CFBase.h>
#include <CoreFoundation/CFNumber.h>
#include <CoreFoundation/CFLocaleInternal.h>
#include <CoreFoundation/CFCalendar.h>
#import <fts.h>
NS_ASSUME_NONNULL_BEGIN
struct __CFSwiftObject {
uintptr_t isa;
};
typedef struct __CFSwiftObject *CFSwiftRef;
#define CF_IS_SWIFT(type, obj) (_CFIsSwift(type, (CFSwiftRef)obj))
#define CF_SWIFT_FUNCDISPATCHV(type, ret, obj, fn, ...) do { \
if (CF_IS_SWIFT(type, obj)) { \
return (ret)__CFSwiftBridge.fn((CFSwiftRef)obj, ##__VA_ARGS__); \
} \
} while (0)
extern bool _CFIsSwift(CFTypeID type, CFSwiftRef obj);
extern void _CFDeinit(CFTypeRef cf);
struct _NSObjectBridge {
CFTypeID (*_cfTypeID)(CFTypeRef object);
CFHashCode (*hash)(CFTypeRef object);
bool (*isEqual)(CFTypeRef object, CFTypeRef other);
};
struct _NSArrayBridge {
CFIndex (*_Nonnull count)(CFTypeRef obj);
_Nonnull CFTypeRef (*_Nonnull objectAtIndex)(CFTypeRef obj, CFIndex index);
void (*_Nonnull getObjects)(CFTypeRef array, CFRange range, CFTypeRef _Nonnull * _Nonnull values);
};
struct _NSMutableArrayBridge {
void (*addObject)(CFTypeRef array, CFTypeRef value);
void (*setObject)(CFTypeRef array, CFTypeRef value, CFIndex idx);
void (*replaceObjectAtIndex)(CFTypeRef array, CFIndex idx, CFTypeRef value);
void (*insertObject)(CFTypeRef array, CFIndex idx, CFTypeRef value);
void (*exchangeObjectAtIndex)(CFTypeRef array, CFIndex idx1, CFIndex idx2);
void (*removeObjectAtIndex)(CFTypeRef array, CFIndex idx);
void (*removeAllObjects)(CFTypeRef array);
void (*replaceObjectsInRange)(CFTypeRef array, CFRange range, CFTypeRef _Nonnull * _Nonnull newValues, CFIndex newCount);
};
struct _NSDictionaryBridge {
CFIndex (*count)(CFTypeRef dictionary);
CFIndex (*countForKey)(CFTypeRef dictionary, CFTypeRef key);
bool (*containsKey)(CFTypeRef dictionary, CFTypeRef key);
_Nullable CFTypeRef (*_Nonnull objectForKey)(CFTypeRef dictionary, CFTypeRef key);
bool (*_getValueIfPresent)(CFTypeRef dictionary, CFTypeRef key, CFTypeRef _Nonnull * _Nullable value);
CFIndex (*__getValue)(CFTypeRef dictionary, CFTypeRef value, CFTypeRef key);
bool (*containsObject)(CFTypeRef dictionary, CFTypeRef value);
CFIndex (*countForObject)(CFTypeRef dictionary, CFTypeRef value);
void (*getObjects)(CFTypeRef dictionary, CFTypeRef _Nonnull * _Nonnull valuebuf, CFTypeRef _Nonnull * _Nonnull keybuf);
void (*__apply)(CFTypeRef dictionary, void (*applier)(CFTypeRef key, CFTypeRef value, void *context), void *context);
};
struct _NSMutableDictionaryBridge {
void (*__addObject)(CFTypeRef dictionary, CFTypeRef key, CFTypeRef value);
void (*replaceObject)(CFTypeRef dictionary, CFTypeRef key, CFTypeRef value);
void (*__setObject)(CFTypeRef dictionary, CFTypeRef key, CFTypeRef value);
void (*removeObjectForKey)(CFTypeRef dictionary, CFTypeRef key);
void (*removeAllObjects)(CFTypeRef dictionary);
};
struct _NSSetBridge {
};
struct _NSMutableSetBridge {
};
struct _NSStringBridge {
_Nonnull CFTypeRef (*_Nonnull _createSubstringWithRange)(CFTypeRef str, CFRange range);
_Nonnull CFTypeRef (*_Nonnull copy)(CFTypeRef str);
_Nonnull CFTypeRef (*_Nonnull mutableCopy)(CFTypeRef str);
CFIndex (*length)(CFTypeRef str);
UniChar (*characterAtIndex)(CFTypeRef str, CFIndex idx);
void (*getCharacters)(CFTypeRef str, CFRange range, UniChar *buffer);
CFIndex (*__getBytes)(CFTypeRef str, CFRange range, uint8_t *buffer, CFIndex maxBufLen, CFIndex *usedBufLen);
const char *_Nullable (*_Nonnull _fastCStringContents)(CFTypeRef str);
const UniChar *_Nullable (*_Nonnull _fastCharacterContents)(CFTypeRef str);
bool (*_getCString)(CFTypeRef str, char *buffer, size_t len, UInt32 encoding);
};
struct _NSMutableStringBridge {
void (*insertString)(CFTypeRef str, CFIndex idx, CFTypeRef inserted);
void (*deleteCharactersInRange)(CFTypeRef str, CFRange range);
void (*replaceCharactersInRange)(CFTypeRef str, CFRange range, CFTypeRef replacement);
void (*setString)(CFTypeRef str, CFTypeRef replacement);
void (*appendString)(CFTypeRef str, CFTypeRef appended);
void (*appendCharacters)(CFTypeRef str, const UniChar *chars, CFIndex appendLength);
void (*_cfAppendCString)(CFTypeRef str, const char *chars, CFIndex appendLength);
};
struct _CFSwiftBridge {
struct _NSObjectBridge NSObject;
struct _NSArrayBridge NSArray;
struct _NSMutableArrayBridge NSMutableArray;
struct _NSDictionaryBridge NSDictionary;
struct _NSMutableDictionaryBridge NSMutableDictionary;
struct _NSSetBridge NSSet;
struct _NSMutableSetBridge NSMutableSet;
struct _NSStringBridge NSString;
struct _NSMutableStringBridge NSMutableString;
};
__attribute__((__visibility__("hidden"))) extern struct _CFSwiftBridge __CFSwiftBridge;
extern void _CFRuntimeBridgeTypeToClass(CFTypeID type, const void *isa);
extern void _CFNumberInitBool(CFNumberRef result, Boolean value);
extern void _CFNumberInitInt8(CFNumberRef result, int8_t value);
extern void _CFNumberInitUInt8(CFNumberRef result, uint8_t value);
extern void _CFNumberInitInt16(CFNumberRef result, int16_t value);
extern void _CFNumberInitUInt16(CFNumberRef result, uint16_t value);
extern void _CFNumberInitInt32(CFNumberRef result, int32_t value);
extern void _CFNumberInitUInt32(CFNumberRef result, uint32_t value);
extern void _CFNumberInitInt(CFNumberRef result, long value);
extern void _CFNumberInitUInt(CFNumberRef result, unsigned long value);
extern void _CFNumberInitInt64(CFNumberRef result, int64_t value);
extern void _CFNumberInitUInt64(CFNumberRef result, uint64_t value);
extern void _CFNumberInitFloat(CFNumberRef result, float value);
extern void _CFNumberInitDouble(CFNumberRef result, double value);
extern void _CFURLInitWithFileSystemPathRelativeToBase(CFURLRef url, CFStringRef fileSystemPath, CFURLPathStyle pathStyle, Boolean isDirectory, _Nullable CFURLRef baseURL);
extern Boolean _CFURLInitWithURLString(CFURLRef url, CFStringRef string, Boolean checkForLegalCharacters, _Nullable CFURLRef baseURL);
extern Boolean _CFURLInitAbsoluteURLWithBytes(CFURLRef url, const UInt8 *relativeURLBytes, CFIndex length, CFStringEncoding encoding, _Nullable CFURLRef baseURL);
extern CFIndex __CFProcessorCount();
extern uint64_t __CFMemorySize();
extern CFIndex __CFActiveProcessorCount();
extern CFDictionaryRef __CFGetEnvironment();
extern int32_t __CFGetPid();
extern void _CFDataInit(CFMutableDataRef memory, CFOptionFlags flags, CFIndex capacity, const uint8_t *bytes, CFIndex length, Boolean noCopy);
extern int32_t _CF_SOCK_STREAM();
extern CFStringRef CFCopySystemVersionString(void);
extern Boolean _CFCalendarInitWithIdentifier(CFCalendarRef calendar, CFStringRef identifier);
extern Boolean _CFCalendarComposeAbsoluteTimeV(CFCalendarRef calendar, /* out */ CFAbsoluteTime *atp, const char *componentDesc, int32_t *vector, int32_t count);
extern Boolean _CFCalendarDecomposeAbsoluteTimeV(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, int32_t *_Nonnull * _Nonnull vector, int32_t count);
extern Boolean _CFCalendarAddComponentsV(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *atp, CFOptionFlags options, const char *componentDesc, int32_t *vector, int32_t count);
extern Boolean _CFCalendarGetComponentDifferenceV(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, int32_t *_Nonnull * _Nonnull vector, int32_t count);
extern Boolean _CFCalendarIsWeekend(CFCalendarRef calendar, CFAbsoluteTime at);
typedef struct {
CFTimeInterval onsetTime;
CFTimeInterval ceaseTime;
CFIndex start;
CFIndex end;
} _CFCalendarWeekendRange;
extern Boolean _CFCalendarGetNextWeekend(CFCalendarRef calendar, _CFCalendarWeekendRange *range);
extern Boolean _CFLocaleInit(CFLocaleRef locale, CFStringRef identifier);
extern Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, _Nullable CFDataRef data);
extern Boolean _CFCharacterSetInitWithCharactersInRange(CFMutableCharacterSetRef cset, CFRange theRange);
extern Boolean _CFCharacterSetInitWithCharactersInString(CFMutableCharacterSetRef cset, CFStringRef theString);
extern Boolean _CFCharacterSetInitMutable(CFMutableCharacterSetRef cset);
extern Boolean _CFCharacterSetInitWithBitmapRepresentation(CFMutableCharacterSetRef cset, CFDataRef theData);
extern CFIndex __CFCharDigitValue(UniChar ch);
extern CFTimeInterval CFGetSystemUptime(void);
extern int _CFOpenFileWithMode(const char *path, int opts, mode_t mode);
extern int _CFOpenFile(const char *path, int opts);
extern void *_CFReallocf(void *ptr, size_t size);
typedef unsigned char __cf_uuid[16];
typedef char __cf_uuid_string[37];
typedef __cf_uuid _cf_uuid_t;
typedef __cf_uuid_string _cf_uuid_string_t;
extern void _cf_uuid_clear(_cf_uuid_t uu);
extern int _cf_uuid_compare(const _cf_uuid_t uu1, const _cf_uuid_t uu2);
extern void _cf_uuid_copy(_cf_uuid_t dst, const _cf_uuid_t src);
extern void _cf_uuid_generate(_cf_uuid_t out);
extern void _cf_uuid_generate_random(_cf_uuid_t out);
extern void _cf_uuid_generate_time(_cf_uuid_t out);
extern int _cf_uuid_is_null(const _cf_uuid_t uu);
extern int _cf_uuid_parse(const _cf_uuid_string_t in, _cf_uuid_t uu);
extern void _cf_uuid_unparse(const _cf_uuid_t uu, _cf_uuid_string_t out);
extern void _cf_uuid_unparse_lower(const _cf_uuid_t uu, _cf_uuid_string_t out);
extern void _cf_uuid_unparse_upper(const _cf_uuid_t uu, _cf_uuid_string_t out);
NS_ASSUME_NONNULL_END
#endif /* __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ */