forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFoundationHelpers.mm
84 lines (73 loc) · 3.06 KB
/
FoundationHelpers.mm
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
//===--- FoundationHelpers.mm - Cocoa framework helper shims --------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file contains shims to refer to framework functions required by the
// standard library. The stdlib cannot directly import these modules without
// introducing circular dependencies.
//
//===----------------------------------------------------------------------===//
#import <CoreFoundation/CoreFoundation.h>
extern "C"
void _swift_stdlib_CFStringGetCharacters(CFStringRef theString,
CFRange range,
UniChar *buffer) {
return CFStringGetCharacters(theString, range, buffer);
}
extern "C"
const UniChar * _swift_stdlib_CFStringGetCharactersPtr(CFStringRef theString) {
return CFStringGetCharactersPtr(theString);
}
extern "C"
CFIndex _swift_stdlib_CFStringGetLength(CFStringRef theString) {
return CFStringGetLength(theString);
}
extern "C"
CFStringRef _swift_stdlib_CFStringCreateWithSubstring(CFAllocatorRef alloc,
CFStringRef str,
CFRange range) {
return CFStringCreateWithSubstring(alloc, str, range);
}
extern "C"
UniChar _swift_stdlib_CFStringGetCharacterAtIndex(CFStringRef theString,
CFIndex idx) {
return CFStringGetCharacterAtIndex(theString, idx);
}
extern "C"
CFStringRef
_swift_stdlib_CFStringCreateCopy(CFAllocatorRef alloc,
CFStringRef theString) {
return CFStringCreateCopy(alloc, theString);
}
extern "C"
const char *_swift_stdlib_CFStringGetCStringPtr(CFStringRef theString,
CFStringEncoding encoding) {
return CFStringGetCStringPtr(theString, encoding);
}
extern "C" CFComparisonResult
_swift_stdlib_CFStringCompare(CFStringRef theString1,
CFStringRef theString2,
CFStringCompareFlags compareOptions) {
return CFStringCompare(theString1, theString2, compareOptions);
}
extern "C" Boolean
_swift_stdlib_CFStringFindWithOptions(CFStringRef theString,
CFStringRef stringToFind,
CFRange rangeToSearch,
CFStringCompareFlags searchOptions,
CFRange *result) {
return CFStringFindWithOptions(theString, stringToFind, rangeToSearch,
searchOptions, result);
}
extern "C" CFStringRef
_swift_stdlib_objcDebugDescription(id __nonnull nsObject) {
return (__bridge CFStringRef)[nsObject debugDescription];
}