This is NSObject.h in view mode; [Download] [Up]
/* Interface for NSObject class
*
* Copyright (C) 1994 The Board of Trustees of
* The Leland Stanford Junior University. All Rights Reserved.
*
* Author: Paul F. Kunz
*
* This file is part of an Objective-C class library
*
* Based on:
* (Preliminary Documentation) Copyright (c) 1994 by NeXT Computer, Inc.
* All Rights Reserved.
*
* NSObject.h,v 1.3 1995/03/28 23:56:09 fedor Exp
*/
#ifndef __NSObject_INCLUDE_GNU
#define __NSObject_INCLUDE_GNU
#ifdef __NeXT__
#include <objc/objc.h>
#else
#include <objc/objc-api.h>
#endif
#include "nsTimer.h"
#include <foundation/zone.h>
@class NSArchiver, NSCoder, NSMethodSignature, NSString, Protocol;
@protocol NSObject
// NSObject protocol
// Identifying and Comparing Instances
- (unsigned)hash;
/*
* Returns an unsigned integer that can be used as a table address in a hash
* table structure. Two objects that are equal must hash to the same value.
*/
- (BOOL)isEqual:(id)anObject;
/*
* Returns YES if the receiver and anObject have equal values; otherwise
* returns NO.
*/
- (id)self;
/*
* Returns the receiver.
*/
// Identifying Class and Superclass
- (Class)class;
/*
* Returns the class object for the receiver's class.
*/
- (Class) superclass;
/*
* Returns the class object for the receiver 's superclass.
*/
// Determining Allocation Zones
- (NSZone *)zone;
/*
* Returns a pointer to the zone from which the receiver was allocated.
*/
// Sending Messages Determined at Run Time
- (id)perform:(SEL)aSelector;
/*
* Sends an aSelector message to the receiver and returns the result of the
* message. If aSelector is null, an NSInvalidArgumentException is raised.
*/
- (id)perform:(SEL)aSelector
withObject:(id)anObject;
/*
* Sends an aSelector message to the receiver with anObject as an argument.
* If aSelector is null, an NSInvalidArgumentException is raised.
*/
- (id)perform:(SEL)aSelector
withObject:(id)anObject
withObject:(id)anotherObject;
/*
* Sends the receiver an aSelector message with anObject and anotherObject
* as arguments. If aSelector is null, an withObject:(id)anotherObject
* NSInvalidArgumentException is raised.
*/
// Identifying Proxies
- (BOOL)isProxy;
/*
* Returns YES to indicate that the receiver is an NSProxy, rather than an
* object that descends from NSObject. Otherwise, it returns NO.
*/
// Testing Inheritance Relationships
- (BOOL)isKindOfClass:(Class)aClass;
/*
* Returns YES if the receiver is an instance of aClass or an instance of
* any class that inherits from aClass. Otherwise, it returns NO.
*/
- (BOOL)isMemberOfClass:(Class)aClass;
/*
* Returns YES if the receiver is an instance of aClass. Otherwise, it
* returns NO.
*/
// Testing for Protocol Conformance
- (BOOL)conformsToProtocol:(Protocol *)aProtocol;
/*
* Returns YES if the class of the receiver conforms to aProtocol, and NO if
* it doesn't.
*/
// Testing Class Functionality
- (BOOL)respondsToSelector:(SEL)aSelector;
/*
* Returns YES if the receiver implements or inherits a method that can
* respond to aSelector messages, and NO if it doesn't.
*/
// Managing Reference Counts
// - (id)autorelease;
/*
* As defined in the NSObject class, decrements the receiver's reference
* count. When the count reaches 0, adds the object to the current
* autorelease pool. Returns self. Objects in the pool are released later,
* typically at the top of the event loop.
*/
// - (oneway void)release;
/*
* As defined in the NSObject class, decrements the receiver's reference
* count. When the count reaches 0, the object is automatically deallocated
* immediately.
*/
// - (id)retain;
/*
* As defined in the NSObject class, retain increments the receiver's
* reference count. You send an object a retain message when you want to
* prevent it from being deallocated without your express permission.
* Returns self.
*/
// - (unsigned)retainCount;
/*
* Returns the receiver's reference count for debugging purposes.
*/
// Describing the Object
// - (NSString *)description;
/*
* Returns a human readable description of the receiver.
*/
@end
@protocol NSCoding
- (void)encodeWithCoder:(NSCoder *)aCoder;
/*
* Serializes the receiver using aCoder.
*/
- (id)initWithCoder:(NSCoder *)aDecoder;
/*
* Initializes new instance from data in aDecoder.
*/
@end
@interface NSObject <NSCoding, NSObject>
{
struct objc_class *isa; /* NeXT's 'Class' includes the '*' */
}
// Initializing the Class
+ (void)initialize;
/*
* Initializes the class before it's used (before it receives its first
* message).
*/
// Creating and Destroying Instances
+ (id)alloc;
/*
* Returns a new, uninitialized instance of the receiving class.
*/
+ (id)allocWithZone:(NSZone *)zone;
/*
* Returns a new, uninitialized instance of the receiving class in zone.
*/
+ (id)new;
/*
* Allocates a new instance of the receiving class, sends it an init
* message, and returns the initialized object returned by init.
*/
- (id)copy;
/*
* Invokes copyWithZone:.
*/
- (void)dealloc;
/*
* Deallocates the memory occupied by the receiver.
*/
- (id)init;
/*
* Implemented by subclasses to initialize a new object (the receiver)
* immediately after memory for it has been allocated.
*/
- (id)mutableCopy;
/*
* Invokes mutableCopyWithZone:.
*/
// Identifying Classes
+ (Class)class;
/*
* Returns self. Since this is a class method, it returns the class object.
*/
+ (Class)superclass;
/*
* Returns the class object for the receiver's superclass.
*/
// Testing Class Functionality
+ (BOOL)instancesRespondToSelector:(SEL)aSelector;
/*
* Returns YES if instances of the class are capable of responding to
* aSelector messages, and NO if they're not.
*/
// Testing Protocol Conformance
// + (BOOL)conformsToProtocol:(Protocol *)aProtocol;
/*
* Returns YES if the receiving class conforms to aProtocol, and NO if it
* doesn't.
*/
// Obtaining Method Information
+ (IMP)instanceMethodForSelector:(SEL)aSelector;
/*
* Locates and returns the address of the implementation of the aSelector
* instance method.
*/
- (IMP)methodForSelector:(SEL)aSelector;
/*
* Locates and returns the address of the receiver's implementation of the
* aSelector method, so that it can be called as a function.
*/
// - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
/*
* Returns an object that contains a description of the aSelector method, or
* nil if the aSelector method can't be found.
*/
// Describing Objects
// + (NSString *)description;
/*
* Subclasses override this method to return a human-readable string
* representation of the contents of the receiver. NSObject's
* implementation simply prints the name of the receiver's class.
*/
// Posing
+ (void)poseAsClass:(Class)aClass;
/*
* Causes the receiving class to ªpose asº its superclass.
*/
// Error Handling
- (void)doesNotRecognizeSelector:(SEL)aSelector;
/*
* Handles aSelector messages that the receiver doesn't recognize.
*/
// Sending Messages Determined at Run Time
// + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget
// selector:(SEL)aSelector
// object:(id)anObject;
/*
* Cancels previous perform requests having the same target and argument (as
* determined by isEqual:), and the same selector. This method removes
* timers only in the current run loop, not all run loops.
*/
// - (void)performSelector:(SEL)aSelector
// object:(id)anObject
// afterDelay:(NSTimeInterval)delay;
/*
* Sends an aSelector message to anObject after delay. self and anObject
* are retained until after the action is executed.
*/
// Forwarding Messages
// - (void)forwardInvocation:(NSInvocation *)anInvocation
/*
* Implemented by subclasses to forward messages to other objects.
*/
// Archiving
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;
/*
* Implemented by subclasses to reinitialize the receiver. The NSObject
* implementation of this method simply returns self.
*/
- (Class)classForArchiver;
/*
* Identifies the class to be used during archiving. NSObject's
* implementation returns the object returned by classForCoder:.
*/
- (Class)classForCoder;
/*
* Identifies the class to be used during serialization. An NSObject
* returns its own class by default.
*/
- (id)replacementObjectForArchiver:(NSArchiver *)anArchiver;
/*
* Allows an object to substitute another object for itself during
* archiving. NSObject's implementation returns the object returned by
* replacementObjectForCoder:.
*/
- (id)replacementObjectForCoder:(NSCoder *)anEncoder;
/*
* Allows an object to substitute another object for itself during
* serialization. NSObject's implementation returns self.
*/
+ (void)setVersion:(int)version;
/*
* Sets the class version number to version.
*/
+ (int)version;
/*
* Returns the version of the class definition.
*/
@end
@protocol NSCopying
// Copying Objects
- (id)copyWithZone:(NSZone *)zone;
/*
* Returns a new instance that's a functional copy of the receiver. Memory
* for the new instance is allocated from zone. For collections, creates a
* deep (recursive) copy.
*/
@end
@protocol NSMutableCopying
// Making Mutable Copies of Objects
- (id)mutableCopyWithZone:(NSZone *)zone;
/*
* Returns a new instance that's a top level, mutable copy of the receiver.
* For a collection, objects in the collection are retained. Memory for the
* new instance is allocated from zone.
*/
@end
#endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.