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
00033 @implementation CPNotification : CPObject
00034 {
00035 CPString _name;
00036 id _object;
00037 CPDictionary _userInfo;
00038 }
00039
00047 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00048 {
00049 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo];
00050 }
00051
00058 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject
00059 {
00060 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil];
00061 }
00062
00066 - (id)init
00067 {
00068 [CPException raise:CPUnsupportedMethodException
00069 reason:"CPNotification's init method should not be used"];
00070 }
00071
00080 - (id)initWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00081 {
00082 self = [super init];
00083
00084 if (self)
00085 {
00086 _name = aNotificationName;
00087 _object = anObject;
00088 _userInfo = aUserInfo;
00089 }
00090
00091 return self;
00092 }
00093
00097 - (CPString)name
00098 {
00099 return _name;
00100 }
00101
00105 - (id)object
00106 {
00107 return _object;
00108 }
00109
00113 - (CPDictionary)userInfo
00114 {
00115 return _userInfo;
00116 }
00117
00118 @end