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
00035 @implementation CPNotification : CPObject
00036 {
00037 CPString _name;
00038 id _object;
00039 CPDictionary _userInfo;
00040 }
00041
00049 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00050 {
00051 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo];
00052 }
00053
00060 + (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject
00061 {
00062 return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil];
00063 }
00064
00068 - (id)init
00069 {
00070 [CPException raise:CPUnsupportedMethodException
00071 reason:"CPNotification's init method should not be used"];
00072 }
00073
00082 - (id)initWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
00083 {
00084 self = [super init];
00085
00086 if (self)
00087 {
00088 _name = aNotificationName;
00089 _object = anObject;
00090 _userInfo = aUserInfo;
00091 }
00092
00093 return self;
00094 }
00095
00099 - (CPString)name
00100 {
00101 return _name;
00102 }
00103
00107 - (id)object
00108 {
00109 return _object;
00110 }
00111
00115 - (CPDictionary)userInfo
00116 {
00117 return _userInfo;
00118 }
00119
00120 @end