Added NSNull to provide standard placeholder object for marking a nul in

a collection etc.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7879 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-10-21 07:43:57 +00:00
parent b266bb9c8c
commit 81613caec7
14 changed files with 236 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2000-10-21 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSNull.h: New placeholder class.
* Source/NSNull.m: New placeholder class.
* Source/GNUmakefile: Build NSNull and install header.
* Documentation/gsdoc/GNUmakefile: Build NSNull documentation
* Documentation/gsdoc/NSNull.gsdoc: NSNull documentation
2000-10-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: ([-initWithCharacters:length:]) use

View file

@ -126,6 +126,7 @@
<item><uref url="NSNotification.html">NSNotification</uref></item>
<item><uref url="NSNotificationCenter.html">NSNotificationCenter</uref></item>
<item><uref url="NSNotificationQueue.html">NSNotificationQueue</uref></item>
<item><uref url="NSNull.html">NSNull</uref></item>
<item><uref url="NSNumber.html">NSNumber</uref></item>
<item><uref url="NSNumberFormatter.html">NSNumberFormatter</uref></item>
<item><uref url="NSObject.html">NSObject</uref></item>

View file

@ -122,6 +122,7 @@
<li><a href ="NSNotification.html">NSNotification</a>
<li><a href ="NSNotificationCenter.html">NSNotificationCenter</a>
<li><a href ="NSNotificationQueue.html">NSNotificationQueue</a>
<li><a href ="NSNull.html">NSNull</a>
<li><a href ="NSNumber.html">NSNumber</a>
<li><a href ="NSNumberFormatter.html">NSNumberFormatter</a>
<li><a href ="NSObject.html">NSObject</a>

View file

@ -73,6 +73,7 @@ Base_GSDOC_FILES = Base.gsdoc \
NSNotification.gsdoc \
NSNotificationCenter.gsdoc \
NSNotificationQueue.gsdoc \
NSNull.gsdoc \
NSNumber.gsdoc \
NSNumberFormatter.gsdoc \
NSObject.gsdoc \

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="NSNotificationQueue" prev="NSNotificationCenter" next="NSNumber" up="Base">
<gsdoc base="NSNotificationQueue" prev="NSNotificationCenter" next="NSNull" up="Base">
<head>
<title>NSNotificationQueue</title>
<author name="Richard Frith-Macdonald">

View file

@ -4,7 +4,7 @@
<body>
<a href ="NSNotificationCenter.html">[Previous]</a>
<a href ="Base.html">[Up]</a>
<a href ="NSNumber.html">[Next]</a>
<a href ="NSNull.html">[Next]</a>
<h1>NSNotificationQueue</h1>
<h3>Authors </h3>
<dl>

View file

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="NSNull" prev="NSNotificationQueue" next="NSNumber" up="Base">
<head>
<title>NSNull</title>
<author name="Richard Frith-Macdonald">
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>0.1</version>
<date>21 October, 2000</date>
</head>
<body>
<chapter>
<heading>NSNull</heading>
<class name="NSNull" super="NSObject">
<declared>Foundation/NSNull.h</declared>
<conform>NSObject</conform>
<conform>NSCoding</conform>
<conform>NSCopying</conform>
<desc>
</desc>
<method type="NSNull*" factory="yes">
<sel>null</sel>
<desc>
Return an object that can be used as a placeholder in a collection.
This method always returns the same object.
</desc>
</method>
</class>
</chapter>
</body>
</gsdoc>

View file

@ -0,0 +1,44 @@
<html><head>
<title>NSNull</title>
</head>
<body>
<a href ="NSNotificationQueue.html">[Previous]</a>
<a href ="Base.html">[Up]</a>
<a href ="NSNumber.html">[Next]</a>
<h1>NSNull</h1>
<h3>Authors </h3>
<dl>
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
<dd>
</dl>
<p>Version: 0.1</p>
<p>Date: 21 October, 2000</p>
<h2><a name ="cont-0">NSNull</a></h2>
<h2><a name ="NSNull">NSNull</a></h2>
<p><b>Declared in: </b> Foundation/NSNull.h</p>
<p><b>Inherits from: </b> NSObject</p>
<p><b>Conforms to: </b> NSObject
, NSCoding
, NSCopying
</p>
<hr>
<h2>Instance Variables </h2>
<ul>
</ul>
<h2>Methods </h2>
<ul>
<li><a href ="NSNull.html#method-0">+null</a>
</ul>
<hr><h2>Class Methods </h2>
<h3><a name ="method-0">null</a></h3>
+ (NSNull*) <b>null</b>;<br>
Return an object that can be used as a placeholder in a collection.
This method always returns the same object.
<hr>
</body>
</html>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="NSNumber" prev="NSNotificationQueue" next="NSNumberFormatter" up="Base">
<gsdoc base="NSNumber" prev="NSNull" next="NSNumberFormatter" up="Base">
<head>
<title>NSNumber</title>
<author name="Richard Frith-Macdonald">

View file

@ -2,7 +2,7 @@
<title>NSNumber</title>
</head>
<body>
<a href ="NSNotificationQueue.html">[Previous]</a>
<a href ="NSNull.html">[Previous]</a>
<a href ="Base.html">[Up]</a>
<a href ="NSNumberFormatter.html">[Next]</a>
<h1>NSNumber</h1>

View file

@ -62,6 +62,7 @@
#include <Foundation/NSMethodSignature.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSNotificationQueue.h>
#include <Foundation/NSNull.h>
#include <Foundation/NSPathUtilities.h>
#include <Foundation/NSPortCoder.h>
#include <Foundation/NSPortMessage.h>

View file

@ -0,0 +1,39 @@
/* Interface for NSNull for GNUStep
Copyright (C) 2000 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: 2000
This file is part of the GNUstep Base Library.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef __NSNull_h_GNUSTEP_BASE_INCLUDE
#define __NSNull_h_GNUSTEP_BASE_INCLUDE
/*
* An object to use as a placeholder - in collections for instance.
*/
#ifndef NO_MACOS_X
#include <Foundation/NSObject.h>
@interface NSNull : NSObject <NSCoding, NSCopying>
+ (NSNull*) null;
@end
#endif
#endif /* __NSNull_h_GNUSTEP_BASE_INCLUDE */

View file

@ -190,6 +190,7 @@ NSMethodSignature.m \
NSNotification.m \
NSNotificationCenter.m \
NSNotificationQueue.m \
NSNull.m \
NSNumber.m \
NSNumberFormatter.m \
NSObjCRuntime.m \
@ -291,6 +292,7 @@ NSMapTable.h \
NSMethodSignature.h \
NSNotification.h \
NSNotificationQueue.h \
NSNull.h \
NSNumberFormatter.h \
NSObjCRuntime.h \
NSObject.h \

102
Source/NSNull.m Normal file
View file

@ -0,0 +1,102 @@
/* Implementation for NSNull for GNUStep
Copyright (C) 2000 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: 2000
This file is part of the GNUstep Base Library.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
/*
* An object to use as a placeholder - in collections for instance.
*/
#include <Foundation/NSNull.h>
@implementation NSNull
static NSNull *null = 0;
+ (id) allocWithZone: (NSZone*)z
{
return null;
}
+ (id) alloc
{
return null;
}
+ (void) initialize
{
if (null == 0)
{
null = NSAllocateObject(self, 0, NSDefaultMallocZone());
}
}
+ (NSNull*) null
{
return null;
}
- (id) autorelease
{
return self;
}
- (id) copyWithZone: (NSZone*)z
{
return self;
}
- (id) copy
{
return self;
}
- (void) dealloc
{
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
}
- (id) initWithCoder: (NSCoder*)aCoder
{
return self;
}
- (BOOL) isEqual: (id)other
{
if (other == self)
return YES
else
return NO;
}
- (void) release
{
}
- (id) retain
{
return self;
}
@end