ObjFW
OFNotification.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2024 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 
22 OF_ASSUME_NONNULL_BEGIN
23 
26 @class OFConstantString;
27 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
28 
33 
41 {
42  OFNotificationName _name;
43  id _Nullable _object;
44  OFDictionary *_Nullable _userInfo;
45  OF_RESERVE_IVARS(OFNotification, 4)
46 }
47 
51 @property (readonly, nonatomic) OFNotificationName name;
52 
57 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) id object;
58 
62 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFDictionary *userInfo;
63 
72 + (instancetype)notificationWithName: (OFNotificationName)name
73  object: (nullable id)object;
74 
85 + (instancetype)notificationWithName: (OFNotificationName)name
86  object: (nullable id)object
87  userInfo: (nullable OFDictionary *)userInfo;
88 
98 - (instancetype)initWithName: (OFNotificationName)name
99  object: (nullable id)object;
100 
111 - (instancetype)initWithName: (OFNotificationName)name
112  object: (nullable id)object
113  userInfo: (nullable OFDictionary *)userInfo
114  OF_DESIGNATED_INITIALIZER;
115 
116 - (instancetype)init OF_UNAVAILABLE;
117 @end
118 
119 OF_ASSUME_NONNULL_END
A class to represent a notification for or from OFNotificationCenter.
Definition: OFNotification.h:40
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:41
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:82
OFConstantString * OFNotificationName
A name for a notification.
Definition: OFNotification.h:27
A protocol for the creation of copies.
Definition: OFObject.h:1350