![]() |
API 0.9.5
|
00001 /* 00002 * CPNotification.j 00003 * Foundation 00004 * 00005 * Created by Francisco Tolmasky. 00006 * Copyright 2008, 280 North, Inc. 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 00037 @implementation CPNotification : CPObject 00038 { 00039 CPString _name; 00040 id _object; 00041 CPDictionary _userInfo; 00042 } 00043 00051 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo 00052 { 00053 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo]; 00054 } 00055 00062 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject 00063 { 00064 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil]; 00065 } 00066 00070 - (id)init 00071 { 00072 [CPException raise:CPUnsupportedMethodException 00073 reason:"CPNotification's init method should not be used"]; 00074 } 00075 00084 - (id)initWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo 00085 { 00086 self = [super init]; 00087 00088 if (self) 00089 { 00090 _name = aNotificationName; 00091 _object = anObject; 00092 _userInfo = aUserInfo; 00093 } 00094 00095 return self; 00096 } 00097 00101 - (CPString)name 00102 { 00103 return _name; 00104 } 00105 00109 - (id)object 00110 { 00111 return _object; 00112 } 00113 00117 - (CPDictionary)userInfo 00118 { 00119 return _userInfo; 00120 } 00121 00122 @end