The base class for objects in the Foundation framework. More...
#import <Foundation/Foundation.h>


Instance Methods | |
| (void) | - dealloc |
| Frees the instance. More... | |
| (NXZone *) | - zone |
| Returns the zone in which the instance was allocated. More... | |
| (id) | - retain |
| Increases the retain count of the receiver. More... | |
| (void) | - release |
| Decreases the retain count of the receiver. More... | |
| (id) | - autorelease |
| Releases the receiver later, when the current autorelease pool of the thread is drained. More... | |
| (id) | - copy |
| Returns a copy which can't be changed by anything else, which the caller owns and has to release. More... | |
| (uintptr_t) | - hash |
| Returns a number for the object, which is the same for objects which are equal by isEqual:. More... | |
| (NXString *) | - description |
| Returns a string which describes the instance, for logging. More... | |
Instance Methods inherited from Object | |
| (id) | - init |
| Initialize the instance, after allocation. More... | |
| (Class) | - class |
| Returns the class of the instance. More... | |
| (Class) | - superclass |
| Returns the superclass of the instance. More... | |
| (BOOL) | - isEqual: |
| Compares the receiver to another object for equality. More... | |
| (BOOL) | - isKindOfClass: |
| Returns a Boolean value that indicates whether the receiver is an instance of a given class. More... | |
| (BOOL) | - conformsTo: |
| Checks if the receiver's class conforms to a protocol. More... | |
Instance Methods inherited from <ObjectProtocol> | |
| (BOOL) | - respondsToSelector: |
| Checks if the receiver responds to a selector. More... | |
Class Methods | |
| (id) | + alloc |
| Allocates a new instance in the default zone, or if there isn't one, with sys_calloc(). More... | |
| (id) | + allocWithZone: |
| Allocates a new instance in a specific zone. More... | |
| (id) | + new |
| Allocates and initializes a new instance, as [[cls alloc] init] does. More... | |
| (NXString *) | + description |
| Returns the name of the class. | |
Class Methods inherited from Object | |
| (void) | + initialize |
| Performs one-time initialization for the class. More... | |
| (Class) | + class |
| Returns the class object. More... | |
| (Class) | + superclass |
| Returns the superclass of the class. More... | |
| (const char *) | + name |
| Returns the name of the class. More... | |
| (BOOL) | + conformsTo: |
| Checks if the class conforms to a protocol. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Object | |
| Class | isa |
| A pointer to the object's class structure. More... | |
The base class for objects in the Foundation framework.
NXObject adds memory management to the root Object class: instances are allocated, and are freed once they've been released as many times as they've been retained.
Instances are allocated in the default zone, or if there isn't one, with sys_calloc(). See NXZone.
It has no instance variables of its own: the zone and the retain count are kept in memory just before the instance. That's because the compiler lays out constant strings, so their superclasses can't have any.
Any thread can retain, release and autorelease an object, except an NXAutoreleasePool, which is released by the thread which initialized it. See Threads and mutable objects.
Definition at line 28 of file NXObject.h.
| + (id) alloc |
Allocates a new instance in the default zone, or if there isn't one, with sys_calloc().
Allocates a new instance in a specific zone.
| zone | The zone in which to allocate the new instance. If it's nil, this is the same as alloc. |
| - (id) autorelease |
Releases the receiver later, when the current autorelease pool of the thread is drained.
Panics if there's no pool.
| - (id) copy |
Returns a copy which can't be changed by anything else, which the caller owns and has to release.
An object which can't be changed returns itself, retained, which is what this does unless it's overridden. One which can, such as an NXMutableString or NXArray, returns a new object with the same contents, in the same zone.
Implemented in NXMap, NXArray, NXData, and NXMutableString.
| - (void) dealloc |
Frees the instance.
This is called when the retain count reaches zero, and shouldn't be called otherwise. Subclasses which override it should free their own resources, and then call the superclass.
Implemented in NXZone.
| - (NXString *) description |
| - (uintptr_t) hash |
Returns a number for the object, which is the same for objects which are equal by isEqual:.
Unless it's overridden, that's the address of the object, as objects are only equal to themselves. An object mustn't change while something depends on its hash, such as while it's a key in a map.
Implemented in NXDate, NXString, NXMap, NXArray, NXNumber, and NXData.
| + (id) new |
Allocates and initializes a new instance, as [[cls alloc] init] does.
| - (void) release |
Decreases the retain count of the receiver.
If it becomes zero, the receiver is deallocated.
| - (id) retain |
Increases the retain count of the receiver.
| - (NXZone *) zone |
Returns the zone in which the instance was allocated.