Class CPObject

CPObject
Direct Known Subclasses:
AppController, CAAnimation, CALayer, CAMediaTimingFunction, CPAnimation, CPArray, CPBundle, CPCib, CPCoder, CPCollectionViewItem, CPColor, CPColorPicker, CPCookie, CPDOMDisplayServer, CPDOMWindowBridge, CPDOMWindowLayer, CPData, CPDictionary, CPDocumentController, CPDragServer, CPEnumerator, CPEvent, CPException, CPFlashMovie, CPFont, CPFontManager, CPGraphicsContext, CPImage, CPIndexSet, CPInvocation, CPJSONPConnection, CPMenu, CPMenuItem, CPNinePartImage, CPNotification, CPNotificationCenter, CPNull, CPNumber, CPPasteboard, CPPropertyListSerialization, CPResponder, CPRunLoop, CPShadow, CPSortDescriptor, CPString, CPTabViewItem, CPThreePartImage, CPToolbar, CPToolbarItem, CPURLConnection, CPURLRequest, CPURLResponse, CPUndoManager, CPUserSessionManager, CPValue, NSArray, NSCell, _CPCibObjectData,

@implementation CPObject

* CPObject.j * Foundation * * Created by Francisco Tolmasky. * Copyright 2008, 280 North, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


Method Summary
+(void)initialize
+(BOOL)accessInstanceVariablesDirectly
+(id)alloc
          Allocates a new instance of the receiving class.
+(Class)class
          Returns the Class object for this class definition.
+(IMP)instanceMethodForSelector:(SEL)aSelector
          Returns the address of the receiving class' method for the provided selector.
+(BOOL)instancesRespondToSelector:(SEL)aSelector
          Test whether instances of this class respond to the provided selector.
+(BOOL)isSubclassOfClass:(Class)aClass
          Returns YES if the receiving class is a subclass of aClass.
+(void)load
+(id)new
          Allocates a new instance of the receiver, and sends it an init.
+(id)setVersion:(int)aVersion
          Sets the class version number.
+(Class)superclass
          Returns the class object super class.
+(int)version
          Returns the class version number.
-(id)init
          Initializes the receiver.
-(id)autorelease
          Does nothing.
-(id)awakeAfterUsingCoder:(CPCoder)aCoder
          Subclasses override this method to possibly substitute the unarchived object with another.
-(id)awakeAfterUsingCoder:(CPCoder)aDecoder
          Called after an object is unarchived in case a different object should be used in place of it.
-(void)awakeFromCib
-(Class)class
          Returns the receiver's Class.
-(Class)classForCoder
          Can be overridden by subclasses to substitute a different class to represent the receiver during coding.
-(Class)classForKeyedArchiver
          Can be overridden by subclasses to substitute a different class to represent the receiver for keyed archiving.
-(CPString)className
          Returns the class name.
-(id)copy
          Makes a deep copy of the receiver.
-(void)dealloc
          Not necessary to call in Objective-J.
-(CPString)description
          Returns a human readable string describing the receiver.
-(void)doesNotRecognizeSelector:(SEL)aSelector
          Called by the Objective-J runtime when an object can't respond to a message.
-(void)forwardInvocation:(CPInvocation)anInvocation
          Subclasses can override this method to forward message to other objects.
-(unsigned)hash
          Returns a hash for the object.
-(BOOL)isEqual:(id)anObject
          Determines if anObject is functionally equivalent to the receiver.
-(BOOL)isKindOfClass:(Class)aClass
          Returns YES if the receiver is a aClass type, or a subtype of it.
-(BOOL)isMemberOfClass:(Class)aClass
          Returns YES if the receiver is of the aClass class type.
-(BOOL)isProxy
          Determines whether the receiver's root object is a proxy.
-(IMP)methodForSelector:(SEL)aSelector
          Returns the address of the receiver's method for the provided selector.
-(CPMethodSignature)methodSignatureForSelector:(SEL)aSelector
          Returns the method signature for the provided selector.
-(id)mutableCopy
          Creates a deep mutable copy of the receiver.
-(id)performSelector:(SEL)aSelector
          Sends the specified message to the receiver.
-(id)performSelector:(SEL)aSelector withObject:(id)anObject
          Sends the specified message to the receiver, with one argument.
-(id)performSelector:(SEL)aSelector withObject:(id)anObject withObject:(id)anotherObject
          Sends the specified message to the receiver, with two arguments.
-(void)release
          Does nothing.
-(id)replacementObjectForArchiver:(CPArchiver)anArchiver
          Can be overridden by subclasses to substitute another object during archiving.
-(id)replacementObjectForCoder:(CPCoder)aCoder
          Can be overridden by subclasses to substitute another object during coding.
-(id)replacementObjectForKeyedArchiver:(CPKeyedArchiver)anArchiver
          Can be overridden by subclasses to substitute another object during keyed archiving.
-(BOOL)respondsToSelector:(SEL)aSelector
          Tests whether the receiver responds to the provided selector.
-(id)retain
          Does nothing.
-(id)self
          Returns the receiver.
-(void)setValue:(id)aValue forKey:(CPString)aKey
-(void)setValue:(id)aValue forKeyPath:(CPString)aKeyPath
-(void)setValue:(id)aValue forUndefinedKey:(CPString)aKey
-(Class)superclass
          Returns the receiver's super class.
-(id)valueForKey:(CPString)aKey
-(id)valueForKeyPath:(CPString)aKeyPath
-(id)valueForUndefinedKey:(CPString)aKey


Method Detail

initialize

+(void)initialize

accessInstanceVariablesDirectly

+(BOOL)accessInstanceVariablesDirectly

alloc

+(id)alloc
Allocates a new instance of the receiving class

class

+(Class)class
Returns the Class object for this class definition.

instanceMethodForSelector

+(IMP)instanceMethodForSelector:(SEL)aSelector
Returns the address of the receiving class' method for the provided selector.
Parameters:
aSelector - the selector for the class method to return
Returns:
the address of the method's implementation

instancesRespondToSelector

+(BOOL)instancesRespondToSelector:(SEL)aSelector
Test whether instances of this class respond to the provided selector.
Parameters:
aSelector - the selector for which to test the class
Returns:
YES if instances of the class respond to the selector

isSubclassOfClass

+(BOOL)isSubclassOfClass:(Class)aClass
Returns YES if the receiving class is a subclass of aClass.
Parameters:
aClass - the class to test inheritance from

load

+(void)load

new

+(id)new
Allocates a new instance of the receiver, and sends it an init
Returns:
the new object

setVersion

+(id)setVersion:(int)aVersion
Sets the class version number.
Parameters:
aVersion

superclass

+(Class)superclass
Returns the class object super class

version

+(int)version
Returns the class version number.

init

-(id)init
Initializes the receiver
Returns:
the initialized receiver

autorelease

-(id)autorelease
Does nothing.
Returns:
the receiver

awakeAfterUsingCoder

-(id)awakeAfterUsingCoder:(CPCoder)aCoder
Subclasses override this method to possibly substitute the unarchived object with another. This would be useful if your program utilizes a flyweight pattern. The method is called by CPCoder.
Parameters:
aCoder - the coder that contained the receiver's data

awakeAfterUsingCoder

-(id)awakeAfterUsingCoder:(CPCoder)aDecoder
Called after an object is unarchived in case a different object should be used in place of it. The defaut method returns self. Interested subclasses should override this.
Parameters:
aDecoder -
Returns:
the original object or it's substitute.

awakeFromCib

-(void)awakeFromCib

class

-(Class)class
Returns the receiver's Class

classForCoder

-(Class)classForCoder
Can be overridden by subclasses to substitute a different class to represent the receiver during coding.
Returns:
the class to use for coding

classForKeyedArchiver

-(Class)classForKeyedArchiver
Can be overridden by subclasses to substitute a different class to represent the receiver for keyed archiving.
Returns:
the class to use. A nil means to ignore the method result.

className

-(CPString)className
Returns the class name

copy

-(id)copy
Makes a deep copy of the receiver. The copy should be functionally equivalent to the receiver.
Returns:
the copy of the receiver

dealloc

-(void)dealloc
Not necessary to call in Objective-J. Only exists for code compatability.

description

-(CPString)description
Returns a human readable string describing the receiver

doesNotRecognizeSelector

-(void)doesNotRecognizeSelector:(SEL)aSelector
Called by the Objective-J runtime when an object can't respond to a message. It's not recommended to call this method directly, unless you need your class to not support a method that it has inherited from a super class.
Parameters:
aSelector

forwardInvocation

-(void)forwardInvocation:(CPInvocation)anInvocation
Subclasses can override this method to forward message to other objects. Overwriting this method in conjunction with methodSignatureForSelector: allows the receiver to forward messages for which it does not respond, to another object that does.
Parameters:
anInvocation

hash

-(unsigned)hash
Returns a hash for the object

isEqual

-(BOOL)isEqual:(id)anObject
Determines if anObject is functionally equivalent to the receiver.
Parameters:
anObject
Returns:
YES if anObject is functionally equivalent to the receiver.

isKindOfClass

-(BOOL)isKindOfClass:(Class)aClass
Returns YES if the receiver is a aClass type, or a subtype of it.
Parameters:
aClass - the class to test as the receiver's class or super class.

isMemberOfClass

-(BOOL)isMemberOfClass:(Class)aClass
Returns YES if the receiver is of the aClass class type.
Parameters:
aClass - the class to test the receiper

isProxy

-(BOOL)isProxy
Determines whether the receiver's root object is a proxy.
Returns:
YES if the root object is a proxy

methodForSelector

-(IMP)methodForSelector:(SEL)aSelector
Returns the address of the receiver's method for the provided selector.
Parameters:
aSelector - the selector for the method to return
Returns:
the address of the method's implementation

methodSignatureForSelector

-(CPMethodSignature)methodSignatureForSelector:(SEL)aSelector
Returns the method signature for the provided selector.
Parameters:
aSelector - the selector for which to find the method signature
Returns:
the selector's methd signature

mutableCopy

-(id)mutableCopy
Creates a deep mutable copy of the receiver.
Returns:
the mutable copy of the receiver

performSelector

-(id)performSelector:(SEL)aSelector
Sends the specified message to the receiver.
Parameters:
aSelector - the message to send
Returns:
the return value of the message

performSelector

-(id)performSelector:(SEL)aSelector withObject:(id)anObject
Sends the specified message to the receiver, with one argument.
Parameters:
aSelector - the message to send
anObject - the message argument
Returns:
the return value of the message

performSelector

-(id)performSelector:(SEL)aSelector withObject:(id)anObject withObject:(id)anotherObject
Sends the specified message to the receiver, with two arguments.
Parameters:
aSelector - the message to send
anObject - the first message argument
anotherObject - the second message argument
Returns:
the return value of the message

release

-(void)release
Does nothing.

replacementObjectForArchiver

-(id)replacementObjectForArchiver:(CPArchiver)anArchiver
Can be overridden by subclasses to substitute another object during archiving.
Parameters:
anArchiver - that archiver
Returns:
the object to archive

replacementObjectForCoder

-(id)replacementObjectForCoder:(CPCoder)aCoder
Can be overridden by subclasses to substitute another object during coding.
Parameters:
aCoder - the coder
Returns:
the object to code

replacementObjectForKeyedArchiver

-(id)replacementObjectForKeyedArchiver:(CPKeyedArchiver)anArchiver
Can be overridden by subclasses to substitute another object during keyed archiving.
Parameters:
anArchiver
Returns:
the object to archive

respondsToSelector

-(BOOL)respondsToSelector:(SEL)aSelector
Tests whether the receiver responds to the provided selector.
Parameters:
aSelector - the selector for which to test the receiver
Returns:
YES if the receiver responds to the selector

retain

-(id)retain
Does nothing.
Returns:
the receiver

self

-(id)self
Returns the receiver.

setValue

-(void)setValue:(id)aValue forKey:(CPString)aKey
Parameters:
aValue
aKey

setValue

-(void)setValue:(id)aValue forKeyPath:(CPString)aKeyPath
Parameters:
aValue
aKeyPath

setValue

-(void)setValue:(id)aValue forUndefinedKey:(CPString)aKey
Parameters:
aValue
aKey

superclass

-(Class)superclass
Returns the receiver's super class.

valueForKey

-(id)valueForKey:(CPString)aKey
Parameters:
aKey

valueForKeyPath

-(id)valueForKeyPath:(CPString)aKeyPath
Parameters:
aKeyPath

valueForUndefinedKey

-(id)valueForUndefinedKey:(CPString)aKey
Parameters:
aKey

Created on Sat Sep 13 14:15:43 PDT 2008