// method performed should return a 32-bit quantity
- (BOOL)isProxy;
- (BOOL)isKindOfClass:(Class)aClass;
- (BOOL)isMemberOfClass:(Class)aClass;
- (BOOL)conformsToProtocol:(Protocol *)aProtocol;
- (BOOL)respondsToSelector:(SEL)aSelector;
- (id)retain;
/* default for NSObject is to externally increment the ref count;
subclasses may redefine if they have their own reference counting scheme, but should not call super;
For convenience only, retain returns self; no other object should be returned than self */
- (oneway void)release;
/* default for NSObject is to externally decrement the reference count and to perform dealloc if zero;
subclasses may redefine if they have their own reference counting scheme, but should not call super */
- (id)autorelease;
/* Inserts the object in the current delayed free pool, and returns the object itself for convenience;
*/
- (unsigned)retainCount;
/* Method that should only be used for DEBUG or very unusual ref-counting strategies!
default for NSObject is to return the externally maintained ref count;
subclasses may should override this method if they implement their own refcounting scheme.
This method is only used by foundation during debug, when "enableDoubleFreeCheck" (or the dwrite NSDisableDoubleFreeCheck) has been set to check for overfreeing, or over autoreleasing of objects.
For objects which never get released (i.e. their release method is a no-op), this method should return UINT_MAX. */
- (NSString *)description;
/* Human-readable NSString */
@end
@protocol NSCopying
- (id)copyWithZone:(NSZone *)zone;
/* expresses snapshots of objects.
Typical usage is for 'passing by value' value objects. The only
guarantee of the snapshot operation for classes that implement the
NSCopying protocol is that:
-copyWithZone: will yield a functional object as long as you don't
change the returned value.
That snapshot operation does not preserve class mutability (for classes
for which that makes sense). Immutability of the returned value is not
guaranteed in general either, although Property List classes (NSString,
NSData, NSArray, NSDictionary) guarantee immutable returned values.
This method is an exception to the allocation rule: returned value is
owned by caller who is responsible for releasing it;
zone may be NULL */
@end
@protocol NSMutableCopying
- (id)mutableCopyWithZone:(NSZone *)zone;
/* This should be implemented by cluster of classes that differentiate between mutable and immutable objects (such as the basic property list classes)
It should yield a mutable copy, owned by the caller;
zone may be NULL */
@end
@protocol NSCoding
/* The NSCoding protocol is implemented by objects that wish to be persistent and/or distributed */
- (void)encodeWithCoder:(NSCoder *)aCoder;
/* Object should store its state onto aCoder;
First thing should be to call [super encodeWithCoder:] if self's superclass conforms to <NSCoding>;
Note that NSObject does NOT conform to <NSCoding>, and therefore subclasses of NSObject that do <NSCoding> should NOT call super. */
- (id)initWithCoder:(NSCoder *)aDecoder;
/* Called with a freshly allocated object;
should ask its super to reestablish its state, and then fill itself with data obtained from aDecoder;
When the exact format of the parent classes serialization is known,
the object can replace itself by another object. In that case,
-initWithCoder: must deallocate self, and take total responsability
of the deserialization. Also, there is a restriction that the original
object must not appear more than once in the encoding graph;
NSObject does not implement this method! */
@end
/*********** Base class ***********/
@interface NSObject <NSObject> {
Class isa;
}
+ (void)load;
+ (id)initialize;
- (id)init;
- (void)dealloc;
/* deallocates self;
subclasses should release their instance variables and call [super dealloc] */
+ (id)new;
+ (id)allocWithZone:(NSZone *)zone;
/* zone passed may be NULL */
+ (id)alloc;
- (id)copy;
/* Convenience for implementors of <NSCopying>: just calls copyWithZone:, which raises (unless defined by a subclass) */
- (id)mutableCopy;
/* Convenience for implementors of <NSMutableCopying>: just calls mutableCopyWithZone:, which raises (unless defined by a subclass) */
+ (id)copyWithZone:(NSZone *)zone;
+ (id)mutableCopyWithZone:(NSZone *)zone;
/* Convenience -- classes can be dictionary keys */