00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 @import "CPObject.j"
00024 @import "CPException.j"
00025
00026
00040 @implementation CPNotification : CPObject
00041 {
00042 CPString _name;
00043 id _object;
00044 CPDictionary _userInfo;
00045 }
00046
00054 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00055 {
00056 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo];
00057 }
00058
00065 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject
00066 {
00067 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil];
00068 }
00069
00073 - (id)init
00074 {
00075 [CPException raise:CPUnsupportedMethodException
00076 reason:"CPNotification's init method should not be used"];
00077 }
00078
00087 - (id)initWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00088 {
00089 self = [super init];
00090
00091 if (self)
00092 {
00093 _name = aNotificationName;
00094 _object = anObject;
00095 _userInfo = aUserInfo;
00096 }
00097
00098 return self;
00099 }
00100
00104 - (CPString)name
00105 {
00106 return _name;
00107 }
00108
00112 - (id)object
00113 {
00114 return _object;
00115 }
00116
00120 - (CPDictionary)userInfo
00121 {
00122 return _userInfo;
00123 }
00124
00125 @end