Documentation tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13788 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-06-06 14:02:59 +00:00
parent 5d4a28787b
commit da32171514
25 changed files with 793 additions and 266 deletions

View file

@ -2,6 +2,29 @@
* Source/NSLog.m: patch by Jeff Teunissen to avoid adding date/time
info when using syslog.
* Source/NSURL.m: Fix loading codde to set self as client of handle.
* Tools/AGSParser.m: Fix to avoid warnings about unimplemented protocols
* Headers/gnustep/base/GSXML.h:
* Headers/gnustep/base/NSArchiver.h:
* Headers/gnustep/base/NSAutoreleasePool.h:
* Headers/gnustep/base/NSCoder.h:
* Headers/gnustep/base/NSDictionary.h:
* Headers/gnustep/base/NSFileHandle.h:
* Headers/gnustep/base/NSNotification.h:
* Headers/gnustep/base/NSRunLoop.h:
* Headers/gnustep/base/NSURL.h:
* Headers/gnustep/base/NSURLHandle.h:
* Source/GSHTTPURLHandle.m:
* Source/NSArray.m:
* Source/NSCoder.m:
* Source/NSFileHandle.m:
* Source/NSNotification.m:
* Source/NSRunLoop.m:
* Source/NSURLHandle.m:
* Source/NSUnarchiver.m:
* Source/externs.m:
* Source/Additions/GSXML.m:
Tidied for documentation purposes ... no substantial code changes
Wed Jun 5 17:46:47 2002 Nicola Pero <n.pero@mi.flashnet.it>

View file

@ -77,7 +77,6 @@ Base_GSDOC_FILES = Base.gsdoc \
NSNull.gsdoc \
NSNumber.gsdoc \
NSNumberFormatter.gsdoc \
NSObject.gsdoc \
NSPort.gsdoc \
NSPortCoder.gsdoc \
NSPortMessage.gsdoc \
@ -95,23 +94,11 @@ Base_GSDOC_FILES = Base.gsdoc \
NSThread.gsdoc \
NSTimeZone.gsdoc \
NSTimer.gsdoc \
NSURL.gsdoc \
NSURLHandle.gsdoc \
NSUnarchiver.gsdoc \
NSUndoManager.gsdoc \
NSUserDefaults.gsdoc \
NSValue.gsdoc \
NSFunctions.gsdoc \
GSMime.gsdoc \
GSMimeDocument.gsdoc \
GSMimeParser.gsdoc \
GSXML.gsdoc \
GSSAXHandler.gsdoc \
GSXMLAttribute.gsdoc \
GSXMLDocument.gsdoc \
GSXMLNamespace.gsdoc \
GSXMLNode.gsdoc \
GSXMLParser.gsdoc
NSFunctions.gsdoc
Base_DOC_INSTALL_DIR = Developer/Base/Reference

View file

@ -196,10 +196,8 @@
+ (GSSAXHandler*) handler;
- (void*) lib;
- (GSXMLParser*) parser;
@end
@interface GSSAXHandler (Callbacks)
/* callbacks ... */
- (void) attribute: (NSString*)name
value: (NSString*)value;
- (void) attributeDecl: (NSString*)nameElement
@ -243,7 +241,7 @@
systemID: (NSString*)systemID;
- (int) isStandalone;
- (NSString*) loadEntity: (NSString*)publicId
at: (NSString*)locationURL;
at: (NSString*)location;
- (void) namespaceDecl: (NSString*)name
href: (NSString*)href
prefix: (NSString*)prefix;

View file

@ -1,7 +1,8 @@
/* Interface for NSArchiver for GNUStep
/** Interface for NSArchiver for GNUStep
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
Date: March 1995
This file is part of the GNUstep Base Library.
@ -19,6 +20,11 @@
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.
AutogsdocSource: NSArchiver.m
AutogsdocSource: NSUnarchiver.m
*/
#ifndef __NSArchiver_h_GNUSTEP_BASE_INCLUDE
@ -161,16 +167,16 @@
}
/* Initializing an unarchiver */
- (id) initForReadingWithData: (NSData*)data;
- (id) initForReadingWithData: (NSData*)anObject;
/* Decoding objects */
+ (id) unarchiveObjectWithData: (NSData*)data;
+ (id) unarchiveObjectWithData: (NSData*)anObject;
+ (id) unarchiveObjectWithFile: (NSString*)path;
/* Managing */
- (BOOL) isAtEnd;
- (NSZone*) objectZone;
- (void) setObjectZone: (NSZone*)zone;
- (void) setObjectZone: (NSZone*)aZone;
- (unsigned int) systemVersion;
/* Substituting Classes */
@ -190,53 +196,16 @@
#ifndef NO_GNUSTEP
@interface NSUnarchiver (GNUstep)
/*
* Re-using the unarchiver - the 'resetUnarchiverWithdata:atIndex:'
* method lets you re-use the archive to decode a new data object
* or, in conjunction with the 'cursor' method (which reports the
* current decoding position in the archive), decode a second
* archive that exists in the data object after the first one.
*/
- (unsigned) cursor;
- (void) resetUnarchiverWithData: (NSData*)data
- (void) resetUnarchiverWithData: (NSData*)anObject
atIndex: (unsigned)pos;
/*
* Subclassing with different input format.
* NSUnarchiver normally reads directly from an NSData object using
* the methods -
* [-deserializeTypeTagAtCursor:]
* to decode type tags for data items, the tag is the
* first byte of the character encoding string for the
* data type (as provided by '@encode(xxx)'), possibly
* with the top bit set to indicate that what follows is
* a crossreference to an item already encoded.
* [-deserializeCrossRefAtCursor:],
* to decode a crossreference number either to identify the
* following item, or to refer to a previously encoded item.
* Objects, Classes, Selectors, CStrings and Pointer items
* have crossreference encoding, other types do not.
* [-deserializeData:ofObjCType:atCursor:context:]
* to decode all other information.
*
* And uses other NSData methods to read the archive header information
* from within the method:
* [-deserializeHeaderAt:version:classes:objects:pointers:]
* to read a fixed size header including archiver version
* (obtained by [self systemVersion]) and crossreference
* table sizes.
*
* To subclass NSUnarchiver, you must implement your own versions of the
* four methods above, and override the 'directDataAccess' method to
* return NO so that the archiver knows to use your serialization
* methods rather than those in the NSData object.
*/
- (BOOL) directDataAccess;
- (void) deserializeHeaderAt: (unsigned*)cursor
version: (unsigned*)systemVersion
classes: (unsigned*)classCount
objects: (unsigned*)objectCount
pointers: (unsigned*)pointerCount;
- (void) deserializeHeaderAt: (unsigned*)pos
version: (unsigned*)v
classes: (unsigned*)c
objects: (unsigned*)o
pointers: (unsigned*)p;
@end
#endif

View file

@ -32,7 +32,7 @@
/* Each thread has its own copy of these variables.
A pointer to this structure is an ivar of NSThread. */
struct autorelease_thread_vars
typedef struct autorelease_thread_vars
{
/* The current, default NSAutoreleasePool for the calling thread;
the one that will hold objects that are arguments to
@ -49,7 +49,7 @@ struct autorelease_thread_vars
id *pool_cache;
int pool_cache_size;
int pool_cache_count;
};
} thread_vars_struct;
/* Initialize an autorelease_thread_vars structure for a new thread.
This function is called in NSThread each time an NSThread is created.
@ -60,13 +60,13 @@ struct autorelease_thread_vars
/* Each pool holds its objects-to-be-released in a linked-list of
these structures. */
struct autorelease_array_list
typedef struct autorelease_array_list
{
struct autorelease_array_list *next;
unsigned size;
unsigned count;
id objects[0];
};
} array_list_struct;
@interface NSAutoreleasePool : NSObject

View file

@ -101,8 +101,8 @@
at: (const void*)buf
withName: (id)name;
- (void) encodeIndent;
- (void) encodeObject: (id)anObject
withName: (id)name;
- (void) encodeObjectAt: (id*)anObject
withName: (id)name;
- (void) encodeValueOfCType: (const char*)type
at: (const void*)buf
withName: (id)name;

View file

@ -89,17 +89,4 @@
#endif
@end
#ifndef NO_GNUSTEP
#include <Foundation/NSDictionary.h>
@interface NSMutableDictionary (GNU)
+ (unsigned) defaultCapacity;
- (id) initWithType: (const char*)contentEncoding
keyType: (const char*)keyEncoding
capacity: (unsigned)aCapacity;
@end
#endif /* NO_GNUSTEP*/
#endif

View file

@ -1,4 +1,4 @@
/* Interface for NSFileHandle for GNUStep
/** Interface for NSFileHandle for GNUStep
Copyright (C) 1997 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
@ -19,6 +19,9 @@
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.
AutogsdocSource: NSFileHandle.m
AutogsdocSource: NSPipe.m
*/
#ifndef __NSFileHandle_h_GNUSTEP_BASE_INCLUDE
@ -84,20 +87,20 @@
// Notification names.
GS_EXPORT NSString* NSFileHandleConnectionAcceptedNotification;
GS_EXPORT NSString* NSFileHandleDataAvailableNotification;
GS_EXPORT NSString* NSFileHandleReadCompletionNotification;
GS_EXPORT NSString* NSFileHandleReadToEndOfFileCompletionNotification;
GS_EXPORT NSString * const NSFileHandleConnectionAcceptedNotification;
GS_EXPORT NSString * const NSFileHandleDataAvailableNotification;
GS_EXPORT NSString * const NSFileHandleReadCompletionNotification;
GS_EXPORT NSString * const NSFileHandleReadToEndOfFileCompletionNotification;
// Keys for accessing userInfo dictionary in notification handlers.
GS_EXPORT NSString* NSFileHandleNotificationDataItem;
GS_EXPORT NSString* NSFileHandleNotificationFileHandleItem;
GS_EXPORT NSString* NSFileHandleNotificationMonitorModes;
GS_EXPORT NSString * const NSFileHandleNotificationDataItem;
GS_EXPORT NSString * const NSFileHandleNotificationFileHandleItem;
GS_EXPORT NSString * const NSFileHandleNotificationMonitorModes;
// Exceptions
GS_EXPORT NSString* NSFileHandleOperationException;
GS_EXPORT NSString * const NSFileHandleOperationException;
@interface NSPipe : NSObject
{
@ -159,11 +162,11 @@ GS_EXPORT NSString* NSFileHandleOperationException;
// GNUstep Notification names.
GS_EXPORT NSString* GSFileHandleConnectCompletionNotification;
GS_EXPORT NSString* GSFileHandleWriteCompletionNotification;
GS_EXPORT NSString * const GSFileHandleConnectCompletionNotification;
GS_EXPORT NSString * const GSFileHandleWriteCompletionNotification;
// Message describing error in async accept,read,write operation.
GS_EXPORT NSString* GSFileHandleNotificationError;
GS_EXPORT NSString * const GSFileHandleNotificationError;
#endif
#endif /* __NSFileHandle_h_GNUSTEP_BASE_INCLUDE */

View file

@ -1,7 +1,8 @@
/* Interface for NSNotification and NSNotificationCenter for GNUstep
/** Interface for NSNotification and NSNotificationCenter for GNUstep
Copyright (C) 1996,1999 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
Created: March 1996
This file is part of the GNUstep Base Library.
@ -19,6 +20,9 @@
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.
AutogsdocSource: NSNotification.m
AutogsdocSource: NSNotificationCenter.m
*/
#ifndef __NSNotification_h_GNUSTEP_BASE_INCLUDE
@ -64,7 +68,7 @@
+ (NSNotificationCenter*) defaultCenter;
- (void) addObserver: (id)observer
selector: (SEL)sel
selector: (SEL)selector
name: (NSString*)name
object: (id)object;
@ -86,7 +90,7 @@
@interface NSNotification (GNUstep)
- (id) initWithName: (NSString*)name
object: (id)object
userInfo: (NSDictionary*)user_info;
userInfo: (NSDictionary*)info;
@end
@interface NSNotificationCenter (GNUstep)

View file

@ -29,7 +29,7 @@
@class NSTimer, NSDate, NSPort;
/* Mode strings. */
GS_EXPORT NSString* const NSDefaultRunLoopMode;
GS_EXPORT NSString * const NSDefaultRunLoopMode;
@interface NSRunLoop : NSObject <GCFinalization>
{

View file

@ -2,7 +2,7 @@
Copyright (C) 1999 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999
Date: Jan 1999
This file is part of the GNUstep Library.
@ -26,6 +26,8 @@
#include <Foundation/NSURLHandle.h>
#ifndef STRICT_OPENSTEP
@class NSNumber;
GS_EXPORT NSString* NSURLFileScheme;
@ -90,4 +92,6 @@ GS_EXPORT NSString* NSURLFileScheme;
resourceDidFailLoadingWithReason: (NSString*)reason;
@end
#endif
#endif //_NSUrl_h__

View file

@ -26,6 +26,8 @@
#include <Foundation/NSObject.h>
#ifndef STRICT_OPENSTEP
@class NSData;
@class NSString;
@class NSMutableArray;
@ -33,16 +35,16 @@
@class NSURLHandle;
@class NSURL;
GS_EXPORT NSString *NSHTTPPropertyStatusCodeKey;
GS_EXPORT NSString *NSHTTPPropertyStatusReasonKey;
GS_EXPORT NSString *NSHTTPPropertyServerHTTPVersionKey;
GS_EXPORT NSString *NSHTTPPropertyRedirectionHeadersKey;
GS_EXPORT NSString *NSHTTPPropertyErrorPageDataKey;
GS_EXPORT NSString * const NSHTTPPropertyStatusCodeKey;
GS_EXPORT NSString * const NSHTTPPropertyStatusReasonKey;
GS_EXPORT NSString * const NSHTTPPropertyServerHTTPVersionKey;
GS_EXPORT NSString * const NSHTTPPropertyRedirectionHeadersKey;
GS_EXPORT NSString * const NSHTTPPropertyErrorPageDataKey;
#ifndef NO_GNUSTEP
GS_EXPORT NSString *GSHTTPPropertyMethodKey;
GS_EXPORT NSString *GSHTTPPropertyProxyHostKey;
GS_EXPORT NSString *GSHTTPPropertyProxyPortKey;
GS_EXPORT NSString * const GSHTTPPropertyMethodKey;
GS_EXPORT NSString * const GSHTTPPropertyProxyHostKey;
GS_EXPORT NSString * const GSHTTPPropertyProxyPortKey;
#endif
typedef enum
@ -53,20 +55,45 @@ typedef enum
NSURLHandleLoadFailed
} NSURLHandleStatus;
//=============================================================================
/**
* A protocol to which clients of a handle must conform in order to
* rfeceive notification of events on the handle.
*/
@protocol NSURLHandleClient
/**
* Sent by the NSURLHandle object when some data becomes available
* from the handle. Note that this does not mean that all data has become
* available, only that a chunk of data has arrived.
*/
- (void) URLHandle: (NSURLHandle*)sender
resourceDataDidBecomeAvailable: (NSData*)newData;
- (void) URLHandleResourceDidBeginLoading: (NSURLHandle*)sender;
- (void) URLHandleResourceDidFinishLoading: (NSURLHandle*)sender;
- (void) URLHandleResourceDidCancelLoading: (NSURLHandle*)sender;
/**
* Sent by the NSURLHandle object on resource load failure.
* Supplies a human readable failure reason.
*/
- (void) URLHandle: (NSURLHandle*)sender
resourceDidFailLoadingWithReason: (NSString*)reason;
/**
* Sent by the NSURLHandle object when it begins loading
* resource data.
*/
- (void) URLHandleResourceDidBeginLoading: (NSURLHandle*)sender;
/**
* Sent by the NSURLHandle object when resource loading is canceled
* by programmatic request (rather than by failure).
*/
- (void) URLHandleResourceDidCancelLoading: (NSURLHandle*)sender;
/**
* Sent by the NSURLHandle object when it completes loading
* resource data.
*/
- (void) URLHandleResourceDidFinishLoading: (NSURLHandle*)sender;
@end
//=============================================================================
@interface NSURLHandle: NSObject
{
id _data;
@ -107,3 +134,5 @@ typedef enum
@end
#endif
#endif

View file

@ -2575,8 +2575,8 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
* An attribute definition has been parsed.
*/
- (void) attributeDecl: (NSString*)nameElement
nameAttribute: (NSString*)name
entityType: (int)type
name: (NSString*)name
type: (int)type
typeDefValue: (int)defType
defaultValue: (NSString*)value
{
@ -2594,8 +2594,8 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
* What to do when an unparsed entity declaration is parsed.
*/
- (void) unparsedEntityDecl: (NSString*)name
publicEntity: (NSString*)publicId
systemEntity: (NSString*)systemId
public: (NSString*)publicId
system: (NSString*)systemId
notationName: (NSString*)notation
{
}

View file

@ -1,9 +1,9 @@
/** GSHTTPURLHandle.m - Class GSHTTPURLHandle
Copyright (C) 2000 Free Software Foundation, Inc.
Written by: Mark Allison <mark@brainstorm.co.uk>
Integrated: Richard Frith-Macdonald <rfm@gnu.org>
Date: November 2000
Written by: Mark Allison <mark@brainstorm.co.uk>
Integrated by: Richard Frith-Macdonald <rfm@gnu.org>
Date: November 2000
This file is part of the GNUstep Library.
@ -82,7 +82,86 @@ char emp[64] = {
- (void) setDebug: (BOOL)flag;
@end
/**
* <p>
* This is a <em>PRIVATE</em> subclass of NSURLHandle.
* It is documented here in order to give you information about the
* default behavior of an NSURLHandle created to deal with a URL
* that has either the <code>http</code> or <code>https</code> scheme.
* The name and/or other implementation details of this class
* may be changed at any time.
* </p>
* <p>
* A GSHTTPURLHandle instance is used to manage connections to
* <code>http</code> and <code>https</code> URLs.
* Secure connections are handled automatically
* (using openSSL) for URLs with the scheme <code>https</code>.
* Connection via proxy server is supported, as is proxy tunneling
* for secure connections. Basic parsing of <code>http</code>
* headers is performed to extract <code>http</code> status
* information, cookies etc. Cookies are
* retained and automatically sent during subsequent requests where
* the cookie is valid.
* </p>
* <p>
* Header information from the current page may be obtained using
* -propertyForKey and -propertyForKeyIfAvailable. <code>HTTP</code>
* status information can be retrieved as by calling either of these
* methods specifying one of the following keys:
* </p>
* <list>
* <item>
* NSHTTPPropertyStatusCodeKey - numeric status code
* </item>
* <item>
* NSHTTPPropertyStatusReasonKey - text describing status
* </item>
* <item>
* NSHTTPPropertyServerHTTPVersionKey - <code>http</code>
* version supported by remote server
* </item>
* </list>
* <p>
* According to MacOS-X headers, the following should also
* be supported, but currently are not:
* </p>
* <list>
* <item>NSHTTPPropertyRedirectionHeadersKey</item>
* <item>NSHTTPPropertyErrorPageDataKey</item>
* </list>
* <p>
* The omission of these headers is not viewed as important at
* present, since the MacOS-X public beta implementation doesn't
* work either.
* </p>
* <p>
* Other calls to -propertyForKey and -propertyForKeyIfAvailable may
* be made specifying a <code>http</code> header field name.
* For example specifying a key name of &quot;Content-Length&quot;
* would return the value of the &quot;Content-Length&quot; header
* field.
* </p>
* <p>
* [GSHTTPURLHandle-writeProperty:forKey:]
* can be used to specify the parameters
* for the <code>http</code> request. The default request uses the
* &quot;GET&quot; method when fetching a page, and the
* &quot;POST&quot; method when using -writeData:.
* This can be over-ridden by calling -writeProperty:forKey: with
* the key name &quot;GSHTTPPropertyMethodKey&quot; and specifying an
* alternative method (i.e &quot;PUT&quot;).
* </p>
* <p>
* A Proxy may be specified by calling -writeProperty:forKey:
* with the keys &quot;GSHTTPPropertyProxyHostKey&quot; and
* &quot;GSHTTPPropertyProxyPortKey&quot; to set the host and port
* of the proxy server respectively. The GSHTTPPropertyProxyHostKey
* property can be set to either the IP address or the hostname of
* the proxy server. If an attempt is made to load a page via a
* secure connection when a proxy is specified, GSHTTPURLHandle will
* attempt to open an SSL Tunnel through the proxy.
* </p>
*/
@implementation GSHTTPURLHandle
static NSMutableDictionary *urlCache = nil;
@ -715,6 +794,30 @@ static void debugWrite(NSData *data)
}
}
/**
* If necessary, this method calls -loadInForeground to send a
* request to the webserver, and get a page back. It then returns
* the property for the specified key -
* <list>
* <item>
* NSHTTPPropertyStatusCodeKey - numeric status code returned
* by the last request.
* </item>
* <item>
* NSHTTPPropertyStatusReasonKey - text describing status of
* the last request
* </item>
* <item>
* NSHTTPPropertyServerHTTPVersionKey - <code>http</code>
* version supported by remote server
* </item>
* <item>
* Other keys are taken to be the names of <code>http</code>
* headers and the corresponding header value (or nil if there
* is none) is returned.
* </item>
* </list>
*/
- (id) propertyForKey: (NSString*) propertyKey
{
if (document == nil)
@ -761,12 +864,44 @@ static void debugWrite(NSData *data)
debug = flag;
}
/**
* Writes the specified data as the body of an <code>http</code>
* or <code>https</code> request to the web server.
* Returns YES on success,
* NO on failure. By default, this method performs a POST operation.
* On completion, the resource data for this handle is set to the
* page returned by the request.
*/
- (BOOL) writeData: (NSData*)d
{
ASSIGN(wData, d);
return YES;
}
/**
* Sets a property to be used in the next request made by this handle.
* The property is set as a header in the next request, unless it is
* one of the following -
* <list>
* <item>
* GSHTTPPropertyBodyKey - set an NSData item to be sent to
* the server as the body of the request.
* </item>
* <item>
* GSHTTPPropertyMethodKey - override the default method of
* the request (eg. &quot;PUT&quot;).
* </item>
* <item>
* GSHTTPPropertyProxyHostKey - specify the name or IP address
* of a host to proxy through.
* </item>
* <item>
* GSHTTPPropertyProxyPortKey - specify the port number to
* connect to on the proxy host. If not give, this defaults
* to 8080 for <code>http</code> and 4430 for <code>https</code>.
* </item>
* </list>
*/
- (BOOL) writeProperty: (id) property forKey: (NSString*) propertyKey
{
if (propertyKey == nil || [propertyKey isKindOfClass: [NSString class]] == NO)

View file

@ -70,6 +70,9 @@ static NSLock *placeholderLock;
@end
/**
* A simple, low overhead, ordered container for objects.
*/
@implementation NSArray
static SEL addSel;
@ -159,6 +162,9 @@ static SEL rlSel;
}
}
/**
* Returns an empty autoreleased array.
*/
+ (id) array
{
id o;
@ -168,6 +174,10 @@ static SEL rlSel;
return AUTORELEASE(o);
}
/**
* Returns a new autoreleased NSArray instance containing all the objects from
* array, in the same order as the original.
*/
+ (id) arrayWithArray: (NSArray*)array
{
id o;
@ -177,6 +187,12 @@ static SEL rlSel;
return AUTORELEASE(o);
}
/**
* Returns an autoreleased array based upon the file.
* This may be in property list format or in XML format
* (if XML is available on your system).
* This method returns nil if file does not represent an array.
*/
+ (id) arrayWithContentsOfFile: (NSString*)file
{
id o;
@ -186,6 +202,9 @@ static SEL rlSel;
return AUTORELEASE(o);
}
/**
* Returns an autoreleased array containing anObject.
*/
+ (id) arrayWithObject: (id)anObject
{
id o;
@ -195,22 +214,34 @@ static SEL rlSel;
return AUTORELEASE(o);
}
/**
* Returns an autoreleased array containing the list
* of objects, preserving order.
*/
+ (id) arrayWithObjects: firstObject, ...
{
va_list ap;
va_start(ap, firstObject);
self = [[self allocWithZone: NSDefaultMallocZone()]
_initWithObjects: firstObject rest: ap];
_initWithObjects: firstObject rest: ap];
va_end(ap);
return AUTORELEASE(self);
}
/**
* Returns an autoreleased array containing the specified
* objects, preserving order.
*/
+ (id) arrayWithObjects: (id*)objects count: (unsigned)count
{
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
initWithObjects: objects count: count]);
}
/**
* Returns an autoreleased array formed from the contents of
* the receiver and adding anObject as the last item.
*/
- (NSArray*) arrayByAddingObject: (id)anObject
{
id na;
@ -234,6 +265,10 @@ static SEL rlSel;
return AUTORELEASE(na);
}
/**
* Returns a new array which is the concatenation of self and
* otherArray (in this precise order).
*/
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray
{
id na;
@ -251,12 +286,19 @@ static SEL rlSel;
return na;
}
/**
* Returns the abstract class ... arrays are coded as abstract arrays
*/
- (Class) classForCoder
{
return NSArrayClass;
}
- (BOOL) containsObject: anObject
/**
* Returns YES if anObject belongs to self. No otherwise.<br />
* The -isEqual: method of anObject is used to test for equality.
*/
- (BOOL) containsObject: (id)anObject
{
return ([self indexOfObject: anObject] != NSNotFound);
}
@ -266,6 +308,9 @@ static SEL rlSel;
return RETAIN(self);
}
/** <override-subclass />
* Returns the number of elements contained in the receiver.
*/
- (unsigned) count
{
[self subclassResponsibility: _cmd];
@ -290,6 +335,10 @@ static SEL rlSel;
}
}
/**
* Copies the objects from the receiver to aBuffer, which must be
* an area of memory large enough to hold them.
*/
- (void) getObjects: (id*)aBuffer
{
unsigned i, c = [self count];
@ -299,6 +348,10 @@ static SEL rlSel;
aBuffer[i] = (*get)(self, oaiSel, i);
}
/**
* Copies the objects from the range aRange of the receiver to aBuffer,
* which must be an area of memory large enough to hold them.
*/
- (void) getObjects: (id*)aBuffer range: (NSRange)aRange
{
unsigned i, j = 0, c = [self count], e = aRange.location + aRange.length;
@ -310,12 +363,19 @@ static SEL rlSel;
aBuffer[j++] = (*get)(self, oaiSel, i);
}
/**
* Returns the ame value as -count
*/
- (unsigned) hash
{
return [self count];
}
- (unsigned) indexOfObjectIdenticalTo: anObject
/**
* Returns the index of the specified object in the receiver, or
* NSNotFound if the object is not present.
*/
- (unsigned) indexOfObjectIdenticalTo: (id)anObject
{
unsigned c = [self count];
@ -331,6 +391,10 @@ static SEL rlSel;
return NSNotFound;
}
/**
* Returns the index of the specified object in the range of the receiver,
* or NSNotFound if the object is not present.
*/
- (unsigned) indexOfObjectIdenticalTo: anObject inRange: (NSRange)aRange
{
unsigned i, e = aRange.location + aRange.length, c = [self count];
@ -344,7 +408,11 @@ static SEL rlSel;
return NSNotFound;
}
/* Inefficient, should be overridden. */
/**
* Returns the index of the first object found in the receiver
* which is equal to anObject (using anObject's -isEqual: method).
* Returns NSNotFound on failure.
*/
- (unsigned) indexOfObject: (id)anObject
{
unsigned c = [self count];
@ -363,7 +431,11 @@ static SEL rlSel;
return NSNotFound;
}
/* Inefficient, should be overridden. */
/**
* Returns the index of the first object found in aRange of receiver
* which is equal to anObject (using anObject's -isEqual: method).
* Returns NSNotFound on failure.
*/
- (unsigned) indexOfObject: (id)anObject inRange: (NSRange)aRange
{
unsigned i, e = aRange.location + aRange.length, c = [self count];
@ -386,6 +458,10 @@ static SEL rlSel;
return [self initWithObjects: (id*)0 count: 0];
}
/**
* Initialize the array with the content of anArray. The order is preserved.
* <br />May change the value of self before returning it.
*/
- (id) initWithArray: (NSArray*)array
{
unsigned c;
@ -400,6 +476,10 @@ static SEL rlSel;
return self;
}
/**
* Initialize the array by decoding from an archive.
* <br />May change the value of self before returning it.
*/
- (id) initWithCoder: (NSCoder*)aCoder
{
unsigned count;
@ -467,7 +547,10 @@ static SEL rlSel;
return nil;
}
/* This is the designated initializer for NSArray. */
/** <init />
* Initialize the array with count objects.
* <br />May change the value of self before returning it.
*/
- (id) initWithObjects: (id*)objects count: (unsigned)count
{
[self subclassResponsibility: _cmd];
@ -521,6 +604,10 @@ static SEL rlSel;
return( self );
}
/**
* Initialize the array the list of objects.
* <br />May change the value of self before returning it.
*/
- (id) initWithObjects: firstObject, ...
{
va_list ap;
@ -530,12 +617,20 @@ static SEL rlSel;
return self;
}
/**
* Returns an NSMutableArray instance containing the same objects as
* the receiver.
*/
- (id) mutableCopyWithZone: (NSZone*)zone
{
return [[GSMutableArrayClass allocWithZone: zone]
initWithArray: self];
}
/** <override-subclass />
* Returns the object at the specified index.
* Raises an exception of the index is beyond the array.
*/
- (id) objectAtIndex: (unsigned)index
{
[self subclassResponsibility: _cmd];
@ -551,6 +646,9 @@ static SEL rlSel;
return NO;
}
/**
* Returns YES if the receiver is equal to otherArray, NO otherwise.
*/
- (BOOL) isEqualToArray: (NSArray*)otherArray
{
unsigned i, c;
@ -572,6 +670,9 @@ static SEL rlSel;
return YES;
}
/**
* Returns the last object in the receiver, or nil if the receiver is empty.
*/
- (id) lastObject
{
unsigned count = [self count];
@ -580,6 +681,10 @@ static SEL rlSel;
return [self objectAtIndex: count-1];
}
/**
* Makes each object in the array perform aSelector.<br />
* This is done sequentially from the last to the first object.
*/
- (void) makeObjectsPerformSelector: (SEL)aSelector
{
unsigned i = [self count];
@ -593,12 +698,19 @@ static SEL rlSel;
}
}
/**
* Obsolete version of -makeObjectsPerformSelector:
*/
- (void) makeObjectsPerform: (SEL)aSelector
{
[self makeObjectsPerformSelector: aSelector];
}
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id) arg
/**
* Makes each object in the array perform aSelector with arg.<br />
* This is done sequentially from the last to the first object.
*/
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)arg
{
unsigned i = [self count];
@ -611,6 +723,9 @@ static SEL rlSel;
}
}
/**
* Obsolete version of -makeObjectsPerformSelector:withObject:
*/
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument
{
[self makeObjectsPerformSelector: aSelector withObject: argument];
@ -621,11 +736,19 @@ static int compare(id elem1, id elem2, void* context)
return (int)[elem1 performSelector: (SEL)context withObject: elem2];
}
/**
* Returns an autoreleased array in which the objects are ordered
* according to a sort with comparator.
*/
- (NSArray*) sortedArrayUsingSelector: (SEL)comparator
{
return [self sortedArrayUsingFunction: compare context: (void *)comparator];
}
/**
* Returns an autoreleased array in which the objects are ordered
* according to a sort with comparator.
*/
- (NSArray*) sortedArrayUsingFunction: (int(*)(id,id,void*))comparator
context: (void*)context
{
@ -718,6 +841,12 @@ static int compare(id elem1, id elem2, void* context)
return na;
}
/**
* Returns an enumerator describing the array sequentially
* from the first to the last element.<br/>
* If you use a mutable subclass of NSArray,
* you should not modify the array during enumeration.
*/
- (NSEnumerator*) objectEnumerator
{
id e;
@ -727,6 +856,12 @@ static int compare(id elem1, id elem2, void* context)
return AUTORELEASE(e);
}
/**
* Returns an enumerator describing the array sequentially
* from the last to the first element.<br/>
* If you use a mutable subclass of NSArray,
* you should not modify the array during enumeration.
*/
- (NSEnumerator*) reverseObjectEnumerator
{
id e;

View file

@ -274,6 +274,30 @@
va_end(ap);
}
// Managing Zones
- (NSZone*) objectZone
{
return NSDefaultMallocZone();
}
- (void) setObjectZone: (NSZone*)zone
{
;
}
// Getting a Version
- (unsigned int) systemVersion
{
return (((GNUSTEP_BASE_MAJOR_VERSION * 100)
+ GNUSTEP_BASE_MINOR_VERSION) * 100) + GNUSTEP_BASE_SUBMINOR_VERSION;
}
@end
@implementation NSCoder (GNUstep)
- (void) decodeArrayOfObjCType: (const char*)type
count: (unsigned)count
at: (void*)buf
@ -355,26 +379,4 @@
{
[self encodeValueOfObjCType: @encode(id) at: anObject withName: name];
}
// Managing Zones
- (NSZone*) objectZone
{
return NSDefaultMallocZone();
}
- (void) setObjectZone: (NSZone*)zone
{
;
}
// Getting a Version
- (unsigned int) systemVersion
{
return (((GNUSTEP_BASE_MAJOR_VERSION * 100)
+ GNUSTEP_BASE_MINOR_VERSION) * 100) + GNUSTEP_BASE_SUBMINOR_VERSION;
}
@end

View file

@ -38,6 +38,18 @@
#include <Foundation/UnixFileHandle.h>
#endif
// GNUstep Notification names
NSString * const GSFileHandleConnectCompletionNotification
= @"GSFileHandleConnectCompletionNotification";
NSString * const GSFileHandleWriteCompletionNotification
= @"GSFileHandleWriteCompletionNotification";
// GNUstep key for getting error message.
NSString * const GSFileHandleNotificationError
= @"GSFileHandleNotificationError";
static Class NSFileHandle_abstract_class = nil;
static Class NSFileHandle_concrete_class = nil;
static Class NSFileHandle_ssl_class = nil;
@ -269,28 +281,28 @@ static Class NSFileHandle_ssl_class = nil;
// Keys for accessing userInfo dictionary in notification handlers.
NSString* NSFileHandleNotificationDataItem =
@"NSFileHandleNotificationDataItem";
NSString* NSFileHandleNotificationFileHandleItem =
@"NSFileHandleNotificationFileHandleItem";
NSString* NSFileHandleNotificationMonitorModes =
@"NSFileHandleNotificationMonitorModes";
NSString * const NSFileHandleNotificationDataItem
= @"NSFileHandleNotificationDataItem";
NSString * const NSFileHandleNotificationFileHandleItem
= @"NSFileHandleNotificationFileHandleItem";
NSString * const NSFileHandleNotificationMonitorModes
= @"NSFileHandleNotificationMonitorModes";
// Notification names
NSString* NSFileHandleConnectionAcceptedNotification =
@"NSFileHandleConnectionAcceptedNotification";
NSString* NSFileHandleDataAvailableNotification =
@"NSFileHandleDataAvailableNotification";
NSString* NSFileHandleReadCompletionNotification =
@"NSFileHandleReadCompletionNotification";
NSString* NSFileHandleReadToEndOfFileCompletionNotification =
@"NSFileHandleReadToEndOfFileCompletionNotification";
NSString * const NSFileHandleConnectionAcceptedNotification
= @"NSFileHandleConnectionAcceptedNotification";
NSString * const NSFileHandleDataAvailableNotification
= @"NSFileHandleDataAvailableNotification";
NSString * const NSFileHandleReadCompletionNotification
= @"NSFileHandleReadCompletionNotification";
NSString * const NSFileHandleReadToEndOfFileCompletionNotification
= @"NSFileHandleReadToEndOfFileCompletionNotification";
// Exceptions
NSString* NSFileHandleOperationException =
@"NSFileHandleOperationException";
NSString * const NSFileHandleOperationException
= @"NSFileHandleOperationException";
// GNUstep class extensions
@ -344,23 +356,6 @@ NSString* NSFileHandleOperationException =
protocol: protocol]);
}
+ (Class) sslClass
{
if (NSFileHandle_ssl_class == 0)
{
NSBundle *bundle;
NSString *path;
path = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSSystemDomainMask, NO) lastObject];
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: @"SSL.bundle"];
bundle = [NSBundle bundleWithPath: path];
NSFileHandle_ssl_class = [bundle principalClass];
}
return NSFileHandle_ssl_class;
}
- (BOOL) readInProgress
{
[self subclassResponsibility: _cmd];
@ -403,16 +398,38 @@ NSString* NSFileHandleOperationException =
return NO;
}
// GNUstep Notification names
NSString* GSFileHandleConnectCompletionNotification =
@"GSFileHandleConnectCompletionNotification";
NSString* GSFileHandleWriteCompletionNotification =
@"GSFileHandleWriteCompletionNotification";
// GNUstep key for getting error message.
NSString* GSFileHandleNotificationError =
@"GSFileHandleNotificationError";
@end
@implementation NSFileHandle (GNUstepOpenSSL)
+ (Class) sslClass
{
if (NSFileHandle_ssl_class == 0)
{
NSBundle *bundle;
NSString *path;
path = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSSystemDomainMask, NO) lastObject];
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: @"SSL.bundle"];
bundle = [NSBundle bundleWithPath: path];
NSFileHandle_ssl_class = [bundle principalClass];
}
return NSFileHandle_ssl_class;
}
- (BOOL) sslConnect
{
return NO;
}
- (void) sslDisconnect
{
}
- (void) sslSetCertificate: (NSString*)certFile
privateKey: (NSString*)privateKey
PEMpasswd: (NSString*)PEMpasswd
{
}
@end

View file

@ -29,20 +29,24 @@
#include <Foundation/NSCoder.h>
#include <Foundation/NSString.h>
@implementation NSNotification
/* This is the designated initializer. */
@implementation NSNotification (GNUstep)
/* <init />
* Initialise a newly created notification.
*/
- (id) initWithName: (NSString*)name
object: (id)object
userInfo: (NSDictionary*)info
{
[super init];
_name = [name copyWithZone: NSDefaultMallocZone()];
_name = [name copyWithZone: GSObjCZone(self)];
_object = TEST_RETAIN(object);
_info = TEST_RETAIN(info);
return self;
}
@end
@implementation NSNotification
- (void) dealloc
{
RELEASE(_name);

View file

@ -58,6 +58,8 @@
#include <string.h> /* for memset() */
NSString * const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode";
static NSDate *theFuture = nil;
extern BOOL GSCheckTasks();
@ -344,7 +346,7 @@ wRetain(NSMapTable* t, const void* w)
(*wRetImp)((id)w, wRetSel);
}
const NSMapTableValueCallBacks WatcherMapValueCallBacks =
static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
{
wRetain,
wRelease,
@ -366,7 +368,7 @@ aRelease(NSMapTable* t, const void* a)
NSZoneFree(((GSIArray)a)->zone, (void*)a);
}
const NSMapTableValueCallBacks ArrayMapValueCallBacks =
static const NSMapTableValueCallBacks ArrayMapValueCallBacks =
{
aRetain,
aRelease,

View file

@ -4,6 +4,9 @@
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999
Rewrite by: Richard Frith-Macdonald <rfm@gnu.org>
Date: Jun 2002
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
@ -924,8 +927,22 @@ static void unescape(const char *from, char * to)
}
/**
* Loads resource data for the specified clientl, providing the client
* with notifications of the loading progress.
* Loads resource data for the specified client.
* <p>
* If shouldUseCache is YES then an attempt
* will be made to locate a cached NSURLHandle to provide the
* resource data, otherwise a new handle will be created and
* cached.
* </p>
* <p>
* If the handle does not have the data available, it will be
* asked to load the data in the background by calling its
* loadInBackground method.
* </p>
* <p>
* The specified client (if non-nil) will be set up to receive
* notifications of the progress of the background load process.
* </p>
*/
- (void) loadResourceDataNotifyingClient: (id)client
usingCache: (BOOL)shouldUseCache
@ -944,7 +961,7 @@ static void unescape(const char *from, char * to)
}
NSMapInsert((NSMapTable*)_clients, (void*)handle, (void*)client);
[clientsLock unlock];
[handle addClient: client];
[handle addClient: self];
}
/*
@ -964,7 +981,7 @@ static void unescape(const char *from, char * to)
if (client != nil)
{
[handle removeClient: client];
[handle removeClient: self];
[clientsLock lock];
NSMapRemove((NSMapTable*)_clients, (void*)handle);
[clientsLock unlock];
@ -1326,6 +1343,11 @@ static void unescape(const char *from, char * to)
/**
* An informal protocol to which clients may conform if they wish to be
* notified of the progress in loading a URL for them. The default
* implementations of these methods do nothing.
*/
@implementation NSObject (NSURLClient)
- (void) URL: (NSURL*)sender

View file

@ -3,8 +3,8 @@
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999
Update: Richard Frith-Macdonald <rfm@gnu.org>
Date: Sep 2000
Updaten by: Richard Frith-Macdonald <rfm@gnu.org>
Date: Sep 2000, June 2002
This file is part of the GNUstep Library.
@ -43,12 +43,71 @@
@class GSFileURLHandle;
@class GSHTTPURLHandle;
/*
* Keys for NSURLHandle
*/
NSString * const NSHTTPPropertyStatusCodeKey
= "@NSHTTPPropertyStatusCodeKey";
NSString * const NSHTTPPropertyStatusReasonKey
= @"NSHTTPPropertyStatusReasonKey";
NSString * const NSHTTPPropertyServerHTTPVersionKey
= @"NSHTTPPropertyServerHTTPVersionKey";
NSString * const NSHTTPPropertyRedirectionHeadersKey
= @"NSHTTPPropertyRedirectionHeadersKey";
NSString * const NSHTTPPropertyErrorPageDataKey
= @"NSHTTPPropertyErrorPageDataKey";
/* These are GNUstep extras */
NSString * const GSHTTPPropertyMethodKey
= @"GSHTTPPropertyMethodKey";
NSString * const GSHTTPPropertyProxyHostKey
= @"GSHTTPPropertyProxyHostKey";
NSString * const GSHTTPPropertyProxyPortKey
= @"GSHTTPPropertyProxyPortKey";
/**
* <p>
* An NSURLHandle instance is used to manage the resource data
* corresponding to an NSURL object. A single NSURLHandle can
* be used to manage multiple NSURL objects as long as those
* objects all refer to the same resource.
* </p>
* <p>
* Different NSURLHandle subclasses are used to manage different
* types of URL (usually based on the scheme of the URL), and you
* can register new subclasses to extend (or replace) the
* standard ones.
* </p>
* <p>
* GNUstep comes with private subclasses to handle the common
* URL schemes -
* </p>
* <list>
* <item>
* <code>file:</code> (local file I/O)
* </item>
* <item>
* <code>http:</code> and <code>shttp:</code> (webserver) access.
* </item>
* </list>
*/
@implementation NSURLHandle
static NSLock *registryLock = nil;
static NSMutableArray *registry = nil;
static Class NSURLHandleClass = 0;
/**
* Return a handle for the specified URL from the cache if possible.
* If the cache does not contain a matching handle, returns nil.
*/
+ (NSURLHandle*) cachedHandleForURL: (NSURL*)url
{
/*
@ -75,6 +134,11 @@ static Class NSURLHandleClass = 0;
}
}
/** <override-subclass />
* Implemented by subclasses to say which URLs they can handle.
* This method is used to determine which subclasses can be used
* to handle a particular URL.
*/
+ (BOOL) canInitWithURL: (NSURL*)url
{
/*
@ -95,6 +159,9 @@ static Class NSURLHandleClass = 0;
}
}
/**
* Used to register a subclass as being available to handle URLs.
*/
+ (void) registerURLHandleClass: (Class)urlHandleSubclass
{
/*
@ -117,6 +184,11 @@ static Class NSURLHandleClass = 0;
[registryLock unlock];
}
/**
* Returns the most recently registered NSURLHandle subclass that
* responds to -canInitWithURL: with YES.
* If there is no such subclass, returns nil.
*/
+ (Class) URLHandleClassForURL: (NSURL*)url
{
unsigned count;
@ -151,8 +223,9 @@ static Class NSURLHandleClass = 0;
return c;
}
/*
* Add a client object, making sure that it doesn't occur more than once.
/**
* Add a client object, making sure that it doesn't occur more than once.<br />
* The client object will receive messages notifying it of events on the handle.
*/
- (void) addClient: (id <NSURLHandleClient>)client
{
@ -162,6 +235,11 @@ static Class NSURLHandleClass = 0;
RELEASE((id)client);
}
/**
* Returns the resource data that is currently available for the
* handle. This may be a partially loaded resource or may be
* empty of no data has been loaded yet.
*/
- (NSData*) availableResourceData
{
if (_status == NSURLHandleLoadInProgress)
@ -171,6 +249,12 @@ static Class NSURLHandleClass = 0;
return _data;
}
/**
* This method should be called when a background load fails.<br />
* The method passes the failure notification to the clients of
* the handle - so subclasses should call super's implementation
* at the end of their implementation of this method.
*/
- (void) backgroundLoadDidFailWithReason: (NSString*)reason
{
NSEnumerator *enumerator = [_clients objectEnumerator];
@ -186,6 +270,11 @@ static Class NSURLHandleClass = 0;
}
}
/**
* This method is called by when a background load begins.
* Subclasses should call super's implementation at
* the end of their implementation of this method.
*/
- (void) beginLoadInBackground
{
_status = NSURLHandleLoadInProgress;
@ -196,6 +285,12 @@ static Class NSURLHandleClass = 0;
withObject: self];
}
/**
* This method should be called to cancel a load currently in
* progress. The method calls -endLoadInBackground
* Subclasses should call super's implementation at
* the end of their implementation of this method.
*/
- (void) cancelLoadInBackground
{
[_clients makeObjectsPerformSelector:
@ -212,8 +307,8 @@ static Class NSURLHandleClass = 0;
[super dealloc];
}
/*
* Mathod called by subclasses during process of loading a resource.
/**
* Method called by subclasses during process of loading a resource.
* The base class maintains a copy of the data being read in and
* accumulates separate parts of the data.
*/
@ -276,12 +371,22 @@ static Class NSURLHandleClass = 0;
}
}
/**
* This method is called to stop any background loading process.
* -cancelLoadInBackground uses this method to cancel loading.
* Subclasses should call super's implementation at
* the end of their implementation of this method.
*/
- (void) endLoadInBackground
{
_status = NSURLHandleNotLoaded;
DESTROY(_data);
}
/**
* Returns the failure reason for the last failure to load
* the resource data.
*/
- (NSString*) failureReason
{
if (_status == NSURLHandleLoadFailed)
@ -290,6 +395,9 @@ static Class NSURLHandleClass = 0;
return nil;
}
/**
* Flushes any cached resource data.
*/
- (void) flushCachedData
{
DESTROY(_data);
@ -300,6 +408,11 @@ static Class NSURLHandleClass = 0;
return [self initWithURL: nil cached: NO];
}
/** <init />
* Initialises a handle with the specified URL.<br />
* The flag determines whether the handle will cache resource data
* and respond to requests from equivalent URLs for the cached data.
*/
- (id) initWithURL: (NSURL*)url
cached: (BOOL)cached
{
@ -308,8 +421,10 @@ static Class NSURLHandleClass = 0;
return self;
}
/*
* Do a background load by using loadInForeground -
/**
* Starts (or queues) loading of the handle's resource data
* in the background (asynchronously).<br />
* The default implementation uses loadInForeground -
* if this method is not overridden, loadInForeground MUST be.
*/
- (void) loadInBackground
@ -328,8 +443,10 @@ static Class NSURLHandleClass = 0;
}
}
/*
* Do a foreground load by using loadInBackground -
/**
* Loads the handle's resource data in the foreground (synchronously).<br />
* The default implementation starts a background load and waits for
* it to complete -
* if this method is not overridden, loadInBackground MUST be.
*/
- (NSData*) loadInForeground
@ -348,23 +465,39 @@ static Class NSURLHandleClass = 0;
return _data;
}
/** <override-subclass />
* Returns the property for the specified key, or nil if the
* key does not exist.
*/
- (id) propertyForKey: (NSString*)propertyKey
{
[self subclassResponsibility: _cmd];
return nil;
}
/** <override-subclass />
* Returns the property for the specified key, but only if the
* handle does not need to do any work to retrieve it.
*/
- (id) propertyForKeyIfAvailable: (NSString*)propertyKey
{
[self subclassResponsibility: _cmd];
return nil;
}
/**
* Removes an object from them list of clients notified of
* resource loading events by the URL handle.
*/
- (void) removeClient: (id <NSURLHandleClient>)client
{
[_clients removeObjectIdenticalTo: client];
}
/**
* Returns the resource data belonging to the handler.
* Calls -loadInForeground if necessary.
*/
- (NSData*) resourceData
{
if (_status == NSURLHandleLoadSucceeded)
@ -387,17 +520,42 @@ static Class NSURLHandleClass = 0;
}
}
/**
* Returns the current status of the handle.
*/
- (NSURLHandleStatus) status
{
return _status;
}
/**
* <p>
* Writes resource data to the handle. Returns YES on success,
* NO on failure.
* </p>
* <p>
* The GNUstep implementation for HTTP/HTTPS sets the specified data as
* information to be POSTed to the URL next time it is loaded.
* </p>
*/
- (BOOL) writeData: (NSData*)data
{
[self subclassResponsibility: _cmd];
return NO;
}
/**
* <p>
* Sets a property for handle.
* Returns YES on success, NO on failure.
* </p>
* <p>
* The GNUstep implementation sets the property as a header
* to be sent the next time the URL is loaded, and recognizes
* some special property keys which control the behavior of
* the next load.
* </p>
*/
- (BOOL) writeProperty: (id)propertyValue
forKey: (NSString*)propertyKey
{
@ -414,6 +572,19 @@ static Class NSURLHandleClass = 0;
}
@end
/**
* <p>
* This is a <em>PRIVATE</em> subclass of NSURLHandle.
* It is documented here in order to give you information about the
* default behavior of an NSURLHandle created to deal with a URL
* that has the FILE scheme. The name and/or other
* implementation details of this class may be changed at any time.
* </p>
* <p>
* A GSFileURLHandle instance is used to manage files on the local
* file-system of your machine.
* </p>
*/
@implementation GSFileURLHandle
static NSMutableDictionary *fileCache = nil;
@ -538,6 +709,11 @@ static NSLock *fileLock = nil;
return d;
}
/**
* Gets file attribute information for the file represented by
* the handle, using the same dictionary keys as the
* <ref class="NSFileManager">NSFileManager</ref> class.
*/
- (id) propertyForKey: (NSString*)propertyKey
{
NSDictionary *dict;
@ -554,6 +730,10 @@ static NSLock *fileLock = nil;
return [_attributes objectForKey: propertyKey];
}
/**
* Writes the specified data as the contents of the file
* represented by the handle.
*/
- (BOOL) writeData: (NSData*)data
{
if ([data writeToFile: _path atomically: YES] == YES)
@ -564,6 +744,11 @@ static NSLock *fileLock = nil;
return NO;
}
/**
* Changes the attributes of the file represented by this handle.
* This method uses the same dictionary keys as the
* <ref class="NSFileManager">NSFileManger</ref> class.
*/
- (BOOL) writeProperty: (id)propertyValue
forKey: (NSString*)propertyKey
{

View file

@ -292,6 +292,55 @@ mapClassName(NSUnarchiverObjectInfo *info)
@implementation NSUnarchiverObjectInfo
@end
/**
* This class reconstructs objects from an archive.<br />
* <strong>Re-using the archiver</strong><br />
* <p>
* The -resetUnarchiverWithdata:atIndex: method lets you re-use
* the archive to decode a new data object or, in conjunction
* with the 'cursor' method (which reports the current decoding
* position in the archive), decode a second archive that exists
* in the data object after the first one.
* </p>
* <strong>Subclassing with different input format.</strong><br />
* NSUnarchiver normally reads directly from an NSData object using
* the methods -
* <deflist>
* <term>[-deserializeTypeTagAtCursor:]</term>
* <desc>
* to decode type tags for data items, the tag is the
* first byte of the character encoding string for the
* data type (as provided by '@encode(xxx)'), possibly
* with the top bit set to indicate that what follows is
* a crossreference to an item already encoded.
* </desc>
* <term>[-deserializeCrossRefAtCursor:]</term>
* <desc>
* to decode a crossreference number either to identify the
* following item, or to refer to a previously encoded item.
* Objects, Classes, Selectors, CStrings and Pointer items
* have crossreference encoding, other types do not.
* </desc>
* <term>[-deserializeData:ofObjCType:atCursor:context:]</term>
* <desc>
* to decode all other information.
* </desc>
* </deflist>
* <p>
* And uses other NSData methods to read the archive header information
* from within the method:
* [-deserializeHeaderAt:version:classes:objects:pointers:]
* to read a fixed size header including archiver version
* (obtained by [self systemVersion]) and crossreference
* table sizes.
* </p>
* <p>
* To subclass NSUnarchiver, you must implement your own versions of the
* four methods above, and override the 'directDataAccess' method to
* return NO so that the archiver knows to use your serialization
* methods rather than those in the NSData object.
* </p>
*/
@implementation NSUnarchiver
@class NSDataMalloc;

View file

@ -70,8 +70,6 @@ NSString *NSPortDidBecomeInvalidNotification;
/* RunLoop modes */
NSString *NSDefaultRunLoopMode;
NSString *NSConnectionReplyMode;
@ -263,27 +261,6 @@ NSString *NSConnectionLocalCount;
NSString *NSConnectionProxyCount;
/*
* Keys for NSURLHandle
*/
NSString *NSHTTPPropertyStatusCodeKey;
NSString *NSHTTPPropertyStatusReasonKey;
NSString *NSHTTPPropertyServerHTTPVersionKey;
NSString *NSHTTPPropertyRedirectionHeadersKey;
NSString *NSHTTPPropertyErrorPageDataKey;
/* These are GNUstep extras */
NSString *GSHTTPPropertyMethodKey;
NSString *GSHTTPPropertyProxyHostKey;
NSString *GSHTTPPropertyProxyPortKey;
/* Class description notification */
NSString *NSClassDescriptionNeededForClassNotification;
@ -357,8 +334,6 @@ GSBuildStrings()
= [[SClass alloc] initWithCString: "NSDecimalDigits"];
NSDecimalSeparator
= [[SClass alloc] initWithCString: "NSDecimalSeparator"];
NSDefaultRunLoopMode
= [[SClass alloc] initWithCString: "NSDefaultRunLoopMode"];
NSEarlierTimeDesignations
= [[SClass alloc] initWithCString: "NSEarlierTimeDesignations"];
NSFileDeviceIdentifier
@ -494,24 +469,6 @@ GSBuildStrings()
StreamException
= [[SClass alloc] initWithCString: "StreamException"];
NSHTTPPropertyStatusCodeKey
= [[SClass alloc] initWithCString: "HTTPPropertyStatusCodeKey"];
NSHTTPPropertyStatusReasonKey
= [[SClass alloc] initWithCString: "HTTPPropertyStatusReasonKey"];
NSHTTPPropertyServerHTTPVersionKey
= [[SClass alloc] initWithCString: "HTTPPropertyServerHTTPVersionKey"];
NSHTTPPropertyRedirectionHeadersKey
= [[SClass alloc] initWithCString: "HTTPPropertyRedirectionHeadersKey"];
NSHTTPPropertyErrorPageDataKey
= [[SClass alloc] initWithCString: "HTTPPropertyErrorPageDataKey"];
GSHTTPPropertyMethodKey
= [[SClass alloc] initWithCString: "GSHTTPPropertyMethodKey"];
GSHTTPPropertyProxyHostKey
= [[SClass alloc] initWithCString: "GSHTTPPropertyProxyHostKey"];
GSHTTPPropertyProxyPortKey
= [[SClass alloc] initWithCString: "GSHTTPPropertyProxyPortKey"];
NSClassDescriptionNeededForClassNotification
= [[SClass alloc] initWithCString:
"NSClassDescriptionNeededForClassNotification"];

View file

@ -1674,7 +1674,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
else
{
NSLog(@"Non-block element '%@' in block ...", n);
return node;
return nil;
}
}

View file

@ -1902,6 +1902,17 @@ fail:
methods = [self parseMethodsAreDeclarations: YES];
if (methods != nil && [methods count] > 0)
{
NSEnumerator *e = [methods objectEnumerator];
NSMutableDictionary *m;
/*
* Mark methods as implemented because protocol methods have no
* implementation separate from their declaration.
*/
while ((m = [e nextObject]) != nil)
{
[m setObject: @"YES" forKey: @"Implemented"];
}
[dict setObject: methods forKey: @"Methods"];
}
@ -1914,6 +1925,10 @@ fail:
[info setObject: d forKey: @"Protocols"];
RELEASE(d);
}
/*
* A protocol has no separate implementation, so mark it as implemented.
*/
[dict setObject: @"YES" forKey: @"Implemented"];
[d setObject: dict forKey: unitName];
// [self log: @"Found protocol %@", dict];
@ -2594,15 +2609,15 @@ fail:
line = [comment substringWithRange: r];
line = [line stringByTrimmingSpaces];
if (haveSource == NO)
{
haveSource = YES;
[source removeAllObjects]; // remove default.
}
if ([line length] > 0
&& [source containsObject: line] == NO)
{
if (haveSource == NO)
{
[source removeAllObjects]; // remove default.
}
[source addObject: line];
haveSource = YES;
}
i = NSMaxRange(r);
r = NSMakeRange(i, commentLength - i);