Up

# NSProxy class reference

### Authors

Richard Frith-Macdonald (`richard@brainstorm.co.uk`)

Copyright: (C) 1997 Free Software Foundation, Inc.

# Software documentation for the NSProxy class

## NSProxy

> Declared in:
>   Foundation/NSProxy.h

> Conforms to:
>   NSObject

Availability: OpenStep

The NSProxy class provides a basic implementation of a class whose instances are used to stand in for other objects.
The class provides the most basic methods of NSObject, and expects messages for other methods to be forwarded to the real object represented by the proxy. You must subclass NSProxy to implement -forwardInvocation: to these real objects.

Note that `NSProxy` is a different sort of class than others in the GNUstep Base library in that it is the only example of a root class besides NSObject . Thus, it implements the `NSObject` protocol but is not a subclass of NSObject.

Instance Variables
Method summary

- +alloc
- +allocWithZone:
- +autorelease
- +class
- +description
- +isKindOfClass:
- +isMemberOfClass:
- +load
- +release
- +respondsToSelector:
- +retain
- +retainCount
- -autorelease
- -class
- -conformsToProtocol:
- -dealloc
- -description
- -forwardInvocation:
- -hash
- -init
- -isEqual:
- -isKindOfClass:
- -isMemberOfClass:
- -isProxy
- -methodSignatureForSelector:
- -release
- -respondsToSelector:
- -retain
- -retainCount
- -self
- -superclass
- -zone

### alloc

+ (id) alloc;
Availability: OpenStep
Allocates and returns an NSProxy instance in the default zone.

### allocWithZone:

+ (id) allocWithZone: (NSZone*)z;
Availability: OpenStep
Allocates and returns an NSProxy instance in the specified zone z.

### autorelease

+ (id) autorelease;
Availability: OpenStep
Returns the receiver.

### class

+ (Class) class;
Availability: OpenStep
Returns the receiver.

### description

+ (NSString*) description;
Availability: OpenStep
Returns a string describing the receiver.

### isKindOfClass:

+ (BOOL) isKindOfClass: (Class)aClass;
Availability: OpenStep
Returns `NO`... the NSProxy class cannot be an instance of any class.

### isMemberOfClass:

+ (BOOL) isMemberOfClass: (Class)aClass;
Availability: OpenStep
Returns `YES` if aClass is identical to the receiver, `NO` otherwise.

### load

+ (void) load;
Availability: OpenStep
An empty method provided for subclasses to override.
A dummy method...

### release

+ (oneway void) release;
Availability: OpenStep
An empty method provided for subclasses to override.
A dummy method to ensure that the class can safely be held in containers.

### respondsToSelector:

+ (BOOL) respondsToSelector: (SEL)aSelector;
Availability: OpenStep
Returns `YES` if the receiver responds to aSelector, `NO` otherwise.

### retain

+ (id) retain;
Availability: OpenStep
Returns the receiver.

### retainCount

+ (NSUInteger) retainCount;
Availability: OpenStep
Returns the maximum unsigned integer value.

### autorelease

- (id) autorelease;
Availability: OpenStep
Adds the receiver to the current autorelease pool and returns self.

### class

- (Class) class;
Availability: OpenStep
Returns the class of the receiver.

### conformsToProtocol:

- (BOOL) conformsToProtocol: (Protocol*)aProtocol;
Availability: OpenStep
Calls the -forwardInvocation: method to determine if the 'real' object referred to by the proxy conforms to aProtocol. Returns the result.
NB. The default operation of -forwardInvocation: is to raise an exception.

### dealloc

- (void) dealloc;
Availability: OpenStep
Frees the memory used by the receiver.

### description

- (NSString*) description;
Availability: OpenStep
Returns a text description of the receiver.

### forwardInvocation:

- (void) forwardInvocation: (NSInvocation*)anInvocation;
Availability: OpenStep
Subclasses must override this method.
Raises an `NSInvalidArgumentException`.

### hash

- (NSUInteger) hash;
Availability: OpenStep
Returns the address of the receiver... so it can be stored in a dictionary.

### init

- (id) init;
Availability: OpenStep
This is a designated initialiser for the class.
Subclasses must override this method.
Initialises the receiver and returns the resulting instance.

### isEqual:

- (BOOL) isEqual: (id)anObject;
Availability: OpenStep
Tests for pointer equality with anObject.

### isKindOfClass:

- (BOOL) isKindOfClass: (Class)aClass;
Availability: OpenStep
Calls the -forwardInvocation: method to determine if the 'real' object referred to by the proxy is an instance of the specified class. Returns the result.
NB. The default operation of -forwardInvocation: is to raise an exception.

### isMemberOfClass:

- (BOOL) isMemberOfClass: (Class)aClass;
Availability: OpenStep
Calls the -forwardInvocation: method to determine if the 'real' object referred to by the proxy is an instance of the specified class. Returns the result.
NB. The default operation of -forwardInvocation: is to raise an exception.

### isProxy

- (BOOL) isProxy;
Availability: OpenStep
Returns `YES`.

### methodSignatureForSelector:

- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector;
Availability: OpenStep
If we respond to the method directly, create and return a method signature. Otherwise raise an exception.

### release

- (oneway void) release;
Availability: OpenStep
Decrement the retain count for the receiver... deallocate if it would become negative.

### respondsToSelector:

- (BOOL) respondsToSelector: (SEL)aSelector;
Availability: OpenStep
If we respond to the method directly, return `YES`, otherwise forward this request to the object we are acting as a proxy for.

### retain

- (id) retain;
Availability: OpenStep
Increment the retain count for the receiver.

### retainCount

- (NSUInteger) retainCount;
Availability: OpenStep
Return the retain count for the receiver.

### self

- (id) self;
Availability: OpenStep
Returns the receiver.

### superclass

- (Class) superclass;
Availability: OpenStep
Returns the superclass of the receiver's class.

### zone

- (NSZone*) zone;
Availability: OpenStep
Returns the zone in which the receiver was allocated.

## Instance Variables for NSProxy Class

### isa

@public Class isa;
Availability: OpenStep
Description forthcoming.

Up