2001-12-17 14:31:42 +00:00
|
|
|
/** Implementation for NSNull for GNUStep
|
2000-10-21 07:43:57 +00:00
|
|
|
Copyright (C) 2000 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
|
|
|
Date: 2000
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2000-10-21 07:43:57 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-09-14 11:36:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2000-10-21 07:43:57 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-08 10:38:33 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2000-10-21 07:43:57 +00:00
|
|
|
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
|
2019-12-09 23:36:00 +00:00
|
|
|
Lesser General Public License for more details.
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2007-09-14 11:36:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2000-10-21 07:43:57 +00:00
|
|
|
License along with this library; if not, write to the Free
|
2006-10-20 10:56:27 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2019-12-09 23:36:00 +00:00
|
|
|
Boston, MA 02110 USA.
|
2001-12-18 16:54:15 +00:00
|
|
|
|
|
|
|
<title>NSNull class reference</title>
|
2005-02-22 11:22:44 +00:00
|
|
|
*/
|
2000-10-21 07:43:57 +00:00
|
|
|
|
2010-02-19 08:12:46 +00:00
|
|
|
#import "common.h"
|
2010-02-17 11:47:06 +00:00
|
|
|
#import "Foundation/NSNull.h"
|
2000-10-21 07:43:57 +00:00
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
/**
|
|
|
|
* An object to use as a placeholder - in collections for instance.
|
|
|
|
*/
|
2000-10-21 07:43:57 +00:00
|
|
|
@implementation NSNull
|
|
|
|
|
|
|
|
static NSNull *null = 0;
|
|
|
|
|
|
|
|
+ (id) allocWithZone: (NSZone*)z
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) alloc
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (null == 0)
|
|
|
|
{
|
2000-10-22 06:26:20 +00:00
|
|
|
null = (NSNull*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
2013-08-22 15:44:54 +00:00
|
|
|
[[NSObject leakAt: &null] release];
|
2000-10-21 07:43:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-20 10:22:05 +00:00
|
|
|
/**
|
|
|
|
* Return an object that can be used as a placeholder in a collection.
|
|
|
|
* This method always returns the same object.
|
|
|
|
*/
|
2000-10-21 07:43:57 +00:00
|
|
|
+ (NSNull*) null
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) autorelease
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) copyWithZone: (NSZone*)z
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) copy
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2006-06-04 06:42:10 +00:00
|
|
|
GSNOSUPERDEALLOC;
|
2000-10-21 07:43:57 +00:00
|
|
|
}
|
|
|
|
|
2008-03-03 12:04:37 +00:00
|
|
|
- (NSString*) description
|
|
|
|
{
|
|
|
|
return @"<null>";
|
|
|
|
}
|
|
|
|
|
2023-12-09 19:56:29 +00:00
|
|
|
- (id) valueForUndefinedKey: (NSString*)aKey
|
|
|
|
{
|
2023-12-09 19:01:57 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2000-10-21 07:43:57 +00:00
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isEqual: (id)other
|
|
|
|
{
|
|
|
|
if (other == self)
|
2000-10-22 06:26:20 +00:00
|
|
|
return YES;
|
2000-10-21 07:43:57 +00:00
|
|
|
else
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2011-07-31 15:31:39 +00:00
|
|
|
- (oneway void) release
|
2000-10-21 07:43:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) retain
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|