1996-03-03 01:41:01 +00:00
|
|
|
|
/* Implementation of NSNotification for GNUstep
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
1996-04-17 20:17:45 +00:00
|
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1996-03-03 01:41:01 +00:00
|
|
|
|
Created: March 1996
|
1996-02-13 16:09:50 +00:00
|
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
|
This file is part of the GNUstep Base Library.
|
1996-02-13 16:09:50 +00:00
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Library General Public License for more details.
|
1996-03-03 01:41:01 +00:00
|
|
|
|
|
1996-02-13 16:09:50 +00:00
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
1996-03-03 01:41:01 +00:00
|
|
|
|
*/
|
1996-02-13 16:09:50 +00:00
|
|
|
|
|
1997-11-06 00:51:23 +00:00
|
|
|
|
#include <config.h>
|
1996-02-13 16:09:50 +00:00
|
|
|
|
#include <Foundation/NSNotification.h>
|
|
|
|
|
|
|
|
|
|
@implementation NSNotification
|
|
|
|
|
|
1998-07-21 17:56:48 +00:00
|
|
|
|
/* This is the designated initializer. */
|
|
|
|
|
- initWithName: (NSString*)name
|
|
|
|
|
object: object
|
|
|
|
|
userInfo: info
|
|
|
|
|
{
|
|
|
|
|
[super init];
|
|
|
|
|
_name = [name retain];
|
|
|
|
|
_object = [object retain];
|
|
|
|
|
_info = [info retain];
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
|
|
|
|
[_name release];
|
|
|
|
|
[_object release];
|
|
|
|
|
[_info release];
|
|
|
|
|
[super dealloc];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Creating autoreleased Notification objects. */
|
|
|
|
|
|
|
|
|
|
+ notificationWithName: (NSString*)name
|
|
|
|
|
object: object
|
|
|
|
|
userInfo: info
|
|
|
|
|
{
|
|
|
|
|
return [[[self alloc] initWithName: name
|
|
|
|
|
object: object
|
|
|
|
|
userInfo: info]
|
|
|
|
|
autorelease];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ notificationWithName: (NSString*)name
|
|
|
|
|
object: object
|
|
|
|
|
{
|
|
|
|
|
return [self notificationWithName: name
|
|
|
|
|
object: object
|
|
|
|
|
userInfo: nil];
|
|
|
|
|
}
|
1996-02-13 16:09:50 +00:00
|
|
|
|
|
1998-07-21 17:56:48 +00:00
|
|
|
|
|
|
|
|
|
/* Querying a Notification object. */
|
|
|
|
|
|
|
|
|
|
- (NSString*) name
|
|
|
|
|
{
|
|
|
|
|
return _name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- object
|
|
|
|
|
{
|
|
|
|
|
return _object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- userInfo
|
|
|
|
|
{
|
|
|
|
|
return _info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* NSCopying protocol. */
|
|
|
|
|
|
|
|
|
|
- copyWithZone: (NSZone*)zone
|
1996-02-13 16:09:50 +00:00
|
|
|
|
{
|
1998-07-21 17:56:48 +00:00
|
|
|
|
if (NSShouldRetainWithZone (self, zone))
|
|
|
|
|
return [self retain];
|
|
|
|
|
|
|
|
|
|
/* xxx How deep should the copy go? Should we copy _name, etc.? */
|
|
|
|
|
return [[[self class] allocWithZone: zone]
|
|
|
|
|
initWithName: _name
|
|
|
|
|
object: _object
|
|
|
|
|
userInfo: _info];
|
1996-02-13 16:09:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|