- Added Johannes Fortmann's NSNibBindingConnector, Binders.zip changes into AppKit/binders/ and KVO fixes

- Added Rolf Jansen's color and font panel nibs which fix layout issues with the new button frame adjustment

- Moved nib loading functionality to NSNib, NSNibLoading now uses NSNib
- Fixed NSFileHandle_posix.m not importing NSRaise.h
- NS*Controller header templates
- First pass at NSSortDescriptor
- Preliminary work on NSPredicate et al
This commit is contained in:
Christopher Lloyd 2007-04-10 16:31:07 +00:00
parent d170ea9a3c
commit 1ceab3e309
51 changed files with 4131 additions and 2727 deletions

View File

@ -646,6 +646,16 @@
FE86887F0BC3FFA4009F515C /* NSButtonCell_disclosure_highlighted.tif in Resources */ = {isa = PBXBuildFile; fileRef = FE86887C0BC3FFA4009F515C /* NSButtonCell_disclosure_highlighted.tif */; };
FE8688800BC3FFA4009F515C /* NSButtonCell_disclosure_normal.tif in Resources */ = {isa = PBXBuildFile; fileRef = FE86887D0BC3FFA4009F515C /* NSButtonCell_disclosure_normal.tif */; };
FE8688810BC3FFA4009F515C /* NSButtonCell_disclosure_selected.tif in Resources */ = {isa = PBXBuildFile; fileRef = FE86887E0BC3FFA4009F515C /* NSButtonCell_disclosure_selected.tif */; };
FE8BAEC70BC9EA8D0007FACA /* NSNibBindingConnector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8BAEC50BC9EA8D0007FACA /* NSNibBindingConnector.h */; };
FE8BAEC80BC9EA8D0007FACA /* NSNibBindingConnector.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8BAEC60BC9EA8D0007FACA /* NSNibBindingConnector.m */; };
FE8BAF250BC9EC680007FACA /* NSBinder.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8BAF1D0BC9EC680007FACA /* NSBinder.h */; };
FE8BAF260BC9EC680007FACA /* NSBinder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8BAF1E0BC9EC680007FACA /* NSBinder.m */; };
FE8BAF270BC9EC680007FACA /* NSKVOBinder.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8BAF1F0BC9EC680007FACA /* NSKVOBinder.h */; };
FE8BAF280BC9EC680007FACA /* NSKVOBinder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8BAF200BC9EC680007FACA /* NSKVOBinder.m */; };
FE8BAF290BC9EC680007FACA /* NSObject+BindingSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8BAF210BC9EC680007FACA /* NSObject+BindingSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE8BAF2A0BC9EC680007FACA /* NSObject+BindingSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8BAF220BC9EC680007FACA /* NSObject+BindingSupport.m */; };
FE8BAF2B0BC9EC680007FACA /* NSTableViewBinder.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8BAF230BC9EC680007FACA /* NSTableViewBinder.h */; };
FE8BAF2C0BC9EC680007FACA /* NSTableViewBinder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8BAF240BC9EC680007FACA /* NSTableViewBinder.m */; };
FEEF00590B96441800069FD1 /* CGPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = FEEF00570B96441800069FD1 /* CGPDFPage.h */; settings = {ATTRIBUTES = (Public, ); }; };
FEEF005A0B96441800069FD1 /* CGPDFPage.m in Sources */ = {isa = PBXBuildFile; fileRef = FEEF00580B96441800069FD1 /* CGPDFPage.m */; };
FEF33C010B93543C00DC0B6F /* KGMutablePath.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF33BFF0B93543C00DC0B6F /* KGMutablePath.h */; settings = {ATTRIBUTES = (Private, ); }; };
@ -1338,6 +1348,16 @@
FE86887C0BC3FFA4009F515C /* NSButtonCell_disclosure_highlighted.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSButtonCell_disclosure_highlighted.tif; sourceTree = "<group>"; };
FE86887D0BC3FFA4009F515C /* NSButtonCell_disclosure_normal.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSButtonCell_disclosure_normal.tif; sourceTree = "<group>"; };
FE86887E0BC3FFA4009F515C /* NSButtonCell_disclosure_selected.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = NSButtonCell_disclosure_selected.tif; sourceTree = "<group>"; };
FE8BAEC50BC9EA8D0007FACA /* NSNibBindingConnector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSNibBindingConnector.h; sourceTree = "<group>"; };
FE8BAEC60BC9EA8D0007FACA /* NSNibBindingConnector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSNibBindingConnector.m; sourceTree = "<group>"; };
FE8BAF1D0BC9EC680007FACA /* NSBinder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSBinder.h; sourceTree = "<group>"; };
FE8BAF1E0BC9EC680007FACA /* NSBinder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSBinder.m; sourceTree = "<group>"; };
FE8BAF1F0BC9EC680007FACA /* NSKVOBinder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSKVOBinder.h; sourceTree = "<group>"; };
FE8BAF200BC9EC680007FACA /* NSKVOBinder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSKVOBinder.m; sourceTree = "<group>"; };
FE8BAF210BC9EC680007FACA /* NSObject+BindingSupport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "NSObject+BindingSupport.h"; sourceTree = "<group>"; };
FE8BAF220BC9EC680007FACA /* NSObject+BindingSupport.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = "NSObject+BindingSupport.m"; sourceTree = "<group>"; };
FE8BAF230BC9EC680007FACA /* NSTableViewBinder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSTableViewBinder.h; sourceTree = "<group>"; };
FE8BAF240BC9EC680007FACA /* NSTableViewBinder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSTableViewBinder.m; sourceTree = "<group>"; };
FEEF00570B96441800069FD1 /* CGPDFPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPDFPage.h; sourceTree = "<group>"; };
FEEF00580B96441800069FD1 /* CGPDFPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPDFPage.m; sourceTree = "<group>"; };
FEF33BFF0B93543C00DC0B6F /* KGMutablePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KGMutablePath.h; sourceTree = "<group>"; };
@ -1381,6 +1401,7 @@
6E2B53240976075200DA0954 /* Classes */ = {
isa = PBXGroup;
children = (
FE8BAF1A0BC9EC0B0007FACA /* binders */,
FE44327B0BB95F4300411464 /* NSInterfacePart */,
6E2B53FC0976075200DA0954 /* AppKit.h */,
6E2B53FA0976075200DA0954 /* AppKitExport.h */,
@ -1705,6 +1726,8 @@
6E2B55100976075300DA0954 /* nib */ = {
isa = PBXGroup;
children = (
FE8BAEC50BC9EA8D0007FACA /* NSNibBindingConnector.h */,
FE8BAEC60BC9EA8D0007FACA /* NSNibBindingConnector.m */,
6ECABE310A40520700AD7F7B /* NSNibKeyedUnarchiver.h */,
6ECABE320A40520700AD7F7B /* NSNibKeyedUnarchiver.m */,
6EC4AC670A35D47800E8D6CA /* NSCustomObject.h */,
@ -2273,6 +2296,21 @@
path = NSInterfacePart;
sourceTree = "<group>";
};
FE8BAF1A0BC9EC0B0007FACA /* binders */ = {
isa = PBXGroup;
children = (
FE8BAF1D0BC9EC680007FACA /* NSBinder.h */,
FE8BAF1E0BC9EC680007FACA /* NSBinder.m */,
FE8BAF1F0BC9EC680007FACA /* NSKVOBinder.h */,
FE8BAF200BC9EC680007FACA /* NSKVOBinder.m */,
FE8BAF210BC9EC680007FACA /* NSObject+BindingSupport.h */,
FE8BAF220BC9EC680007FACA /* NSObject+BindingSupport.m */,
FE8BAF230BC9EC680007FACA /* NSTableViewBinder.h */,
FE8BAF240BC9EC680007FACA /* NSTableViewBinder.m */,
);
path = binders;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -2586,6 +2624,11 @@
FE6DC3F00BA9A7100082AC66 /* NSDatePickerCell.h in Headers */,
FE4434040BB9833B00411464 /* NSGraphicsStyle_uxtheme.h in Headers */,
FE1E86C10BBCA62D0013B968 /* NSGraphicsStyle.h in Headers */,
FE8BAEC70BC9EA8D0007FACA /* NSNibBindingConnector.h in Headers */,
FE8BAF250BC9EC680007FACA /* NSBinder.h in Headers */,
FE8BAF270BC9EC680007FACA /* NSKVOBinder.h in Headers */,
FE8BAF290BC9EC680007FACA /* NSObject+BindingSupport.h in Headers */,
FE8BAF2B0BC9EC680007FACA /* NSTableViewBinder.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3021,6 +3064,11 @@
FE6DC3F10BA9A7100082AC66 /* NSDatePickerCell.m in Sources */,
FE4434050BB9833B00411464 /* NSGraphicsStyle_uxtheme.m in Sources */,
FE1E86C20BBCA62D0013B968 /* NSGraphicsStyle.m in Sources */,
FE8BAEC80BC9EA8D0007FACA /* NSNibBindingConnector.m in Sources */,
FE8BAF260BC9EC680007FACA /* NSBinder.m in Sources */,
FE8BAF280BC9EC680007FACA /* NSKVOBinder.m in Sources */,
FE8BAF2A0BC9EC680007FACA /* NSObject+BindingSupport.m in Sources */,
FE8BAF2C0BC9EC680007FACA /* NSTableViewBinder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>265 195 356 240 0 0 1680 1028 </string>
<string>185 189 356 240 0 0 1280 1002 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
@ -11,7 +11,7 @@
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8L2127</string>
<string>8P135</string>
<key>IBUsesTextArchiving</key>
<true/>
</dict>

View File

@ -242,7 +242,7 @@
<integer>15</integer>
</dict>
</dict>
<string>{{434, 497}, {191, 284}}</string>
<string>{{98, 598}, {191, 284}}</string>
<string>Colors</string>
<string>NSColorPanel</string>
<string>View</string>
@ -345,11 +345,11 @@
<key>NSButtonFlags</key>
<integer>-2038284033</integer>
<key>NSButtonFlags2</key>
<integer>1</integer>
<integer>6</integer>
<key>NSCellFlags</key>
<integer>67239424</integer>
<key>NSCellFlags2</key>
<integer>137887744</integer>
<integer>134217728</integer>
<key>NSContents</key>
<dict>
<key>CF$UID</key>
@ -641,7 +641,7 @@
<key>NSButtonFlags</key>
<integer>-1228521217</integer>
<key>NSButtonFlags2</key>
<integer>2</integer>
<integer>6</integer>
<key>NSCellFlags</key>
<integer>-2080244224</integer>
<key>NSCellFlags2</key>
@ -687,7 +687,7 @@
<key>NSButtonFlags</key>
<integer>-1228521217</integer>
<key>NSButtonFlags2</key>
<integer>2</integer>
<integer>6</integer>
<key>NSCellFlags</key>
<integer>67239424</integer>
<key>NSCellFlags2</key>
@ -733,7 +733,7 @@
<key>NSButtonFlags</key>
<integer>-1228521217</integer>
<key>NSButtonFlags2</key>
<integer>2</integer>
<integer>6</integer>
<key>NSCellFlags</key>
<integer>67239424</integer>
<key>NSCellFlags2</key>
@ -924,7 +924,7 @@
<key>$classname</key>
<string>NSView</string>
</dict>
<string>{{0, 0}, {1680, 1028}}</string>
<string>{{0, 0}, {1280, 1002}}</string>
<string>{193, 316}</string>
<dict>
<key>$classes</key>
@ -1081,7 +1081,11 @@
<array>
<dict>
<key>CF$UID</key>
<integer>36</integer>
<integer>41</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
@ -1091,26 +1095,22 @@
<key>CF$UID</key>
<integer>39</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>10</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>40</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>41</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>17</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>10</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>52</integer>
@ -1134,22 +1134,6 @@
</dict>
<key>NS.objects</key>
<array>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>2</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
@ -1158,6 +1142,14 @@
<key>CF$UID</key>
<integer>10</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
@ -1170,6 +1162,14 @@
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>2</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
</array>
</dict>
<dict>
@ -1186,11 +1186,11 @@
</dict>
<dict>
<key>CF$UID</key>
<integer>2</integer>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
<integer>39</integer>
</dict>
<dict>
<key>CF$UID</key>
@ -1198,7 +1198,7 @@
</dict>
<dict>
<key>CF$UID</key>
<integer>39</integer>
<integer>2</integer>
</dict>
</array>
</dict>
@ -1233,10 +1233,10 @@
</array>
</dict>
<string>Color Panel</string>
<string>File's Owner</string>
<string>Matrix</string>
<string>2</string>
<string>Button11</string>
<string>2</string>
<string>File's Owner</string>
<dict>
<key>$class</key>
<dict>
@ -1265,44 +1265,24 @@
<array>
<dict>
<key>CF$UID</key>
<integer>40</integer>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>10</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>65</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>71</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>36</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>2</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>63</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>41</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>17</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>29</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>69</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>67</integer>
@ -1311,21 +1291,41 @@
<key>CF$UID</key>
<integer>39</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>63</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>9</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>41</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>15</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>40</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>29</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>52</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>65</integer>
<integer>69</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>10</integer>
<integer>17</integer>
</dict>
</array>
</dict>
@ -1403,22 +1403,22 @@
</dict>
</array>
</dict>
<integer>12</integer>
<integer>31</integer>
<integer>10</integer>
<integer>6</integer>
<integer>5</integer>
<integer>28</integer>
<integer>31</integer>
<integer>1</integer>
<integer>27</integer>
<integer>13</integer>
<integer>8</integer>
<integer>9</integer>
<integer>30</integer>
<integer>29</integer>
<integer>11</integer>
<integer>27</integer>
<integer>26</integer>
<integer>13</integer>
<integer>6</integer>
<integer>12</integer>
<integer>9</integer>
<integer>14</integer>
<integer>28</integer>
<integer>5</integer>
<integer>30</integer>
<integer>8</integer>
<dict>
<key>$class</key>
<dict>

Binary file not shown.

View File

@ -3,11 +3,11 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>189 180 356 240 0 0 1600 1178 </string>
<string>140 146 356 240 0 0 1280 1002 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBSystem Version</key>
<string>8H14</string>
<string>8P135</string>
<key>IBUsesTextArchiving</key>
<true/>
</dict>

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,68 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSController.h>
#import <AppKit/NSObjectController.h>
@interface NSArrayController : NSController {
@class NSPredicate,NSIndexSet;
@interface NSArrayController : NSObjectController {
}
#if 0
-(NSArray *)sortDescriptors;
-(NSPredicate *)filterPredicate;
-(BOOL)alwaysUsesMultipleValuesMarker;
-(BOOL)clearsFilterPredicateOnInsertion;
-(BOOL)automaticallyPreparesContent;
-(BOOL)avoidsEmptySelection;
-(BOOL)selectsInsertedObjects;
-(BOOL)preservesSelection;
-(void)setSortDescriptors:(NSArray *)descriptors;
-(void)setFilterPredicate:(NSPredicate *)predicate;
-(void)setAlwaysUsesMultipleValuesMarker:(BOOL)flag;
-(void)setClearsFilterPredicateOnInsertion:(BOOL)flag;
-(void)setAutomaticallyPreparesContent:(BOOL)flag;
-(void)setAvoidsEmptySelection:(BOOL)flag;
-(void)setSelectsInsertedObjects:(BOOL)flag;
-(void)setPreservesSelection:(BOOL)flag;
-(void)addObject:object;
-(void)addObjects:(NSArray *)objects;
-(void)insertObject:object atArrangedObjectIndex:(unsigned)index;
-(void)insertObjects:(NSArray *)objects atArrangedObjectIndexes:(NSIndexSet *)indices;
-(void)removeObject:object;
-(void)removeObjectAtArrangedObjectIndex:(unsigned)index;
-(void)removeObjects:(NSArray *)objects;
-(void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indices;
-(NSIndexSet *)selectionIndexes;
-(unsigned)selectionIndex;
-(NSArray *)selectedObjects;
-(BOOL)canInsert;
-(BOOL)canSelectNext;
-(BOOL)canSelectPrevious;
-(void)insert:sender;
-(void)remove:sender;
-(void)selectNext:sender;
-(void)selectPrevious:sender;
-(void)setSelectedObjects:(NSArray *)objects;
-(void)setSelectionIndex:(unsigned)index;
-(BOOL)setSelectionIndexes:(NSIndexSet *)indices;
-(BOOL)addSelectedObjects:(NSArray *)objects;
-(BOOL)addSelectionIndexes:(NSIndexSet *)indices;
-(BOOL)removeSelectedObjects:(NSArray *)objects;
-(BOOL)removeSelectionInddexes:(NSIndexSet *)indices;
-arrangedObjects;
-(NSArray *)arrangeObjects:(NSArray *)objects;
-(void)rearrangeObjects;
#endif
@end

View File

@ -7,8 +7,15 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@interface NSController : NSObject {
@interface NSController : NSObject <NSCoding> {
}
-(BOOL)commitEditing;
-(void)discardEditing;
-(BOOL)isEditing;
-(void)objectDidBeginEditing:editor;
-(void)objectDidEndEditing:editor;
@end

View File

@ -6,7 +6,39 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSController.h>
#import <Foundation/NSRaise.h>
@implementation NSController
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-(BOOL)commitEditing {
NSUnimplementedMethod();
return NO;
}
-(void)discardEditing {
NSUnimplementedMethod();
}
-(BOOL)isEditing {
NSUnimplementedMethod();
return NO;
}
-(void)objectDidBeginEditing:editor {
NSUnimplementedMethod();
}
-(void)objectDidEndEditing:editor {
NSUnimplementedMethod();
}
@end

View File

@ -7,8 +7,50 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSController.h>
@class NSPredicate,NSFetchRequest,NSManagedObjectContext,NSMenuItem,NSError,NSArray;
@interface NSObjectController : NSController {
}
#if 0
-initWithContent:content;
-content;
-(Class)objectClass;
-(NSString *)entityName;
-(NSPredicate *)fetchPredicate;
-(NSManagedObjectContext *)managedObjectContext;
-(BOOL)isEditable;
-(BOOL)automaticallyPreparesContent;
-(void)setContent:content;
-(void)setObjectClass:(Class)class;
-(void)setEntityName:(NSString *)name;
-(void)setFetchPredicate:(NSPredicate *)predicate;
-(void)setManagedObjectContext:(NSManagedObjectContext *)context;
-(void)setEditable:(BOOL)flag;
-(void)setAutomaticallyPreparesContent:(BOOL)flag;
-(void)addObject:object;
-selection;
-(NSArray *)selectedObjects;
-newObject;
-(BOOL)canAdd;
-(BOOL)canRemove;
-(void)add:sender;
-(void)fetch:sender;
-(void)remove:sender;
-(void)removeObject:object;
-(void)prepareContent;
-(BOOL)fetchWithRequest:(NSFetchRequest *)fetchRequest merge:(BOOL)merge error:(NSError **)error;
-(BOOL)validateMenuItem:(NSMenuItem *)menuItem;
#endif
@end

View File

@ -5,10 +5,60 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSController.h>
#import <AppKit/NSObjectController.h>
@interface NSTreeController : NSController {
@class NSIndexPath;
@interface NSTreeController : NSObjectController <NSCoding,NSCopying> {
}
#if 0
-content;
-(NSString *)countKeyPath;
-(NSString *)childrenKeyPath;
-(NSString *)leafKeyPath;
-(NSArray *)sortDescriptors;
-(BOOL)alwaysUsesMultipleValuesMarker;
-(BOOL)avoidsEmptySelection;
-(BOOL)selectsInsertedObjects;
-(BOOL)preservesSelection;
-(void)setContent:content;
-(void)setCountKeyPath:(NSString *)path;
-(void)setChildrenKeyPath:(NSString *)path;
-(void)setLeafPathKey:(NSString *)key;
-(void)setSortDescriptors:(NSArray *)descriptors;
-(void)setAlwaysUsesMultipleValuesMarker:(BOOL)flag;
-(void)setAvoidsEmptySelection:(BOOL)flag;
-(void)setSelectsInsertedObjects:(BOOL)flag;
-(void)setPreservesSelection:(BOOL)flag;
-(void)insertObject:object atArrangedObjectIndexPath:(NSIndexPath *)indexPath;
-(void)insertObjects:(NSArray *)objects atArrangedObjectIndexPaths:(NSArray *)indexPaths;
-(void)removeObjectAtArrangedObjectIndexPath:(NSIndexPath *)indexPath;
-(void)removeObjectsAtArrangedObjectIndexPaths:(NSArray *)indexPaths;
-arrangedObjects;
-(void)rearrangeObjects;
-(NSArray *)selectedObjects;
-(NSIndexPath *)selectionIndexPath;
-(NSArray *)selectionIndexPaths;
-(BOOL)addSelectionIndexPaths:(NSArray *)indexPaths;
-(void)removeSelectionIndexPaths:(NSArray *)indexPaths;
-(BOOL)setSelectionIndexPath:(NSIndexPath *)indexPath;
-(BOOL)setSelectionIndexPaths:(NSArray *)indexPaths;
-(BOOL)canAddChid;
-(BOOL)canInsert;
-(BOOL)canInsertChild;
-(void)add:sender;
-(void)addChild:sender;
-(void)insert:sender;
-(void)insertChild:sender;
-(void)remove:sender;
#endif
@end

View File

@ -6,7 +6,22 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSTreeController.h>
#import <Foundation/NSRaise.h>
@implementation NSTreeController
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-copyWithZone:(NSZone *)zone {
NSUnimplementedMethod();
return [self retain];
}
@end

View File

@ -7,8 +7,31 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSController.h>
@class NSUserDefaults,NSDictionary;
@interface NSUserDefaultsController : NSController {
}
#if 0
+sharedUserDefaultsController;
-initWithDefault:(NSUserDefaults *)defaults initialValues:(NSDictionary *)values;
-(NSUserDefaults *)defaults;
-(NSDictionary *)initialValues;
-(BOOL)appliesImmediately;
-(void)setInitialValues:(NSDictionary *)initialValues;
-(void)setAppliesImmediately:(BOOL)flag;
-values;
-(BOOL)hasUnappliedChanges;
-(void)save:sender;
-(void)revert:sender;
-(void)revertToInitialValues:sender;
#endif
@end

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>159 154 356 240 0 0 1600 1178 </string>
<string>118 125 356 240 0 0 1280 1002 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
@ -11,7 +11,7 @@
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8H14</string>
<string>8P135</string>
<key>IBUsesTextArchiving</key>
<true/>
</dict>

File diff suppressed because it is too large Load Diff

Binary file not shown.

31
AppKit/binders/NSBinder.h Normal file
View File

@ -0,0 +1,31 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@interface _NSBinder : NSObject {
id source;
id destination;
id keyPath;
id binding;
}
- (id)source;
- (void)setSource:(id)value;
- (id)destination;
- (void)setDestination:(id)value;
- (id)keyPath;
- (void)setKeyPath:(id)value;
- (id)binding;
- (void)setBinding:(id)value;
-(void)bind;
-(void)unbind;
@end

77
AppKit/binders/NSBinder.m Normal file
View File

@ -0,0 +1,77 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSBinder.h"
@implementation _NSBinder
- (id)source {
return [[source retain] autorelease];
}
- (void)setSource:(id)value {
if (source != value)
{
source = value;
}
}
- (id)destination
{
return [[destination retain] autorelease];
}
- (void)setDestination:(id)value
{
if (destination != value)
{
destination = value;
}
}
- (id)keyPath {
return [[keyPath retain] autorelease];
}
- (void)setKeyPath:(id)value {
if (keyPath != value) {
[keyPath release];
keyPath = [value copy];
}
}
- (id)binding {
return [[binding retain] autorelease];
}
- (void)setBinding:(id)value {
if (binding != value) {
[binding release];
binding = [value copy];
}
}
-(void)stopObservingChanges {
}
-(void)dealloc
{
[self stopObservingChanges];
[keyPath release];
[binding release];
[super dealloc];
}
-(void)bind
{
}
-(void)unbind
{
}
@end

View File

@ -0,0 +1,16 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSBinder.h"
@interface _NSKVOBinder : _NSBinder
{
}
@end

View File

@ -0,0 +1,81 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSKVOBinder.h"
#import <Foundation/NSKeyValueObserving.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
@implementation _NSKVOBinder
-(void)startObservingChanges
{
[source addObserver:self
forKeyPath:binding
options:NSKeyValueObservingOptionNew
context:nil];
[destination addObserver:self
forKeyPath:keyPath
options:NSKeyValueObservingOptionNew
context:nil];
}
-(void)stopObservingChanges
{
NS_DURING
[source removeObserver:self forKeyPath:binding];
[destination removeObserver:self forKeyPath:keyPath];
NS_HANDLER
NS_ENDHANDLER
}
-(void)syncUp
{
id value=[destination valueForKeyPath:keyPath];
if(value)
[source setValue:value forKeyPath:binding];
else
{
value=[source valueForKeyPath:binding];
if(value)
[destination setValue:value forKeyPath:keyPath];
}
}
- (void)observeValueForKeyPath:(NSString *)kp ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
[self stopObservingChanges];
NSLog(@"bind event from %@.%@ to %@.%@ (%@)", [source className], binding, [destination className], keyPath, self);
if(object==source)
{
[destination setValue:[change valueForKey:NSKeyValueChangeNewKey]
forKey:keyPath];
}
else if(object==destination)
{
[source setValue:[change valueForKey:NSKeyValueChangeNewKey]
forKey:binding];
}
[self startObservingChanges];
}
-(void)bind
{
[self syncUp];
[self startObservingChanges];
}
-(void)unbind
{
[self stopObservingChanges];
}
@end

View File

@ -0,0 +1,14 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@class NSDictionary;
@interface NSObject (BindingSupport)
-(void)bind:(id)binding toObject:(id)destination withKeyPath:(NSString*)keyPath options:(NSDictionary*)options;
@end

View File

@ -0,0 +1,71 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSObject+BindingSupport.h>
#import "NSKVOBinder.h"
#import <Foundation/NSDictionary.h>
#import <Foundation/NSValue.h>
NSMutableDictionary *bindersForObjects=nil;
@implementation NSObject (BindingSupport)
-(Class)_binderClassForBinding:(id)binding
{
//return nil;
return [_NSKVOBinder class];
}
-(id)_binderForBinding:(id)binding create:(BOOL)create
{
if(!bindersForObjects)
bindersForObjects=[NSMutableDictionary new];
id key = [NSValue valueWithNonretainedObject:self];
id ownBinders = [bindersForObjects objectForKey:key];
if(!ownBinders)
{
ownBinders = [NSMutableDictionary dictionary];
[bindersForObjects setObject:ownBinders forKey:key];
}
id binder=[ownBinders objectForKey:binding];
if(!binder && create)
{
binder = [[[self _binderClassForBinding:binding] new] autorelease];
[ownBinders setObject:binder forKey:binding];
}
return binder;
}
-(void)_cleanupBinders
{
[bindersForObjects removeObjectForKey:[NSValue valueWithNonretainedObject:self]];
}
-(void)bind:(id)binding toObject:(id)destination withKeyPath:(NSString*)keyPath options:(NSDictionary*)options
{
if(![self _binderClassForBinding:binding])
return;
id binder=[self _binderForBinding:binding create:NO];
if(binder)
[binder unbind];
else
binder=[self _binderForBinding:binding create:YES];
[binder setSource:self];
[binder setDestination:destination];
[binder setKeyPath:keyPath];
[binder setBinding:binding];
[binder bind];
}
@end

View File

@ -0,0 +1,17 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSBinder.h"
@class NSArray;
@interface _NSTableViewBinder : _NSBinder
{
NSArray* rowValues;
}
@end

View File

@ -0,0 +1,90 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSTableViewBinder.h"
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSKeyValueObserving.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSArray.h>
@implementation _NSTableViewBinder
- (NSArray *)rowValues
{
return [[rowValues retain] autorelease];
}
- (void)setRowValues:(NSArray *)value
{
if (rowValues != value)
{
[rowValues release];
rowValues = [value copy];
}
}
-(void)dealloc
{
[self setRowValues:nil];
[super dealloc];
}
-(void)startObservingChanges
{
[destination addObserver:self forKeyPath:keyPath options:7 context:nil];
}
-(void)stopObservingChanges
{
NS_DURING
[destination removeObserver:self forKeyPath:keyPath];
NS_HANDLER
NS_ENDHANDLER
}
-(void)syncUp
{
[self setRowValues:[destination valueForKeyPath:keyPath]];
}
- (void)observeValueForKeyPath:(NSString *)kp ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
[self stopObservingChanges];
if(object==destination)
{
[self setRowValues:[change valueForKey:NSKeyValueChangeNewKey]];
}
[self startObservingChanges];
}
-(void)bind
{
[self startObservingChanges];
[self syncUp];
}
-(void)unbind
{
[self stopObservingChanges];
}
-(int)count
{
return [rowValues count];
}
-(id)objectAtIndex:(unsigned)row
{
return [rowValues objectAtIndex:row];
}
@end

View File

@ -7,17 +7,18 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
#import <AppKit/AppKitExport.h>
@class NSURL,NSBundle,NSDictionary,NSArray,NSData;
FOUNDATION_EXPORT NSString *NSNibOwner;
FOUNDATION_EXPORT NSString *NSNibTopLevelObjects;
APPKIT_EXPORT NSString *NSNibOwner;
APPKIT_EXPORT NSString *NSNibTopLevelObjects;
@interface NSNib : NSObject {
NSData *_data;
}
-initWithContentsofURL:(NSURL *)url;
-initWithContentsOfURL:(NSURL *)url;
-initWithNibNamed:(NSString *)name bundle:(NSBundle *)bundle;
-(BOOL)instantiateNibWithExternalNameTable:(NSDictionary *)nameTable;

View File

@ -7,31 +7,107 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSNib.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSRaise.h>
#import "NSNibKeyedUnarchiver.h"
#import <AppKit/NSNibLoading.h>
#import <AppKit/NSMenu.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSTableCornerView.h>
#import "NSIBObjectData.h"
#import "NSNibHelpConnector.h"
NSString *NSNibOwner=@"NSNibOwner";
NSString *NSNibOwner=@"NSOwner";
NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
@implementation NSNib
-initWithContentsofURL:(NSURL *)url {
NSUnimplementedMethod();
-initWithContentsOfFile:(NSString *)path {
NSString *keyedobjects=[[path stringByAppendingPathComponent:@"keyedobjects"] stringByAppendingPathExtension:@"nib"];
if((_data=[[NSData alloc] initWithContentsOfFile:keyedobjects])==nil){
[self dealloc];
return nil;
}
return self;
}
-initWithContentsOfURL:(NSURL *)url {
if(![url isFileURL]){
[self dealloc];
return nil;
}
return [self initWithContentsOfFile:[url path]];
}
-initWithNibNamed:(NSString *)name bundle:(NSBundle *)bundle {
NSUnimplementedMethod();
return self;
NSString *path=[bundle pathForResource:name ofType:@"nib"];
if(path==nil){
[self dealloc];
return nil;
}
return [self initWithContentsOfFile:path];
}
-(void)dealloc {
[_data release];
[super dealloc];
}
-(BOOL)instantiateNibWithExternalNameTable:(NSDictionary *)nameTable {
NSUnimplementedMethod();
return NO;
NSNibKeyedUnarchiver *unarchiver=[[[NSNibKeyedUnarchiver alloc] initForReadingWithData:_data externalNameTable:nameTable] autorelease];
NSIBObjectData *objectData;
NSArray *allObjects;
int i,count;
NSMenu *menu;
/*
TO DO:
- utf8 in the multinational panel
- misaligned objects in boxes everywhere
*/
[unarchiver setClass:[NSTableCornerView class] forClassName:@"_NSCornerView"];
[unarchiver setClass:[NSNibHelpConnector class] forClassName:@"NSIBHelpConnector"];
objectData=[unarchiver decodeObjectForKey:@"IB.objectdata"];
[objectData buildConnectionsWithNameTable:nameTable];
if((menu=[objectData mainMenu])!=nil)
[NSApp setMainMenu:menu];
allObjects=[[unarchiver allObjects] arrayByAddingObjectsFromArray:[nameTable allValues]];
count=[allObjects count];
for(i=0;i<count;i++){
id object=[allObjects objectAtIndex:i];
if([object respondsToSelector:@selector(awakeFromNib)])
[object awakeFromNib];
}
for(i=0;i<count;i++){
id object=[allObjects objectAtIndex:i];
if([object respondsToSelector:@selector(postAwakeFromNib)])
[object performSelector:@selector(postAwakeFromNib)];
}
[[objectData visibleWindows] makeObjectsPerformSelector:@selector(makeKeyAndOrderFront:) withObject:nil];
return (objectData!=nil);
}
-(BOOL)instantiateNibWithOwner:owner topLevelObjects:(NSArray **)objects {
NSUnimplementedMethod();
return NO;
NSDictionary *nameTable=[NSDictionary dictionaryWithObject:owner forKey:NSNibOwner];
if(objects!=NULL){
NSLog(@"-[%@ %s] specifying non-NULL for topLevelObjects not implemented",isa,SELNAME(_cmd));
}
return [self instantiateNibWithExternalNameTable:nameTable];
}
@end

View File

@ -0,0 +1,16 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSNibConnector.h>
@interface NSNibBindingConnector : NSNibConnector
{
id _binding;
id _keyPath;
id _options;
}
@end

View File

@ -0,0 +1,47 @@
/* Copyright (c) 2007 Johannes Fortmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "NSNibBindingConnector.h"
#import <AppKit/NSObject+BindingSupport.h>
@implementation NSNibBindingConnector
-(void)dealloc
{
[_binding release];
[_keyPath release];
[_options release];
[super dealloc];
}
-(id)initWithCoder:(NSCoder *)coder
{
if(self = [super initWithCoder:coder])
{
int version=[coder decodeIntForKey:@"NSNibBindingConnectorVersion"];
if(version != 2)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] unknown connector version %i",isa,SELNAME(_cmd), version];
_binding=[[coder decodeObjectForKey:@"NSBinding"] retain];
_keyPath=[[coder decodeObjectForKey:@"NSKeyPath"] retain];
_options=[[coder decodeObjectForKey:@"NSOptions"] retain];
}
else {
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not implemented for coder %@",isa,SELNAME(_cmd),coder];
}
return self;
}
-(void)establishConnection
{
NSLog(@"binding between %@.%@ and %@.%@", [_source className], _binding, [_destination className], _keyPath);
[_source bind:_binding
toObject:_destination
withKeyPath:_keyPath
options:_options];
}
@end

View File

@ -8,7 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/Foundation.h>
@interface NSNibConnector : NSObject {
@interface NSNibConnector : NSObject <NSCoding> {
id _source;
id _destination;
NSString *_label;

View File

@ -8,12 +8,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// Original - Christopher Lloyd <cjwl@objc.net>
#import <AppKit/NSNibLoading.h>
#import "NSNibKeyedUnarchiver.h"
#import <AppKit/NSMenu.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSTableCornerView.h>
#import "NSIBObjectData.h"
#import "NSNibHelpConnector.h"
#import <AppKit/NSNib.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSRaise.h>
@implementation NSObject(NSNibLoading)
@ -25,60 +23,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation NSBundle(NSNibLoading)
+(BOOL)loadNibFile:(NSString *)path externalNameTable:(NSDictionary *)nameTable withZone:(NSZone *)zone {
NSString *keyedArchive=[[path stringByAppendingPathComponent:@"keyedobjects"] stringByAppendingPathExtension:@"nib"];
NSData *keyedData=[NSData dataWithContentsOfFile:keyedArchive];
NSNib *nib=[[[NSNib allocWithZone:zone] initWithContentsOfFile:path] autorelease];
// NSLog(@"LOADING %@",path);
if(keyedData==nil)
return NO;
else {
NSNibKeyedUnarchiver *unarchiver=[[NSNibKeyedUnarchiver alloc] initForReadingWithData:keyedData externalNameTable:nameTable];
NSIBObjectData *objectData;
NSArray *allObjects;
int i,count;
NSMenu *menu;
/*
TO DO:
- utf8 in the multinational panel
- misaligned objects in boxes everywhere
*/
[unarchiver setClass:[NSTableCornerView class] forClassName:@"_NSCornerView"];
[unarchiver setClass:[NSNibHelpConnector class] forClassName:@"NSIBHelpConnector"];
objectData=[unarchiver decodeObjectForKey:@"IB.objectdata"];
[objectData buildConnectionsWithNameTable:nameTable];
if((menu=[objectData mainMenu])!=nil)
[NSApp setMainMenu:menu];
allObjects=[[unarchiver allObjects] arrayByAddingObjectsFromArray:[nameTable allValues]];
count=[allObjects count];
for(i=0;i<count;i++){
id object=[allObjects objectAtIndex:i];
if([object respondsToSelector:@selector(awakeFromNib)])
[object awakeFromNib];
}
for(i=0;i<count;i++){
id object=[allObjects objectAtIndex:i];
if([object respondsToSelector:@selector(postAwakeFromNib)])
[object performSelector:@selector(postAwakeFromNib)];
}
[[objectData visibleWindows] makeObjectsPerformSelector:@selector(makeKeyAndOrderFront:) withObject:nil];
return (objectData!=nil);
}
return [nib instantiateNibWithExternalNameTable:nameTable];
}
+(BOOL)loadNibNamed:(NSString *)name owner:owner {
NSDictionary *nameTable=[NSDictionary dictionaryWithObject:owner forKey:@"NSOwner"];
NSString *path;
NSDictionary *nameTable=[NSDictionary dictionaryWithObject:owner forKey:NSNibOwner];
NSBundle *bundle=[NSBundle bundleForClass:[owner class]];
NSString *path;
path=[bundle pathForResource:name ofType:@"nib"];
if(path==nil)
@ -91,8 +44,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
-(BOOL)loadNibFile:(NSString *)path externalNameTable:(NSDictionary *)nameTable withZone:(NSZone *)zone {
NSUnimplementedMethod();
return NO;
NSNib *nib=[[[NSNib allocWithZone:zone] initWithContentsOfFile:path] autorelease];
return [nib instantiateNibWithExternalNameTable:nameTable];
}
@end

View File

@ -9,7 +9,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSObject.h>
#import <Foundation/NSRange.h>
@class NSString,NSEnumerator,NSDictionary;
@class NSString,NSEnumerator,NSDictionary,NSPredicate;
@interface NSArray : NSObject <NSCopying,NSMutableCopying,NSCoding>
@ -68,6 +68,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(NSString *)descriptionWithLocale:(NSDictionary *)locale
indent:(unsigned)level;
-(NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate;
@end
#import <Foundation/NSMutableArray.h>

View File

@ -21,6 +21,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSPropertyListReader.h>
#import <Foundation/NSPropertyListWriter.h>
#import <Foundation/NSKeyedUnarchiver.h>
#import <Foundation/NSPredicate.h>
#import <malloc.h>
@ -414,6 +415,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return nil;
}
-(NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate {
int i,count=[self count];
NSMutableArray *result=[NSMutableArray arrayWithCapacity:count];
for(i=0;i<count;i++){
id check=[self objectAtIndex:i];
if([predicate evaluateObject:check])
[result addObject:check];
}
return result;
}
@end

View File

@ -37,4 +37,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(void)sortUsingSelector:(SEL)selector;
-(void)sortUsingFunction:(int (*)(id, id, void *))compare context:(void *)context;
-(void)filterUsingPredicate:(NSPredicate *)predicate;
@end

View File

@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSMutableArray_concrete.h>
#import <Foundation/NSAutoreleasePool-private.h>
#import <Foundation/NSPropertyListReader.h>
#import <Foundation/NSPredicate.h>
#import <malloc.h>
@ -291,5 +292,15 @@ static int selectorCompare(id object1,id object2,void *userData){
}
}
-(void)filterUsingPredicate:(NSPredicate *)predicate {
int count=[self count];
while(--count>=0){
id check=[self objectAtIndex:count];
if(![predicate evaluateObject:check])
[self removeObjectAtIndex:count];
}
}
@end

View File

@ -5,3 +5,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
typedef struct {
int notImplemented;
} NSDecimal;

View File

@ -7,9 +7,63 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSNumber.h>
#import <Foundation/NSDecimal.h>
FOUNDATION_EXPORT NSString *NSDecimalNumberDivideByZeroException;
FOUNDATION_EXPORT NSString *NSDecimalNumberUnderflowException;
FOUNDATION_EXPORT NSString *NSDecimalNumberOverflowException;
FOUNDATION_EXPORT NSString *NSDecimalNumberExactnessException;
@protocol NSDecimalNumberBehaviors
@end
@interface NSDecimalNumber : NSNumber {
}
#if 0
-initWithDecimal:(NSDecimal)decimal;
-initWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag;
-initWithString:(NSString *)string;
-initWithString:(NSString *)string locale:(NSDictionary *)locale;
+(NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)decimal;
+(NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)negative;
+(NSDecimalNumber *)decimalNumberWithString:(NSString *)string;
+(NSDecimalNumber *)decimalNumberWithString:(NSString *)string locale:(NSDictionary *)locale;
+(NSDecimalNumber *)zero;
+(NSDecimalNumber *)one;
+(NSDecimalNumber *)minimumDecimalNumber;
+(NSDecimalNumber *)maximumDecimalNumber;
+(NSDecimalNumber *)notANumber;
+(id <NSDecimalNumberBehaviors>)defaultBehavior;
+(void)setDefaultBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSComparisonResult)compare:(NSNumber *)other;
-(double)doubleValue;
-(const char *)objCType;
-(NSDecimalNumber *)decimalNumberByRoundingAccordingToBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)other;
-(NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)other withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)other;
-(NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)other withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)other;
-(NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)other withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)other;
-(NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)other withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power;
-(NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power;
-(NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power withBehavior:(id <NSDecimalNumberBehaviors>)behavior;
-(NSString *)descriptionWithLocale:(NSDictionary *)locale;
#endif
@end

View File

@ -7,6 +7,12 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSString.h>
NSString *NSDecimalNumberDivideByZeroException=@"NSDecimalNumberDivideByZeroException";
NSString *NSDecimalNumberUnderflowException=@"NSDecimalNumberUnderflowException";
NSString *NSDecimalNumberOverflowException=@"NSDecimalNumberOverflowException";
NSString *NSDecimalNumberExactnessException=@"NSDecimalNumberExactnessException";
@implementation NSDecimalNumber

View File

@ -70,6 +70,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return [NSNumber numberWithShort:*(short*)value];
case 'S':
return [NSNumber numberWithUnsignedShort:*(unsigned short*)value];
case 'c':
return [NSNumber numberWithChar:*(char*)value];
case 'C':
return [NSNumber numberWithUnsignedChar:*(unsigned char*)value];
default:
// FIX #warning some wrapping types unimplemented
return [NSString stringWithFormat:@"FIXME: wrap value of type %s unimplemented for get", type];
@ -108,7 +112,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 'd':
*(double*)buffer = [value doubleValue];
return YES;
case 'c':
*(char*)buffer = [value charValue];
return YES;
case 'C':
*(unsigned char*)buffer = [value unsignedCharValue];
return YES;
default:
// FIX #warning some wrapping types unimplemented
NSLog(@"FIXME: wrap value of type %s unimplemented for set", type);

View File

@ -247,7 +247,7 @@ NSLock *kvoLock=nil;
}
}
}
NSMutableArray *observers=[dict objectForKey:key];
NSMutableArray *observers=[[dict objectForKey:key] copy];
NSEnumerator *en=[observers objectEnumerator];
_NSObservationInfo *info;
@ -300,6 +300,7 @@ NSLock *kvoLock=nil;
[dict release];
}
[observers release];
}
+(void)setKeys:(NSArray *)keys triggerChangeNotificationsForDependentKey:(NSString *)dependentKey
@ -364,18 +365,30 @@ NSLock *kvoLock=nil;
// FIX: add more types
@interface NSObject (KVOSetters)
CHANGE_DEFINE(float);
CHANGE_DEFINE(double);
CHANGE_DEFINE(id);
CHANGE_DEFINE(int);
CHANGE_DEFINE(NSSize);
CHANGE_DEFINE(NSPoint);
CHANGE_DEFINE(NSRect);
CHANGE_DEFINE(NSRange);
CHANGE_DEFINE(char);
CHANGE_DEFINE(long);
CHANGE_DEFINE(SEL);
@end
@implementation NSObject (KVOSetters)
CHANGE_DECLARATION(float)
CHANGE_DECLARATION(double)
CHANGE_DECLARATION(id)
CHANGE_DECLARATION(int)
CHANGE_DECLARATION(NSSize)
CHANGE_DECLARATION(NSPoint)
CHANGE_DECLARATION(NSRect)
CHANGE_DECLARATION(NSRange)
CHANGE_DECLARATION(char)
CHANGE_DECLARATION(long)
CHANGE_DECLARATION(SEL)
-(id)_KVO_className
{
@ -384,6 +397,9 @@ CHANGE_DECLARATION(NSPoint)
+(void)_KVO_buildDependencyUnion
{
/*
This method gathers dependent keys from all superclasses and merges them together
*/
NSMutableDictionary* dict=[self observationInfo];
if(!dict)
{
@ -499,18 +515,30 @@ CHANGE_DECLARATION(NSPoint)
{
const char* firstParameterType=[[self methodSignatureForSelector:method->method_name] getArgumentTypeAtIndex:2];
// check for correct type
/* check for correct type: either perfect match
or primitive signed type matching unsigned type
(i.e. tolower(@encode(unsigned long)[0])==@encode(long)[0])
*/
#define CHECK_AND_ASSIGN(a) \
if(!strcmp(firstParameterType, @encode(a))) \
if(!strcmp(firstParameterType, @encode(a)) || \
(strlen(@encode(a))==1 && \
strlen(firstParameterType)==1 && \
tolower(firstParameterType[0])==@encode(a)[0])) \
{ \
kvoSelector = @selector( CHANGE_SELECTOR(a) ); \
}
// FIX: add more types
CHECK_AND_ASSIGN(id);
CHECK_AND_ASSIGN(float);
CHECK_AND_ASSIGN(double);
CHECK_AND_ASSIGN(int);
CHECK_AND_ASSIGN(NSSize);
CHECK_AND_ASSIGN(NSPoint);
CHECK_AND_ASSIGN(NSRect);
CHECK_AND_ASSIGN(NSRange);
CHECK_AND_ASSIGN(char);
CHECK_AND_ASSIGN(long);
CHECK_AND_ASSIGN(SEL);
// if(kvoSelector==0)
// NSLog(@"type %s not defined in %s:%i (selector %s on class %@)", firstParameterType, __FILE__, __LINE__, SELNAME(method->method_name), [self className]);
@ -520,7 +548,7 @@ CHANGE_DECLARATION(NSPoint)
if(kvoSelector!=0)
{
// if we already added too many methods, increase the size of the method list array
if(currentMethod>maxMethods)
if(currentMethod>=maxMethods)
{
maxMethods*=2;
newMethods=realloc(newMethods, maxMethods*sizeof(struct objc_method));
@ -626,6 +654,11 @@ CHANGE_DECLARATION(NSPoint)
[oldValue release];
[super dealloc];
}
-(NSString *)description
{
return [NSString stringWithFormat:@"<%@ %p (%@ -> %@)>", [self className], self, originalKeyPath, observer];
}
@end
BOOL CreateClassDefinition( const char * name,

View File

@ -7,9 +7,57 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSPredicate.h>
@class NSExpression;
@interface NSComparisonPredicate : NSPredicate {
typedef enum {
NSDirectPredicateModifier,
NSAllPredicateModifier,
NSAnyPredicateModifier
} NSComparisonPredicateModifier;
typedef enum {
NSLessThanPredicateOperatorType,
NSLessThanOrEqualToPredicateOperatorType,
NSGreaterThanPredicateOperatorType,
NSGreaterThanOrEqualToPredicateOperatorType,
NSEqualToPredicateOperatorType,
NSNotEqualToPredicateOperatorType,
NSMatchesPredicateOperatorType,
NSLikePredicateOperatorType,
NSBeginsWithPredicateOperatorType,
NSEndsWithPredicateOperatorType,
NSInPredicateOperatorType,
NSCustomSelectorPredicateOperatorType
} NSPredicateOperatorType;
enum {
NSCaseInsensitivePredicateOption=0x01,
NSDiacriticInsensitivePredicateOption=0x02
};
@interface NSComparisonPredicate : NSPredicate <NSCoding,NSCopying> {
NSExpression *_left;
NSExpression *_right;
NSComparisonPredicateModifier _modifier;
NSPredicateOperatorType _type;
unsigned _options;
SEL _customSelector;
}
-initWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(unsigned)options;
-initWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right customSelector:(SEL)selector;
+(NSPredicate *)predicateWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(unsigned)options;
+(NSPredicate *)predicateWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right customSelector:(SEL)selector;
-(NSExpression *)leftExpression;
-(NSExpression *)rightExpression;
-(NSPredicateOperatorType)predicateOperatorType;
-(NSComparisonPredicateModifier)comparisonPredicateModifier;
-(unsigned)options;
-(SEL)customSelector;
@end

View File

@ -6,7 +6,125 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSComparisonPredicate.h>
#import <Foundation/NSExpression.h>
#import <Foundation/NSRaise.h>
@implementation NSComparisonPredicate
-initWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(unsigned)options {
_left=[left retain];
_right=[right retain];
_modifier=modifier;
_type=type;
_options=options;
_customSelector=NULL;
return self;
}
-initWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right customSelector:(SEL)selector {
_left=[left retain];
_right=[right retain];
_modifier=NSDirectPredicateModifier;
_type=NSCustomSelectorPredicateOperatorType;
_options=0;
_customSelector=selector;
return self;
}
-(void)dealloc {
[_left release];
[_right release];
[super dealloc];
}
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-copyWithZone:(NSZone *)zone {
return [self retain];
}
+(NSPredicate *)predicateWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(unsigned)options {
return [[[self alloc] initWithLeftExpression:left rightExpression:right modifier:modifier type:type options:options] autorelease];
}
+(NSPredicate *)predicateWithLeftExpression:(NSExpression *)left rightExpression:(NSExpression *)right customSelector:(SEL)selector {
return [[[self alloc] initWithLeftExpression:left rightExpression:right customSelector:selector] autorelease];
}
-(NSExpression *)leftExpression {
return _left;
}
-(NSExpression *)rightExpression {
return _right;
}
-(NSPredicateOperatorType)predicateOperatorType {
return _type;
}
-(NSComparisonPredicateModifier)comparisonPredicateModifier {
return _modifier;
}
-(unsigned)options {
return _options;
}
-(SEL)customSelector {
return _customSelector;
}
-(BOOL)evaluateObject:object {
id leftResult=[_left expressionValueWithObject:object context:nil];
id rightResult=[_right expressionValueWithObject:object context:nil];
switch(_type){
case NSLessThanPredicateOperatorType:
break;
case NSLessThanOrEqualToPredicateOperatorType:
break;
case NSGreaterThanPredicateOperatorType:
break;
case NSGreaterThanOrEqualToPredicateOperatorType:
break;
case NSEqualToPredicateOperatorType:
break;
case NSNotEqualToPredicateOperatorType:
break;
case NSMatchesPredicateOperatorType:
break;
case NSLikePredicateOperatorType:
break;
case NSBeginsWithPredicateOperatorType:
break;
case NSEndsWithPredicateOperatorType:
break;
case NSInPredicateOperatorType:
break;
case NSCustomSelectorPredicateOperatorType:
break;
}
}
@end

View File

@ -7,8 +7,24 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSPredicate.h>
@interface NSCompoundPredicate : NSPredicate {
typedef enum {
NSNotPredicateType,
NSAndPredicateType,
NSOrPredicateType
} NSCompoundPredicateType;
@interface NSCompoundPredicate : NSPredicate {
NSCompoundPredicateType _type;
NSArray *_predicates;
}
-initWithType:(NSCompoundPredicateType)type subpredicates:(NSArray *)subpredicates;
+(NSPredicate *)notPredicateWithSubpredicate:(NSPredicate *)predicate;
+(NSPredicate *)andPredicateWithSubpredicates:(NSArray *)predicates;
+(NSPredicate *)orPredicateWithSubpredicates:(NSArray *)predicates;
-(NSCompoundPredicateType)compoundPredicateType;
-(NSArray *)subpredicates;
@end

View File

@ -6,8 +6,68 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSCompoundPredicate.h>
#import <Foundation/NSArray.h>
@implementation NSCompoundPredicate
-initWithType:(NSCompoundPredicateType)type subpredicates:(NSArray *)predicates {
_type=type;
_predicates=[predicates retain];
return self;
}
-(void)dealloc {
[_predicates release];
[super dealloc];
}
+(NSPredicate *)notPredicateWithSubpredicate:(NSPredicate *)predicate {
return [[[self alloc] initWithType:NSNotPredicateType subpredicates:[NSArray arrayWithObject:predicate]] autorelease];
}
+(NSPredicate *)andPredicateWithSubpredicates:(NSArray *)predicates {
return [[[self alloc] initWithType:NSAndPredicateType subpredicates:predicates] autorelease];
}
+(NSPredicate *)orPredicateWithSubpredicates:(NSArray *)predicates {
return [[[self alloc] initWithType:NSOrPredicateType subpredicates:predicates] autorelease];
}
-(NSCompoundPredicateType)compoundPredicateType {
return _type;
}
-(NSArray *)subpredicates {
return _predicates;
}
-(BOOL)evaluateObject:object {
BOOL result=NO;
int i,count=[_predicates count];
for(i=0;i<count;i++){
NSPredicate *predicate=[_predicates objectAtIndex:i];
switch(_type){
case NSNotPredicateType:
return ![predicate evaluateObject:object];
case NSAndPredicateType:
if(i==0)
result=[predicate evaluateObject:object];
else
result=result && [predicate evaluateObject:object];
break;
case NSOrPredicateType:
if([predicate evaluateObject:object])
return YES;
break;
}
}
return result;
}
@end

View File

@ -7,9 +7,39 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@class NSArray,NSMutableDictionary;
@interface NSExpression : NSObject {
typedef enum {
NSConstantValueExpressionType,
NSEvaluatedObjectExpressionType,
NSVariableExpressionType,
NSKeyPathExpressionType,
NSFunctionExpressionType
} NSExpressionType;
@interface NSExpression : NSObject <NSCoding,NSCopying> {
NSExpressionType _type;
id _value;
NSArray *_arguments;
}
-initWithExpressionType:(NSExpressionType)type;
+(NSExpression *)expressionForConstantValue:value;
+(NSExpression *)expressionForEvaluatedObject;
+(NSExpression *)expressionForVariable:(NSString *)string;
+(NSExpression *)expressionForKeyPath:(NSString *)keyPath;
+(NSExpression *)expressionForFunction:(NSString *)name arguments:(NSArray *)arguments;
-(NSExpressionType)expressionType;
-constantValue;
-(NSString *)variable;
-(NSString *)keyPath;
-(NSString *)function;
-(NSArray *)arguments;
-(NSExpression *)operand;
-expressionValueWithObject:object context:(NSMutableDictionary *)context;
@end

View File

@ -6,8 +6,129 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSExpression.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSRaise.h>
#import <Foundation/NSKeyValueCoding.h>
@implementation NSExpression
-initWithExpressionType:(NSExpressionType)type {
_type=type;
_value=nil;
_arguments=nil;
return self;
}
-initWithExpressionType:(NSExpressionType)type value:value arguments:(NSArray *)arguments {
_type=type;
_value=[value copy];
_arguments=[arguments retain];
return self;
}
-(void)dealloc {
[_value release];
[_arguments release];
[super dealloc];
}
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-copyWithZone:(NSZone *)zone {
return [self retain];
}
+(NSExpression *)expressionForConstantValue:value {
return [[[self alloc] initWithExpressionType:NSConstantValueExpressionType value:value arguments:nil] autorelease];
}
+(NSExpression *)expressionForEvaluatedObject {
return [[[self alloc] initWithExpressionType:NSEvaluatedObjectExpressionType value:nil arguments:nil] autorelease];
}
+(NSExpression *)expressionForVariable:(NSString *)string {
return [[[self alloc] initWithExpressionType:NSVariableExpressionType value:string arguments:nil] autorelease];
}
+(NSExpression *)expressionForKeyPath:(NSString *)keyPath {
return [[[self alloc] initWithExpressionType:NSKeyPathExpressionType value:keyPath arguments:nil] autorelease];
}
+(NSExpression *)expressionForFunction:(NSString *)name arguments:(NSArray *)arguments {
// FIX validate name
return [[[self alloc] initWithExpressionType:NSFunctionExpressionType value:name arguments:arguments] autorelease];
}
-(NSExpressionType)expressionType {
return _type;
}
-constantValue {
if(_type!=NSConstantValueExpressionType)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not of NSConstantValueExpressionType",isa,SELNAME(_cmd)];
return _value;
}
-(NSString *)variable {
if(_type!=NSVariableExpressionType)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not of NSVariableExpressionType",isa,SELNAME(_cmd)];
return _value;
}
-(NSString *)keyPath {
if(_type!=NSKeyPathExpressionType)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not of NSKeyPathExpressionType",isa,SELNAME(_cmd)];
return _value;
}
-(NSString *)function {
if(_type!=NSFunctionExpressionType)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not of NSFunctionExpressionType",isa,SELNAME(_cmd)];
return _value;
}
-(NSArray *)arguments {
if(_type!=NSFunctionExpressionType)
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not of NSFunctionExpressionType",isa,SELNAME(_cmd)];
return _arguments;
}
-(NSExpression *)operand {
}
-expressionValueWithObject:object context:(NSMutableDictionary *)context {
switch(_type){
case NSConstantValueExpressionType:
return _value;
case NSEvaluatedObjectExpressionType:
return object;
case NSVariableExpressionType:
NSUnimplementedMethod();
return nil;
case NSKeyPathExpressionType:
return [object valueForKeyPath:_value];
case NSFunctionExpressionType:
NSUnimplementedMethod();
return nil;
}
}
@end

View File

@ -7,9 +7,21 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@class NSArray,NSDictionary;
@interface NSPredicate : NSObject {
@interface NSPredicate : NSObject <NSCoding,NSCopying> {
NSString *_format;
}
+(NSPredicate *)predicateWithFormat:(NSString *)format arguments:(va_list)arguments;
+(NSPredicate *)predicateWithFormat:(NSString *)format,...;
+(NSPredicate *)predicateWithFormat:(NSString *)format argumentArray:(NSArray *)arguments;
+(NSPredicate *)predicateWithValue:(BOOL)value;
-(NSString *)predicateFormat;
-(NSPredicate *)predicateWithSubstitutionVariables:(NSDictionary *)variables;
-(BOOL)evaluateObject:object;
@end

View File

@ -6,8 +6,49 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSPredicate.h>
#import <Foundation/NSRaise.h>
@implementation NSPredicate
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-copyWithZone:(NSZone *)zone {
return [self retain];
}
+(NSPredicate *)predicateWithFormat:(NSString *)format arguments:(va_list)arguments {
}
+(NSPredicate *)predicateWithFormat:(NSString *)format,... {
va_list arguments;
va_start(arguments,format);
return [self predicateWithFormat:format arguments:arguments];
}
+(NSPredicate *)predicateWithFormat:(NSString *)format argumentArray:(NSArray *)arguments {
}
+(NSPredicate *)predicateWithValue:(BOOL)value {
}
-(NSString *)predicateFormat {
return _format;
}
-(NSPredicate *)predicateWithSubstitutionVariables:(NSDictionary *)variables {
}
-(BOOL)evaluateObject:object {
}
@end

View File

@ -8,6 +8,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSObject.h>
@interface NSSortDescriptor : NSObject
@interface NSSortDescriptor : NSObject <NSCoding,NSCopying> {
NSString *_key;
BOOL _ascending;
SEL _selector;
}
-initWithKey:(NSString *)key ascending:(BOOL)ascending;
-initWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector;
-(NSString *)key;
-(BOOL)ascending;
-(SEL)selector;
-(NSComparisonResult)compareObject:first toObject:second;
-reversedSortDescriptor;
@end

View File

@ -7,7 +7,65 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSSortDescriptor.h>
#import <Foundation/NSString.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSRaise.h>
@implementation NSSortDescriptor
-initWithKey:(NSString *)key ascending:(BOOL)ascending {
return [self initWithKey:key ascending:ascending selector:@selector(compare:)];
}
-initWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector {
_key=[key copy];
_ascending=ascending;
_selector=selector;
return self;
}
-(void)dealloc {
[_key release];
[super dealloc];
}
-initWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
return self;
}
-(void)encodeWithCoder:(NSCoder *)coder {
NSUnimplementedMethod();
}
-copyWithZone:(NSZone *)zone {
return [self retain];
}
-(NSString *)key {
return _key;
}
-(BOOL)ascending {
return _ascending;
}
-(SEL)selector {
return _selector;
}
-(NSComparisonResult)compareObject:first toObject:second {
id checkFirst=[first valueForKeyPath:_key];
id checkSecond=[second valueForKeyPath:_key];
if(_ascending)
return (NSComparisonResult)[checkFirst performSelector:_selector withObject:checkSecond];
else
return (NSComparisonResult)[checkSecond performSelector:_selector withObject:checkFirst];
}
-reversedSortDescriptor {
return [[[isa alloc] initWithKey:_key ascending:!_ascending selector:_selector] autorelease];
}
@end

View File

@ -18,6 +18,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSNotification.h>
#import <Foundation/NSRunLoop.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSRaise.h>
#import "NSSocket_bsd.h"
#import <stdio.h>