ObjFW
Toggle main menu visibility
Loading...
Searching...
No Matches
OFNotificationCenter.h
1
/*
2
* Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3
*
4
* All rights reserved.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License version 3.0 only,
8
* as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
* version 3.0 for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* version 3.0 along with this program. If not, see
17
* <https://www.gnu.org/licenses/>.
18
*/
19
20
#import "
OFObject.h
"
21
#import "
OFNotification.h
"
22
23
OF_ASSUME_NONNULL_BEGIN
24
25
@class
OFMutableDictionary
OF_GENERIC(KeyType, ObjectType);
26
27
#ifdef OF_HAVE_BLOCKS
33
typedef
void (^OFNotificationCenterBlock)(
OFNotification
*notification);
34
#endif
35
41
#ifndef OF_NOTIFICATION_CENTER_M
42
OF_SUBCLASSING_RESTRICTED
43
#endif
44
@interface
OFNotificationCenter
:
OFObject
45
{
46
OFMutableDictionary
*_handles;
47
}
48
49
#ifdef OF_HAVE_CLASS_PROPERTIES
50
@property
(
class
, readonly, nonatomic)
OFNotificationCenter
*defaultCenter;
51
#endif
52
56
+ (
OFNotificationCenter
*)defaultCenter;
57
70
- (void)addObserver: (
id
)observer
71
selector: (
SEL
)selector
72
name: (
OFNotificationName
)name
73
object: (nullable
id
)object;
74
84
- (void)removeObserver: (
id
)observer
85
selector: (
SEL
)selector
86
name: (
OFNotificationName
)name
87
object: (nullable
id
)object;
88
89
#ifdef OF_HAVE_BLOCKS
102
- (id)addObserverForName: (
OFNotificationName
)name
103
object: (nullable
id
)object
104
usingBlock: (OFNotificationCenterBlock)block;
105
112
- (void)removeObserver: (
id
)observer;
113
#endif
114
120
- (void)postNotification: (
OFNotification
*)notification;
121
128
- (void)postNotificationName: (
OFNotificationName
)name
129
object: (nullable
id
)object;
130
139
- (void)postNotificationName: (
OFNotificationName
)name
140
object: (nullable
id
)object
141
userInfo: (nullable
OFDictionary
*)userInfo;
142
@end
143
144
OF_ASSUME_NONNULL_END
OFNotification.h
OFNotificationName
OFConstantString * OFNotificationName
A name for a notification.
Definition
OFNotification.h:32
OFObject.h
OFDictionary
An abstract class for storing objects in a dictionary.
Definition
OFDictionary.h:85
OFMutableDictionary
An abstract class for storing and changing objects in a dictionary.
Definition
OFMutableDictionary.h:48
OFNotificationCenter
A class to send and register for notifications.
Definition
OFNotificationCenter.h:45
OFNotification
A class to represent a notification for or from OFNotificationCenter.
Definition
OFNotification.h:42
OFObject
The root class for all other classes inside ObjFW.
Definition
OFObject.h:956
src
OFNotificationCenter.h
Generated by
1.17.0