Smaller clean-ups, mostly relating to categories.

This commit is contained in:
Nicholas Shanks 2010-08-31 10:28:19 +00:00
parent 972ca4dde4
commit 8c3386497a
13 changed files with 40 additions and 25 deletions

View File

@ -1,5 +1,14 @@
#import <Foundation/Foundation.h>
/*******************************/
/***** WARNING *****/
/* This file is being broken */
/* apart into smaller files. */
/* If you want to change any */
/* methods here, split them */
/* into new files beforehand. */
/*******************************/
/*!
@header
@abstract Numerous small category methods on Foundation and AppKit classes.

View File

@ -1,11 +1,11 @@
#import <Carbon/Carbon.h>
#import <AppKit/AppKit.h>
@interface NSEvent (ModifierKeys)
@interface NSEvent (NGSModifierKeys)
+ (BOOL) isControlKeyDown;
+ (BOOL) isOptionKeyDown;
+ (BOOL) isCommandKeyDown;
+ (BOOL) isShiftKeyDown;
+ (BOOL)isControlKeyDown;
+ (BOOL)isOptionKeyDown;
+ (BOOL)isCommandKeyDown;
+ (BOOL)isShiftKeyDown;
@end

View File

@ -1,23 +1,23 @@
#import "NSEvent-ModifierKeys.h"
@implementation NSEvent (ModifierKeys)
@implementation NSEvent (NGSModifierKeys)
+ (BOOL) isControlKeyDown
+ (BOOL)isControlKeyDown
{
return (GetCurrentKeyModifiers() & controlKey) != 0;
}
+ (BOOL) isOptionKeyDown
+ (BOOL)isOptionKeyDown
{
return (GetCurrentKeyModifiers() & optionKey) != 0;
}
+ (BOOL) isCommandKeyDown
+ (BOOL)isCommandKeyDown
{
return (GetCurrentKeyModifiers() & cmdKey) != 0;
}
+ (BOOL) isShiftKeyDown
+ (BOOL)isShiftKeyDown
{
return (GetCurrentKeyModifiers() & shiftKey) != 0;
}

View File

@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
@interface NSNumber (ResKnifeRangeExtensions)
@interface NSNumber (NGSRange)
- (BOOL)isWithinRange:(NSRange)range; // location <= self <= location+length
- (BOOL)isExclusivelyWithinRange:(NSRange)range; // location < self < location+length

View File

@ -1,6 +1,6 @@
#import "NSNumber-Range.h"
@implementation NSNumber (ResKnifeRangeExtensions)
@implementation NSNumber (NGSRange)
- (BOOL)isWithinRange:(NSRange)range // location <= self <= location+length
{

View File

@ -1,6 +1,6 @@
#import <Cocoa/Cocoa.h>
@interface NSOutlineView (ResKnifeSelectedItemExtensions)
@interface NSOutlineView (NGSSelectedItems)
- (id)selectedItem;
- (NSArray *)selectedItems;

View File

@ -2,7 +2,7 @@
/* The methods in the following catagory were based upon those in OmniAppKit */
@implementation NSOutlineView (RKSelectedItemExtensions)
@implementation NSOutlineView (NGSSelectedItems)
- (id)selectedItem
{

View File

@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
@interface NSString (ResKnifeFSSpecExtensions)
@interface NSString (NGSFSSpec)
- (FSRef *)createFSRef;
- (FSSpec *)createFSSpec;
@ -8,7 +8,7 @@
@end
@interface NSString (ResKnifeBooleanExtensions)
@interface NSString (NGSBoolean)
- (BOOL)boolValue;
+ (NSString *)stringWithBool:(BOOL)boolean;

View File

@ -1,6 +1,6 @@
#import "NSString-FSSpec.h"
@implementation NSString (ResKnifeFSSpecExtensions)
@implementation NSString (NGSFSSpec)
- (FSRef *)createFSRef
{
@ -33,7 +33,7 @@
@end
@implementation NSString (ResKnifeBooleanExtensions)
@implementation NSString (NGSBoolean)
- (BOOL)boolValue
{

View File

@ -77,7 +77,7 @@
/*!
@method typePopupSelection:
@abstract Updates the edit text field when the type pop-up selection is changed.
@change 2003-08-01 UK: Commented, made it update state of "create" button.
@updated 2003-08-01 UK: Commented, made it update state of "create" button.
*/
- (IBAction)typePopupSelection:(id)sender

View File

@ -35,7 +35,7 @@
@protocol ResKnifeInformalPluginProtocol
@abstract Optional methods your plugin may implement to provide additional functionality.
@author Uli Kusterer
@change 2005-10-03 NGS: Added UTI, MIME Type and OSType methods, renamed extensionForFileExport: to filenameExtensionForFileExport:
@updated 2005-10-03 NGS: Added UTI, MIME Type and OSType methods, renamed extensionForFileExport: to filenameExtensionForFileExport:
*/
@interface ResKnifeInformalPluginProtocol

View File

@ -63,7 +63,7 @@ Please try to conform to the existing formatting rules followed, including place
Notes on commenting/documenting for the ResKnife project:
ResKnife methods, functions, headers, classes, ivars and practically anything else is commented using the format specified by HeaderDoc (a C-based equivalent to JavaDoc), although with ResKnife-specific modifications (NB: although I've yet to modify HeaderDoc to read these new parameters, they should still be used for the time being). The general format is to use the standard C block-commenting mechanism, with the addition of an exclamation mark immediatly after the open comment marker. Following this are one or more lines beginning with an at sign, a keyword, arguments if any, and finally a string value. For source code consistancy, I (Nicholas) am dictating the following rules which must be followed when documenting an object.
ResKnife methods, functions, headers, classes, ivars and practically anything else is commented using the format specified by HeaderDoc (a C-based equivalent to JavaDoc), although with ResKnife-specific modifications (NB: although I've yet to modify HeaderDoc to read these new parameters, they should still be used for the time being). The general format is to use the standard C block-commenting mechanism, with the addition of an exclamation mark immediatly after the open comment marker. Following this are one or more lines beginning with an at sign, a keyword, arguments if any, and finally a string value. For source code consistancy, I (Nicholas) am suggesting the following when documenting an object.
1) All HeaderDoc comments immediatly preceede the object to which they pertain.
2) HeaderDoc comments documenting a method or function must follow the following order (for consistancy & readability), where an ellipsis indicates the line above can be repeated multiple times:
@ -72,7 +72,7 @@ ResKnife methods, functions, headers, classes, ivars and practically anything el
@abstract
@author
@created
@updated [reverse chronological, i.e. most recent at the top]
@updated [significant changes that other developers should be aware of; ordered reverse chronological, i.e. most recent at the top]
...
@pending [higher priority TODO items should be above lower priority ones]
...
@ -83,5 +83,7 @@ ResKnife methods, functions, headers, classes, ivars and practically anything el
3) The pertinent keywords or their equivalents in the above item should retain the specified order wherever reasonably applicable (e.g. for @class and @protocol comments)
4) The value for the @created keyword should take the following form: YYYY-MM-DD
5) The value for the @updated keyword should take the following form: YYYY-MM-DD Author: Description
where Author is an identifier for the person who made the change, not necessarilly the value in @author. Convention is that it simply contains the initials of the person.
where Author is your initials or sourceforge user name.
Due to really poor maintance on my part, very few methods have @updated comments. Sorry :-(
*/

View File

@ -416,6 +416,8 @@
/* Begin PBXFileReference section */
0EBA8664122CF49800FEC1AC /* NGSCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NGSCategories.h; sourceTree = "<group>"; };
0EBA8665122CF49800FEC1AC /* NGSCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NGSCategories.m; sourceTree = "<group>"; };
0EBA866A122D0B4300FEC1AC /* NSEvent-ModifierKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSEvent-ModifierKeys.h"; sourceTree = "<group>"; };
0EBA866B122D0B4300FEC1AC /* NSEvent-ModifierKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSEvent-ModifierKeys.m"; sourceTree = "<group>"; };
3D0933A604DEFEE600DD74B1 /* Element.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = "<group>"; };
3D0933A704DEFEE600DD74B1 /* Element.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Element.m; sourceTree = "<group>"; };
3D0933BE04DF151C00DD74B1 /* TemplateStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateStream.h; sourceTree = "<group>"; };
@ -1009,12 +1011,14 @@
children = (
0EBA8664122CF49800FEC1AC /* NGSCategories.h */,
0EBA8665122CF49800FEC1AC /* NGSCategories.m */,
0EBA866A122D0B4300FEC1AC /* NSEvent-ModifierKeys.h */,
0EBA866B122D0B4300FEC1AC /* NSEvent-ModifierKeys.m */,
F59D5DE8032106D201A8010C /* NSNumber-Range.h */,
F59D5DE9032106D201A8010C /* NSNumber-Range.m */,
F5D0CBCF022744C701A80001 /* NSOutlineView-SelectedItems.h */,
F5D0CBD0022744C701A80001 /* NSOutlineView-SelectedItems.m */,
F59D5DE40320DFF601A8010C /* NSString-FSSpec.h */,
F59D5DE50320DFF601A8010C /* NSString-FSSpec.m */,
F59D5DE8032106D201A8010C /* NSNumber-Range.h */,
F59D5DE9032106D201A8010C /* NSNumber-Range.m */,
);
path = Categories;
sourceTree = "<group>";