Skip to content

Commit 173e9ea

Browse files
authored
Merge pull request #709 from phausler/cflite-import
2 parents 9a5d842 + df77599 commit 173e9ea

File tree

180 files changed

+16136
-125521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+16136
-125521
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* CFNotificationCenter.h
2+
Copyright (c) 1998-2016, Apple Inc. and the Swift project authors
3+
4+
Portions Copyright (c) 2014-2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
See http://swift.org/LICENSE.txt for license information
7+
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8+
*/
9+
10+
#if !defined(__COREFOUNDATION_CFNOTIFICATIONCENTER__)
11+
#define __COREFOUNDATION_CFNOTIFICATIONCENTER__ 1
12+
13+
#include <CoreFoundation/CFBase.h>
14+
#include <CoreFoundation/CFDictionary.h>
15+
16+
CF_IMPLICIT_BRIDGING_ENABLED
17+
CF_EXTERN_C_BEGIN
18+
19+
typedef CFStringRef CFNotificationName CF_EXTENSIBLE_STRING_ENUM;
20+
21+
typedef struct CF_BRIDGED_MUTABLE_TYPE(id) __CFNotificationCenter * CFNotificationCenterRef;
22+
23+
typedef void (*CFNotificationCallback)(CFNotificationCenterRef center, void *observer, CFNotificationName name, const void *object, CFDictionaryRef userInfo);
24+
25+
typedef CF_ENUM(CFIndex, CFNotificationSuspensionBehavior) {
26+
CFNotificationSuspensionBehaviorDrop = 1,
27+
// The server will not queue any notifications with this name and object while the process/app is in the background.
28+
CFNotificationSuspensionBehaviorCoalesce = 2,
29+
// The server will only queue the last notification of the specified name and object; earlier notifications are dropped.
30+
CFNotificationSuspensionBehaviorHold = 3,
31+
// The server will hold all matching notifications until the queue has been filled (queue size determined by the server) at which point the server may flush queued notifications.
32+
CFNotificationSuspensionBehaviorDeliverImmediately = 4
33+
// The server will deliver notifications matching this registration whether or not the process is in the background. When a notification with this suspension behavior is matched, it has the effect of first flushing any queued notifications.
34+
};
35+
36+
CF_EXPORT CFTypeID CFNotificationCenterGetTypeID(void);
37+
38+
CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetLocalCenter(void);
39+
40+
#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32
41+
CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void);
42+
#endif
43+
44+
CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetDarwinNotifyCenter(void);
45+
// The Darwin Notify Center is based on the <notify.h> API.
46+
// For this center, there are limitations in the API. There are no notification "objects",
47+
// "userInfo" cannot be passed in the notification, and there are no suspension behaviors
48+
// (always "deliver immediately"). Other limitations in the <notify.h> API as described in
49+
// that header will also apply.
50+
// - In the CFNotificationCallback, the 'object' and 'userInfo' parameters must be ignored.
51+
// - CFNotificationCenterAddObserver(): the 'object' and 'suspensionBehavior' arguments are ignored.
52+
// - CFNotificationCenterAddObserver(): the 'name' argument may not be NULL (for this center).
53+
// - CFNotificationCenterRemoveObserver(): the 'object' argument is ignored.
54+
// - CFNotificationCenterPostNotification(): the 'object', 'userInfo', and 'deliverImmediately' arguments are ignored.
55+
// - CFNotificationCenterPostNotificationWithOptions(): the 'object', 'userInfo', and 'options' arguments are ignored.
56+
// The Darwin Notify Center has no notion of per-user sessions, all notifications are system-wide.
57+
// As with distributed notifications, the main thread's run loop must be running in one of the
58+
// common modes (usually kCFRunLoopDefaultMode) for Darwin-style notifications to be delivered.
59+
// NOTE: NULL or 0 should be passed for all ignored arguments to ensure future compatibility.
60+
61+
62+
CF_EXPORT void CFNotificationCenterAddObserver(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior);
63+
64+
CF_EXPORT void CFNotificationCenterRemoveObserver(CFNotificationCenterRef center, const void *observer, CFNotificationName name, const void *object);
65+
CF_EXPORT void CFNotificationCenterRemoveEveryObserver(CFNotificationCenterRef center, const void *observer);
66+
67+
CF_EXPORT void CFNotificationCenterPostNotification(CFNotificationCenterRef center, CFNotificationName name, const void *object, CFDictionaryRef userInfo, Boolean deliverImmediately);
68+
69+
CF_ENUM(CFOptionFlags) {
70+
kCFNotificationDeliverImmediately = (1UL << 0),
71+
kCFNotificationPostToAllSessions = (1UL << 1)
72+
};
73+
74+
CF_EXPORT void CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterRef center, CFNotificationName name, const void *object, CFDictionaryRef userInfo, CFOptionFlags options);
75+
76+
77+
CF_EXTERN_C_END
78+
CF_IMPLICIT_BRIDGING_DISABLED
79+
80+
#endif /* ! __COREFOUNDATION_CFNOTIFICATIONCENTER__ */
81+

CoreFoundation/AppServices.subproj/CFUserNotification.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// This source file is part of the Swift.org open source project
2-
//
3-
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
4-
// Licensed under Apache License v2.0 with Runtime Library Exception
5-
//
6-
// See http://swift.org/LICENSE.txt for license information
7-
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8-
//
9-
10-
111
/* CFUserNotification.c
12-
Copyright (c) 2000-2015, Apple Inc. All rights reserved.
2+
Copyright (c) 2000-2016, Apple Inc. All rights reserved.
3+
4+
Portions Copyright (c) 2014-2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
See http://swift.org/LICENSE.txt for license information
7+
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
138
Original Author: Doug Davidson
149
Responsibility: Kevin Perry
1510
*/

CoreFoundation/AppServices.subproj/CFUserNotification.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// This source file is part of the Swift.org open source project
2-
//
3-
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
4-
// Licensed under Apache License v2.0 with Runtime Library Exception
5-
//
6-
// See http://swift.org/LICENSE.txt for license information
7-
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8-
//
9-
10-
111
/* CFUserNotification.h
12-
Copyright (c) 2000-2015, Apple Inc. All rights reserved.
2+
Copyright (c) 2000-2016, Apple Inc. and the Swift project authors
3+
4+
Portions Copyright (c) 2014-2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
See http://swift.org/LICENSE.txt for license information
7+
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
138
*/
149

1510
#if !defined(__COREFOUNDATION_CFUSERNOTIFICATION__)

CoreFoundation/Base.subproj/CFAvailability.h

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// This source file is part of the Swift.org open source project
2-
//
3-
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
4-
// Licensed under Apache License v2.0 with Runtime Library Exception
5-
//
6-
// See http://swift.org/LICENSE.txt for license information
7-
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8-
//
9-
10-
111
/* CFAvailability.h
12-
Copyright (c) 2013 - 2015 Apple Inc. and the Swift project authors
2+
Copyright (c) 2013-2016, Apple Inc. and the Swift project authors
3+
4+
Portions Copyright (c) 2014-2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
See http://swift.org/LICENSE.txt for license information
7+
See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
138
*/
149

1510
#if !defined(__COREFOUNDATION_CFAVAILABILITY__)
@@ -21,12 +16,18 @@
2116
#include <TargetConditionals.h>
2217
#endif
2318

19+
#if DEPLOYMENT_RUNTIME_SWIFT
20+
#define API_AVAILABLE(...)
21+
#define API_DEPRECATED(...)
22+
#else
2423
#if (TARGET_OS_MAC || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32)
2524
#include <Availability.h>
25+
#include <os/availability.h>
2626

2727
// Even if unused, these must remain here for compatibility, because projects rely on them being included.
2828
#include <AvailabilityMacros.h>
2929
#endif
30+
#endif
3031

3132
#ifndef __has_feature
3233
#define __has_feature(x) 0
@@ -138,7 +139,27 @@ CF_ENUM(CFIndex) {
138139
...
139140
};
140141
*/
141-
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM)(__VA_ARGS__)
142+
#define CF_ENUM(...) __CF_ENUM_GET_MACRO(__VA_ARGS__, __CF_NAMED_ENUM, __CF_ANON_ENUM, )(__VA_ARGS__)
143+
144+
#if __has_attribute(swift_wrapper)
145+
#define _CF_TYPED_ENUM __attribute__((swift_wrapper(enum)))
146+
#else
147+
#define _CF_TYPED_ENUM
148+
#endif
149+
150+
#if __has_attribute(swift_wrapper)
151+
#define _CF_TYPED_EXTENSIBLE_ENUM __attribute__((swift_wrapper(struct)))
152+
#else
153+
#define _CF_TYPED_EXTENSIBLE_ENUM
154+
#endif
155+
156+
#if DEPLOYMENT_RUNTIME_SWIFT
157+
#define CF_STRING_ENUM
158+
#define CF_EXTENSIBLE_STRING_ENUM
159+
#else
160+
#define CF_STRING_ENUM _CF_TYPED_ENUM
161+
#define CF_EXTENSIBLE_STRING_ENUM _CF_TYPED_EXTENSIBLE_ENUM
162+
#endif
142163

143164
// Extension availability macros
144165
#define CF_EXTENSION_UNAVAILABLE(_msg) __OS_EXTENSION_UNAVAILABLE(_msg)

0 commit comments

Comments
 (0)