API  0.9.6
 All Classes Files Functions Variables Macros Modules Pages
CPObject Class Reference

The root class from which most classes are subclassed. More...

#import <CPObject.h>

Inherited by CAAnimation, CALayer, CAMediaTimingFunction, CPAccordionViewItem, CPAlert, CPAnimation, CPArray, CPAttributedString, CPBasePlatform, CPBasePlatformString, CPBezierPath, CPBinder, CPBundle, CPCharacterSet, CPCib, CPCibConnector, CPCoder, CPColor, CPColorPicker, CPColorSpace, CPController, CPControllerSelectionProxy, CPCookie, CPCursor, CPData, CPDate, CPDecimalNumberHandler, CPDictionary, CPDocumentController, CPDraggingInfo, CPDragServer, CPEnumerator, CPEvent, CPException, CPExpression, CPFlashMovie, CPFont, CPFontManager, CPFormatter, CPGradient, CPGraphicsContext, CPImage, CPIndexPath, CPIndexSet, CPInvocation, CPJSONPConnection, CPKeyBinding, CPMenu, CPMenuItem, CPNinePartImage, CPNotification, CPNotificationCenter, CPNull, CPNumber, CPOperation, CPOperationQueue, CPPasteboard, CPPlatformWindow, CPPredicate, CPPredicateEditorRowTemplate, CPPropertyListSerialization, CPRadioGroup, CPResponder, CPRunLoop, CPScanner, CPScreen, CPSet, CPShadow, CPSortDescriptor, CPSound, CPString, CPTableColumn, CPTabViewItem, CPTheme, CPThemeBlend, CPThreePartImage, CPTimer, CPToolbar, CPToolbarItem, CPTreeNode, CPUndoManager, CPURL, CPURLConnection, CPURLRequest, CPURLResponse, CPUserDefaults, CPUserDefaultsStore, CPUserSessionManager, CPValue, CPValueTransformer, CPWebDAVManager, CPWebScriptObject, and CPWorkspace.

Instance Methods

(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray- exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(id) - init
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(Class) + class
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isSubclassOfClass:
 
(CPSet+ keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Instance Variables

Class isa
 

Detailed Description

The root class from which most classes are subclassed.

CPObject is the root class for most Cappuccino classes. Like in Objective-C, you have to declare parent class explicitly in Objective-J, so your custom classes should almost always subclass CPObject or one of its children.

CPObject provides facilities for class allocation and initialization, querying runtime about parent classes and available selectors, using KVC (key-value coding).

When you subclass CPObject, most of the time you override one selector - init. It is called for default initialization of custom object. You must call parent class init in your overridden code:

- (id)init
{
    self = [super init];
    if (self) {
        ... provide default initialization code for your object ...
    }
    return self;
}
One more useful thing to override is description(). This selector
is used to provide developer-readable information about object. description
selector is often used with CPLog debugging:
<pre>- (CPString)description

{ return [CPString stringWithFormat:"<SomeClass d>", someValue]; } To get description value you can use %@ specifier everywhere where format specifiers are allowed:

var inst = [[SomeClass alloc] initWithSomeValue:10];
CPLog("Got some class: %", inst);
    would output:
    Got some class: <SomeClass 10> 

Definition at line 2 of file CPObject.h.

Method Documentation

+ (BOOL) accessInstanceVariablesDirectly
implementation

Provided by category CPObject(CPKeyValueCoding).

Definition at line 34 of file CPKeyValueCoding.j.

- (void) addObserver: (id)  anObserver
forKeyPath: (CPString aPath
options: (unsigned)  options
context: (id)  aContext 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 131 of file CPKeyValueObserving.j.

+ (id) alloc
implementation

Allocates a new instance of the receiving class

Reimplemented in CPArray, CPString, CPSet, CPNumber, CPDate, CPURL, CPException, CPData, CPDecimalNumber, and CPDictionary.

Definition at line 90 of file CPObject.j.

+ (id) allocWithCoder: (CPCoder aCoder
implementation

Definition at line 96 of file CPObject.j.

- (void) applyChange: (CPDictionary aChange
toKeyPath: (CPString aKeyPath 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 179 of file CPKeyValueObserving.j.

+ (BOOL) automaticallyNotifiesObserversForKey: (CPString aKey
implementation

Whether -willChangeValueForKey/-didChangeValueForKey should automatically be invoked when the setter of the given key is used. The default is YES. If you override this method to return NO for some key, you will need to call -willChangeValueForKey/-didChangeValueForKey manually to be KVO compliant.

The default implementation of this method will check if the receiving class implements + (BOOL)automaticallyNotifiesObserversOf<aKey> and return the response of that method if it exists.

Reimplemented in CPObjectController.

Provided by category CPObject(KeyValueObserving).

Definition at line 157 of file CPKeyValueObserving.j.

- (id) autorelease
implementation

Does nothing.

Returns
the receiver

Definition at line 469 of file CPObject.j.

- (id) awakeAfterUsingCoder: (CPCoder aCoder
implementation

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
aCoderthe coder that contained the receiver's data

Provided by category CPObject(CPCoding).

Definition at line 383 of file CPObject.j.

- (void) awakeFromCib
implementation

Reimplemented in CPWindow, CPScrollView, CPCollectionView, CPMenu, CPArrayController, CPObjectController, and CPButtonBar.

Provided by category CPObject(CPCibLoading).

Definition at line 29 of file CPCibLoading.j.

- (void) bind: (CPString aBinding
toObject: (id)  anObject
withKeyPath: (CPString aKeyPath
options: (CPDictionary options 
implementation

Reimplemented in CPTableView, and CPTableColumn.

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 384 of file CPKeyValueBinding.j.

+ (Class) class
implementation

Returns the Class object for this class definition.

Returns the receiver's Class

Definition at line 139 of file CPObject.j.

- (Class) classForCoder
implementation

Can be overridden by subclasses to substitute a different class to represent the receiver during coding.

Returns
the class to use for coding

Definition at line 401 of file CPObject.j.

- (Class) classForKeyedArchiver
implementation

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.

Definition at line 392 of file CPObject.j.

- (CPString) className
implementation

Returns the class name

Definition at line 457 of file CPObject.j.

- (id) copy
implementation

Makes a deep copy of the receiver. The copy should be functionally equivalent to the receiver.

Returns
the copy of the receiver

Reimplemented in CPArray, CPSet, CPDate, CPException, CPFont, CPMenuItem, CPToolbarItem, CPIndexSet, CPScanner, and CPDictionary.

Definition at line 114 of file CPObject.j.

- (void) dealloc
implementation

Not necessary to call in Objective-J. Only exists for code compatibility.

Definition at line 131 of file CPObject.j.

- (CPString) description
implementation

Returns a human readable string describing the receiver

Reimplemented in CPArray, CPString, CPSet, CPNumber, CPDate, CPURL, CPException, CPData, CPEvent, CPIndexPath, CPKeyBinding, CPColor, CPFont, CPMenuItem, CPImage, CPDecimalNumber, CPIndexSet, CPBundle, CPSortDescriptor, CPScanner, CPDictionary, and CPPredicate.

Definition at line 288 of file CPObject.j.

- (CPDictionary) dictionaryWithValuesForKeys: (CPArray keys
implementation

Provided by category CPObject(CPKeyValueCoding).

Definition at line 129 of file CPKeyValueCoding.j.

- (void) didChange: (CPKeyValueChange)  aChange
valuesAtIndexes: (CPIndexSet indexes
forKey: (CPString aKey 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 79 of file CPKeyValueObserving.j.

- (void) didChangeValueForKey: (CPString aKey
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 43 of file CPKeyValueObserving.j.

- (void) didChangeValueForKey: (CPString aKey
withSetMutation: (CPKeyValueSetMutationKind)  aMutationKind
usingObjects: (CPSet objects 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 115 of file CPKeyValueObserving.j.

- (void) doesNotRecognizeSelector: (SEL)  aSelector
implementation

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.

Definition at line 367 of file CPObject.j.

+ (void) exposeBinding: (CPString aBinding
implementation

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 351 of file CPKeyValueBinding.j.

- (CPArray) exposedBindings
implementation

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 361 of file CPKeyValueBinding.j.

- (id) forwardingTargetForSelector: (SEL)  aSelector
implementation

Definition at line 344 of file CPObject.j.

- (void) forwardInvocation: (CPInvocation anInvocation
implementation

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.

Definition at line 356 of file CPObject.j.

- (unsigned) hash
implementation

Returns a hash for the object

Definition at line 477 of file CPObject.j.

- (BOOL) implementsSelector: (SEL)  aSelector
implementation

Tests whether the receiver implements to the provided selector regardless of inheritance.

Parameters
aSelectorthe selector for which to test the receiver
Returns
YES if the receiver implements the selector

Definition at line 239 of file CPObject.j.

- (CPDictionary) infoForBinding: (CPString aBinding
implementation

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 398 of file CPKeyValueBinding.j.

+ (IMP) instanceMethodForSelector: (SEL)  aSelector
implementation

Returns the implementation of the receiving class' method for the provided selector.

Parameters
aSelectorthe selector for the class method to return
Returns
the method implementation ( a function )

Definition at line 268 of file CPObject.j.

+ (BOOL) instancesRespondToSelector: (SEL)  aSelector
implementation

Test whether instances of this class respond to the provided selector.

Parameters
aSelectorthe selector for which to test the class
Returns
YES if instances of the class respond to the selector

Definition at line 218 of file CPObject.j.

- (BOOL) isEqual: (id)  anObject
implementation

Determines if anObject is functionally equivalent to the receiver.

Returns
YES if anObject is functionally equivalent to the receiver.

Reimplemented in CPArray, CPString, CPURL, CPException, CPComparisonPredicate, CPIndexPath, CPFont, CPCompoundPredicate, CPAttributedString, CPIndexSet, CPDictionary, CPNull, and CPPredicate_BOOL.

Definition at line 494 of file CPObject.j.

- (BOOL) isKindOfClass: (Class)  aClass
implementation

Returns YES if the receiver is a aClass type, or a subtype of it.

Parameters
aClassthe class to test as the receiver's class or super class.

Definition at line 179 of file CPObject.j.

- (BOOL) isMemberOfClass: (Class)  aClass
implementation

Returns YES if the receiver is of the aClass class type.

Parameters
aClassthe class to test the receiver

Definition at line 193 of file CPObject.j.

- (BOOL) isProxy
implementation

Determines whether the receiver's root object is a proxy.

Returns
YES if the root object is a proxy

Definition at line 207 of file CPObject.j.

+ (BOOL) isSubclassOfClass: (Class)  aClass
implementation

Returns YES if the receiving class is a subclass of aClass.

Parameters
aClassthe class to test inheritance from

Definition at line 164 of file CPObject.j.

+ (CPSet) keyPathsForValuesAffectingValueForKey: (CPString aKey
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 168 of file CPKeyValueObserving.j.

+ (void) load
implementation

Reimplemented in CPTableView, and CPImage.

Definition at line 69 of file CPObject.j.

- (IMP) methodForSelector: (SEL)  aSelector
implementation

Returns the implementation of the receiver's method for the provided selector.

Parameters
aSelectorthe selector for the method to return
Returns
the method implementation ( a function )

Definition at line 258 of file CPObject.j.

- (CPMethodSignature) methodSignatureForSelector: (SEL)  aSelector
implementation

Returns the method signature for the provided selector.

Parameters
aSelectorthe selector for which to find the method signature
Returns
the selector's method signature

Definition at line 278 of file CPObject.j.

- (id) mutableArrayValueForKey: (id)  aKey
implementation

Provided by category CPObject(CPArrayKVO).

Definition at line 27 of file CPArray+KVO.j.

- (id) mutableArrayValueForKeyPath: (id)  aKeyPath
implementation

Provided by category CPObject(CPArrayKVO).

Definition at line 32 of file CPArray+KVO.j.

- (id) mutableCopy
implementation

Creates a deep mutable copy of the receiver.

Returns
the mutable copy of the receiver

Reimplemented in CPSet, CPArray, CPMenuItem, and CPIndexSet.

Definition at line 123 of file CPObject.j.

- (id) mutableSetValueForKey: (id)  aKey
implementation

Provided by category CPObject(CPSetKVO).

Definition at line 26 of file CPSet+KVO.j.

- (id) mutableSetValueForKeyPath: (id)  aKeyPath
implementation

Provided by category CPObject(CPSetKVO).

Definition at line 31 of file CPSet+KVO.j.

+ (id) new
implementation

Allocates a new instance of the receiver, and sends it an -init

Returns
the new object

Definition at line 82 of file CPObject.j.

- (id) performSelector: (SEL)  aSelector
implementation

Sends the specified message to the receiver.

Parameters
aSelectorthe message to send
Returns
the return value of the message

Definition at line 304 of file CPObject.j.

- (id) performSelector: (SEL)  aSelector
withObject: (id)  anObject 
implementation

Sends the specified message to the receiver, with one argument.

Parameters
aSelectorthe message to send
anObjectthe message argument
Returns
the return value of the message

Definition at line 315 of file CPObject.j.

- (id) performSelector: (SEL)  aSelector
withObject: (id)  anObject
withObject: (id)  anotherObject 
implementation

Sends the specified message to the receiver, with two arguments.

Parameters
aSelectorthe message to send
anObjectthe first message argument
anotherObjectthe second message argument
Returns
the return value of the message

Definition at line 327 of file CPObject.j.

- (id) performSelector: (SEL)  aSelector
withObjects: (id)  anObject
,   ... 
implementation

Sends the specified message to the reciever, with any number of arguments.

Parameters
aSelectorthe message to send
anObject...comma seperated objects to pass to the selector
Returns
the return value of the message

Definition at line 338 of file CPObject.j.

- (void) release
implementation

Does nothing.

Definition at line 511 of file CPObject.j.

- (void) removeObserver: (id)  anObserver
forKeyPath: (CPString aPath 
implementation

Reimplemented in CPControllerSelectionProxy, CPArray, and CPObjectController.

Provided by category CPObject(KeyValueObserving).

Definition at line 139 of file CPKeyValueObserving.j.

- (id) replacementObjectForArchiver: (CPArchiver)  anArchiver
implementation

Can be overridden by subclasses to substitute another object during archiving.

Parameters
anArchiverthat archiver
Returns
the object to archive

Definition at line 411 of file CPObject.j.

- (id) replacementObjectForCoder: (CPCoder aCoder
implementation

Can be overridden by subclasses to substitute another object during coding.

Parameters
aCoderthe coder
Returns
the object to code

Definition at line 431 of file CPObject.j.

- (id) replacementObjectForKeyedArchiver: (CPKeyedArchiver anArchiver
implementation

Can be overridden by subclasses to substitute another object during keyed archiving.

Parameters
anArchivethe keyed archiver
Returns
the object to archive

Definition at line 421 of file CPObject.j.

- (BOOL) respondsToSelector: (SEL)  aSelector
implementation

Tests whether the receiver responds to the provided selector.

Parameters
aSelectorthe selector for which to test the receiver
Returns
YES if the receiver responds to the selector

Definition at line 228 of file CPObject.j.

- (id) retain
implementation

Does nothing.

Returns
the receiver

Definition at line 503 of file CPObject.j.

- (id) self
implementation

Returns the receiver.

Definition at line 518 of file CPObject.j.

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

Reimplemented in CPControllerSelectionProxy, CPSet, CPArray, and CPDictionary.

Provided by category CPObject(CPKeyValueCoding).

Definition at line 174 of file CPKeyValueCoding.j.

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

Reimplemented in CPControllerSelectionProxy, and CPArray.

Provided by category CPObject(CPKeyValueCoding).

Definition at line 157 of file CPKeyValueCoding.j.

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

Provided by category CPObject(CPKeyValueCoding).

Definition at line 243 of file CPKeyValueCoding.j.

- (void) setValuesForKeysWithDictionary: (CPDictionary keyedValues
implementation

Provided by category CPObject(CPKeyValueCoding).

Definition at line 225 of file CPKeyValueCoding.j.

+ (void) setVersion: (int)  aVersion
implementation

Sets the class version number.

Parameters
thenew version number for the class

Definition at line 440 of file CPObject.j.

+ (Class) superclass
implementation

Returns the class object super class

Returns the receiver's super class.

Definition at line 155 of file CPObject.j.

- (CPString) UID
implementation

Reimplemented in CPString, and CPNumber.

Definition at line 482 of file CPObject.j.

- (void) unbind: (CPString aBinding
implementation

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 403 of file CPKeyValueBinding.j.

- (Class) valueClassForBinding: (CPString binding
implementation

Provided by category CPObject(KeyValueBindingCreation).

Definition at line 379 of file CPKeyValueBinding.j.

- (id) valueForKey: (CPString aKey
implementation

Reimplemented in CPControllerSelectionProxy, CPSet, CPArray, CPDictionary, and CPNull.

Provided by category CPObject(CPKeyValueCoding).

Definition at line 39 of file CPKeyValueCoding.j.

- (id) valueForKeyPath: (CPString aKeyPath
implementation

Reimplemented in CPControllerSelectionProxy, CPArray, and CPSet.

Provided by category CPObject(CPKeyValueCoding).

Definition at line 115 of file CPKeyValueCoding.j.

- (id) valueForUndefinedKey: (CPString aKey
implementation

Provided by category CPObject(CPKeyValueCoding).

Definition at line 150 of file CPKeyValueCoding.j.

+ (int) version
implementation

Returns the class version number.

Definition at line 448 of file CPObject.j.

- (void) willChange: (CPKeyValueChange)  aChange
valuesAtIndexes: (CPIndexSet indexes
forKey: (CPString aKey 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 62 of file CPKeyValueObserving.j.

- (void) willChangeValueForKey: (CPString aKey
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 26 of file CPKeyValueObserving.j.

- (void) willChangeValueForKey: (CPString aKey
withSetMutation: (CPKeyValueSetMutationKind)  aMutationKind
usingObjects: (CPSet objects 
implementation

Provided by category CPObject(KeyValueObserving).

Definition at line 98 of file CPKeyValueObserving.j.

Instance Variable Documentation

- (Class) isa
protected

Definition at line 5 of file CPObject.h.


The documentation for this class was generated from the following files: