forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThunks.mm
112 lines (101 loc) · 3.4 KB
/
Thunks.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
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
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#import <Foundation/Foundation.h>
extern "C" void
NS_Swift_NSUndoManager_registerUndoWithTargetHandler(
id NS_RELEASES_ARGUMENT __nonnull self_,
id NS_RELEASES_ARGUMENT __nonnull target,
void (^__nonnull handler)(id __nonnull)) {
NSUndoManager *undoManager = self_;
[undoManager registerUndoWithTarget:target handler:handler];
[self_ release];
[target release];
[handler release];
}
// -- NSCoder
extern "C" NS_RETURNS_RETAINED __nullable id
NS_Swift_NSCoder_decodeObject(id NS_RELEASES_ARGUMENT __nonnull self_,
NSError *__nullable *__nullable error) {
NSCoder *coder = (NSCoder *)self_;
id result = nil;
if (error) {
result = [coder decodeTopLevelObjectAndReturnError:error];
} else {
result = [coder decodeObject];
}
[self_ release];
return [result retain];
}
extern "C" NS_RETURNS_RETAINED __nullable id
NS_Swift_NSCoder_decodeObjectForKey(id NS_RELEASES_ARGUMENT __nonnull self_,
id NS_RELEASES_ARGUMENT __nonnull key,
NSError *__nullable *__nullable error) {
NSCoder *coder = (NSCoder *)self_;
id result = nil;
if (error) {
result = [coder decodeTopLevelObjectForKey:key error:error];
} else {
result = [coder decodeObjectForKey:key];
}
[self_ release];
[key release];
return [result retain];
}
extern "C" NS_RETURNS_RETAINED __nullable id
NS_Swift_NSCoder_decodeObjectOfClassForKey(
id NS_RELEASES_ARGUMENT __nonnull self_,
id NS_RELEASES_ARGUMENT __nonnull cls,
id NS_RELEASES_ARGUMENT __nonnull key,
NSError *__nullable *__nullable error) {
NSCoder *coder = (NSCoder *)self_;
id result = nil;
if (error) {
result = [coder decodeTopLevelObjectOfClass:cls forKey:key error:error];
} else {
result = [coder decodeObjectOfClass:cls forKey:key];
}
[self_ release];
[key release];
return [result retain];
}
extern "C" NS_RETURNS_RETAINED __nullable id
NS_Swift_NSCoder_decodeObjectOfClassesForKey(
id NS_RELEASES_ARGUMENT __nonnull self_,
NSSet *NS_RELEASES_ARGUMENT __nullable classes,
id NS_RELEASES_ARGUMENT __nonnull key,
NSError *__nullable *__nullable error) {
NSCoder *coder = (NSCoder *)self_;
id result = nil;
if (error) {
result = [coder decodeTopLevelObjectOfClasses:classes forKey:key error:error];
} else {
result = [coder decodeObjectOfClasses:classes forKey:key];
}
[self_ release];
[classes release];
[key release];
return [result retain];
}
// -- NSKeyedUnarchiver
extern "C" NS_RETURNS_RETAINED __nullable id
NS_Swift_NSKeyedUnarchiver_unarchiveObjectWithData(
Class Self_, id NS_RELEASES_ARGUMENT __nonnull data,
NSError *__nullable *__nullable error) {
id result = nil;
if (error) {
result = [Self_ unarchiveTopLevelObjectWithData:data error:error];
} else {
result = [Self_ unarchiveObjectWithData:data];
}
[data release];
return [result retain];
}