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 file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
22 @class OFConstantString;
23 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
24 
29 
37 {
38  OFNotificationName _name;
39  id _Nullable _object;
40  OFDictionary *_Nullable _userInfo;
41  OF_RESERVE_IVARS(OFNotification, 4)
42 }
43 
47 @property (readonly, nonatomic) OFNotificationName name;
48 
53 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) id object;
54 
58 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFDictionary *userInfo;
59 
68 + (instancetype)notificationWithName: (OFNotificationName)name
69  object: (nullable id)object;
70 
81 + (instancetype)notificationWithName: (OFNotificationName)name
82  object: (nullable id)object
83  userInfo: (nullable OFDictionary *)userInfo;
84 
94 - (instancetype)initWithName: (OFNotificationName)name
95  object: (nullable id)object;
96 
107 - (instancetype)initWithName: (OFNotificationName)name
108  object: (nullable id)object
109  userInfo: (nullable OFDictionary *)userInfo
110  OF_DESIGNATED_INITIALIZER;
111 
112 - (instancetype)init OF_UNAVAILABLE;
113 @end
114 
115 OF_ASSUME_NONNULL_END
A class to represent a notification for or from OFNotificationCenter.
Definition: OFNotification.h:36
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:78
OFConstantString * OFNotificationName
A name for a notification.
Definition: OFNotification.h:23
A protocol for the creation of copies.
Definition: OFObject.h:1346