Martin Carlberg and GitHub
7dc77ed609
Fixed: Make sure we handle undefined when testing for nil values ( #2862 )
2020-01-31 13:43:58 +01:00
Martin Carlberg
0efb7e67c9
Fixed: Use new fast msgSend function for some foundation classes
2014-04-10 11:03:49 +02:00
Alexander Ljungberg
bf94dd3a6e
New: KVC setValue:forKey: now automatically unwraps CPValue.
...
This corresponds to the same KVC behaviour in Cocoa and is key when decoding cibs with certain properties set to struct values (such as NSSize).
2013-06-13 13:20:22 +01:00
Alexander Ljungberg
5b05dc92a1
More dictionary literals.
2013-02-25 18:27:44 +00:00
Alexander Ljungberg
8bcbeb0aa9
Improve code readability with dictionary literals.
2013-02-25 17:02:36 +00:00
Aparajita Fishman
a622f5ca9b
Formatting
2013-02-11 23:08:08 -05:00
Aparajita Fishman
e2ead56256
Collection KVC fixes, nextObject correctness
...
- Moved common CPArray/CPSet collection KVC operators to _CPCollectionKVCOperators.
- Implemented KVC operator dispatch using Objective-J.
- Fixed infinite loop with empty collection in @min, @max and @sum operators.
- Correctly return valueForUndefinedKey when necessary.
- valueForUndefinedKey reason uses raw description for consistency, class' overridden description may not helpful at all.
- Don't create a forwarder for @ operators with property paths.
- Fixed CPSet -valueForKeyPath to correctly deal with nil/undefined/empty values.
- Added tests for collection KVC operators.
- enumerator -nextObject should always compare against nil for clarity, correctness, and consistency.
2012-04-03 22:16:55 -07:00
Francisco Ryan Tolmasky I
aada884cff
A few import fixes.
...
Reviewed by me.
2011-01-23 08:43:46 -08:00
Stephen Ierodiaconou
494f615aaa
Merge branch 'master' into imports
...
Conflicts:
Foundation/CPScanner.j
2011-01-15 09:11:46 +02:00
Francisco Ryan Tolmasky I
5af66b60e1
Better -copy implementations for KVC arrays and sets.
...
Reviewed by me.
2011-01-09 03:46:29 -08:00
cacaodev
92fb183c22
CPKeyValueCodingArray/Set -copy. Fetch all objects through accessors, that's what cocoa does.
2011-01-05 19:21:13 +01:00
Stephen Ierodiaconou
b70018bd80
Import fixes and lint
2010-12-26 01:34:37 +02:00
Francisco Ryan Tolmasky I
9b75e37e1f
A number of set and array fixes and added tests for unordered accessor pattern in key value coding.
...
Reviewed by me.
2010-12-25 02:18:02 -08:00
Francisco Ryan Tolmasky I
232f1d008d
Added better implementation of valueForKey for indexed accessor pattern and tests for it.
...
Reviewed by me.
2010-12-25 01:47:18 -08:00
Francisco Ryan Tolmasky I
3947bd65f2
Reimplementation of CPSet as a class-cluster, and better set support for valueForKey:
...
1. CPSet and CPMutableSet are now abstract super classes that create appropriate concrete subclasses behind the scenes.
2. CPSet subclassers need only implement -count, -member:, and -objectEnumerator.
3. CPMutableSet subclassers need only implement -count, -member:, -objectEnumerator:, -addObject:, and removeObject:.
4. Added more CPSet tests.
5. Added _CPKeyValueCodingSet which subclasses CPSet for set returns in valueForKey:.
Reviewed by me.
2010-12-25 01:01:19 -08:00
Francisco Ryan Tolmasky I
da1389b0b4
Forgot one last typo.
...
Reviewed by me.
2010-12-24 16:46:17 -08:00
Francisco Ryan Tolmasky I
818c7dac3d
Fix for set accessor methods.
...
Reveiwed by me.
2010-12-24 16:29:40 -08:00
Francisco Ryan Tolmasky I
15b05304cc
Cleanup setValue:forKey:.
...
Reviewed by me.
2010-12-24 13:20:13 -08:00
Francisco Ryan Tolmasky I
e33c7f6be4
Initial support for valueForKey: supporting sets and arrays.
...
Reviewed by me.
2010-12-24 12:42:28 -08:00
Francisco Ryan Tolmasky I
d23bf7b927
Some KVC cleanup:
...
1. Added class_getInstanceVariable to runtime.
2. Changed KVC to rely on class-defined variables vs prototypal ones.
3. Modified KVO code to use public APIs.
Reviewed by me.
2010-12-23 23:46:23 -08:00
Alexander Ljungberg
8edee4e755
Fix accidental globals, cleanup.
2010-12-15 16:02:50 +01:00
Ross Boucher
ac6ccc3257
Merge branch 'master' of https://github.com/dasto/cappuccino into dasto-master
...
Conflicts:
Tests/Foundation/CPKeyValueCodingTest.j
2010-12-09 12:59:11 -08:00
Klaas Pieter Annema
34339fbcd9
several bindings / KVC fixes
...
- setValue:forKeyPath will now get call setValue:forKeyPath again on the value of the first part of the key path
- override valueForKeyPath: and valueForKey: in CPObjectController's CPControllerSelectionProxy to return controller markers when appropriate
- override setValue:forKeyPath: and setValue:forKey: in CPObjectController's CPControllerSelectionProxy to bypass possible controller markers
This commit also removes previous hacks for compound paths and adds test cases for the errors. All this is related to issue #967 .
2010-11-23 14:18:22 +01:00
Klaas Pieter Annema
535d6c9dc5
make setValue:forKey: handle controller markers
2010-11-23 12:15:53 +01:00
Klaas Pieter Annema
aeb3873f3c
fix valueForKeyPath: attempting to call valueForKey: on controller markers
2010-11-23 11:56:46 +01:00
Daniel Stolzenberg
28029030b6
fixed 4 spaces for tab formatting issues
2010-11-01 09:38:19 +01:00
Daniel Stolzenberg
c1fd31fa23
removed unnecessary @import "CPArray+KVO.j" statement in CPKeyValueCoding.j
2010-10-27 12:13:47 +02:00
Daniel Stolzenberg
fd3e10f793
added some comments to original behaviour of Cocoa in CPKeyValueCoding.j
2010-10-27 12:07:50 +02:00
Daniel Stolzenberg
14e4b71d20
removed unnecessary ".isa" statements in CPKeyValueCoding.j
2010-10-26 17:07:13 +02:00
Daniel Stolzenberg
b3e0ec60df
fixed bug in "_modifierForKey()" where self was used in a plain JS-function
2010-10-26 13:57:57 +02:00
Daniel Stolzenberg
513cc2cac7
removed unnecessary if-statement (because it never gets executed)
2010-10-26 13:04:25 +02:00
Daniel Stolzenberg
99e4a4fb4f
implemented missing "setValuesForKeysWithDictionary:" method in "CPKeyValueCoding.j"
2010-10-26 12:48:32 +02:00
Daniel Stolzenberg
7b7b46a61e
unified implementations of "_accessorForKey", "_modifierForKey" and "_ivarForKey" in CPKeyValueCoding.j
2010-10-26 12:39:47 +02:00
Klaas Pieter Annema and Ross Boucher
d947c849c8
made _accessorForKey slightly faster by inlining it as a function
2010-07-26 22:48:40 -07:00
Klaas Pieter Annema and Ross Boucher
8ce63a244c
store accessors in a javascript object not a CPDictionary, for slight performance improvement
2010-07-26 22:48:39 -07:00
Stephen Ierodiaconou and Ross Boucher
b98f0b1427
Apply style rules to Foundation
2010-05-26 08:53:05 -07:00
Klaas Pieter Annema and Ross Boucher
2a630a7210
made CPDictionary call [super valueForKey:] on keys prefixed with @
2010-05-25 11:40:45 -07:00
Alexander Ljungberg and Ross Boucher
068cdb9817
CPNull valueForKey:X returns CPNull for any value of X, paralleling [nil valueForKey:X]. Verified against Cocoa through empirical testing.
2010-03-31 13:17:42 -07:00
Ross Boucher
24198a7890
Add a missing import, exposed by press.
2010-02-24 17:46:47 -08:00
Ross Boucher
da84964a33
Fix two problems with KVC:
...
- valueForKeyPath: looped over individual components, which meant classes couldn't override valueForKeyPath: to do multi-part keys (needed for operators)
- CPArray's valueForKeyPath: implementation was incorrectly parsing the operator if it was a simple key
2010-02-12 12:53:15 -08:00
Tom Robinson
9e62fdc0b8
added missing CPNull imports
2010-01-12 12:28:32 -08:00
Francisco Ryan Tolmasky I
c74642b641
Replacing several instances of -hash with the new -UID method. Partial fix for http://github.com/280north/cappuccino/issues#issue/10 .
...
Reviewed by andrew.
2009-06-07 15:47:21 -07:00
Nicholas Small and Francisco Ryan Tolmasky I
33f96dacd1
Fix for undefined key handling.
...
Reviewed by me.
2009-05-31 01:34:03 -07:00
Francisco Ryan Tolmasky I
bb135f041a
Changed CPArray_KVO.j to CPArray+KVO.j.
...
Reviewed by me.
2009-01-21 07:27:14 -08:00
Ross Boucher
0b05b4b7d8
Add KVC+KVO support for "To Many" keys (i.e. Arrays).
2009-01-20 18:51:10 -08:00
Ross Boucher
3b82ef5fde
Fix an error where we were casting CPNull to a string, forcing calls to sprintf.
2009-01-19 01:41:38 -08:00
Francisco Ryan Tolmasky I
5144a5a579
Added @accessor support, @import, and fixed spacing bug with @selector.
...
Reviewed by ross.
2008-10-26 00:48:49 -07:00
Ross Boucher
ff140b8c4c
Improve KVO speed 50%, add dictionary support in KVC.
2008-09-27 11:33:36 -07:00
Ross Boucher
ce04c97053
Initial KVO implementation, not yet working.
2008-09-21 14:57:06 -07:00
Francisco Ryan Tolmasky I
d6b4ebaa30
Significant improvements to cib support and nib2cib.
...
Reviewed by rossco.
2008-09-17 23:56:55 -07:00