API  0.9.7
 All Classes Files Functions Variables Macros Groups Pages
CPNotification.j
Go to the documentation of this file.
1 /*
2  * CPNotification.j
3  * Foundation
4  *
5  * Created by Francisco Tolmasky.
6  * Copyright 2008, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
37 @implementation CPNotification : CPObject
38 {
39  CPString _name;
40  id _object;
41  CPDictionary _userInfo;
42 }
43 
51 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
52 {
53  return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo];
54 }
55 
62 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject
63 {
64  return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil];
65 }
66 
70 - (id)init
71 {
72  [CPException raise:CPUnsupportedMethodException
73  reason:"CPNotification's init method should not be used"];
74 }
75 
84 - (id)initWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
85 {
86  self = [super init];
87 
88  if (self)
89  {
90  _name = aNotificationName;
91  _object = anObject;
92  _userInfo = aUserInfo;
93  }
94 
95  return self;
96 }
97 
102 {
103  return _name;
104 }
105 
109 - (id)object
110 {
111  return _object;
112 }
113 
117 - (CPDictionary)userInfo
118 {
119  return _userInfo;
120 }
121 
122 @end