CPObject Class Reference
[Foundation]

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

List of all members.

Public Member Functions

(void) - addObserver:forKeyPath:options:context: [implementation]
(void) - applyChange:toKeyPath: [implementation]
(id) - awakeAfterUsingCoder: [implementation]
(void) - awakeFromCib [implementation]
(CPDictionary- dictionaryWithValuesForKeys: [implementation]
(void) - didChange:valuesAtIndexes:forKey: [implementation]
(void) - didChangeValueForKey: [implementation]
(id) - mutableArrayValueForKey: [implementation]
(id) - mutableArrayValueForKeyPath: [implementation]
(void) - removeObserver:forKeyPath: [implementation]
(void) - setValue:forKey: [implementation]
(void) - setValue:forKeyPath: [implementation]
(void) - setValue:forUndefinedKey: [implementation]
(id) - valueForKey: [implementation]
(id) - valueForKeyPath: [implementation]
(id) - valueForUndefinedKey: [implementation]
(void) - willChange:valuesAtIndexes:forKey: [implementation]
(void) - willChangeValueForKey: [implementation]

Static Public Member Functions

(BOOL) + accessInstanceVariablesDirectly [implementation]
(BOOL) + automaticallyNotifiesObserversForKey: [implementation]
(CPSet+ keyPathsForValuesAffectingValueForKey: [implementation]

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 overriden 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:

- (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> 
    
Todo:
document KVC usage.

Definition at line 30 of file CPCibLoading.j.


Member Function Documentation

+ (BOOL) accessInstanceVariablesDirectly   [implementation]

Definition at line 37 of file CPKeyValueCoding.j.

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

Definition at line 49 of file CPKeyValueObserving.j.

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

Definition at line 81 of file CPKeyValueObserving.j.

+ (BOOL) automaticallyNotifiesObserversForKey: (CPString aKey   [implementation]

Definition at line 65 of file CPKeyValueObserving.j.

- (id) awakeAfterUsingCoder: (CPCoder aDecoder   [implementation]

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.

Definition at line 155 of file CPCoder.j.

- (void) awakeFromCib   [implementation]

Definition at line 32 of file CPCibLoading.j.

- (CPDictionary) dictionaryWithValuesForKeys: (CPArray keys   [implementation]

Definition at line 188 of file CPKeyValueCoding.j.

- (void) didChange: (CPKeyValueChange)  change
valuesAtIndexes: (CPIndexSet indexes
forKey: (CPString key 
[implementation]

Definition at line 45 of file CPKeyValueObserving.j.

- (void) didChangeValueForKey: (CPString aKey   [implementation]

Definition at line 37 of file CPKeyValueObserving.j.

+ (CPSet) keyPathsForValuesAffectingValueForKey: (CPString aKey   [implementation]

Definition at line 70 of file CPKeyValueObserving.j.

- (id) mutableArrayValueForKey: (id)  aKey   [implementation]

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

- (id) mutableArrayValueForKeyPath: (id)  aKeyPath   [implementation]

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

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

Definition at line 57 of file CPKeyValueObserving.j.

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

Definition at line 230 of file CPKeyValueCoding.j.

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

Definition at line 215 of file CPKeyValueCoding.j.

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

Definition at line 257 of file CPKeyValueCoding.j.

- (id) valueForKey: (CPString aKey   [implementation]

Definition at line 155 of file CPKeyValueCoding.j.

- (id) valueForKeyPath: (CPString aKeyPath   [implementation]

Definition at line 174 of file CPKeyValueCoding.j.

- (id) valueForUndefinedKey: (CPString aKey   [implementation]

Definition at line 208 of file CPKeyValueCoding.j.

- (void) willChange: (CPKeyValueChange)  change
valuesAtIndexes: (CPIndexSet indexes
forKey: (CPString key 
[implementation]

Definition at line 41 of file CPKeyValueObserving.j.

- (void) willChangeValueForKey: (CPString aKey   [implementation]

Definition at line 33 of file CPKeyValueObserving.j.


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

Generated on Fri Apr 9 11:04:21 2010 for Cappuccino API by  doxygen 1.6.1