Skip to content

Commit

Permalink
smaller clean-ups, mostly relating to categories
Browse files Browse the repository at this point in the history
git-svn-id: https://resknife.svn.sourceforge.net/svnroot/resknife/trunk/ResKnife@137 25122d23-1bc7-42f3-9251-2040de679093
  • Loading branch information
nickshanks committed Aug 31, 2010
1 parent 8538a4f commit 13d961b
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 25 deletions.
9 changes: 9 additions & 0 deletions Cocoa/Categories/NGSCategories.h
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions Cocoa/Categories/NSEvent-ModifierKeys.h
@@ -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
10 changes: 5 additions & 5 deletions Cocoa/Categories/NSEvent-ModifierKeys.m
@@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Categories/NSNumber-Range.h
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Categories/NSNumber-Range.m
@@ -1,6 +1,6 @@
#import "NSNumber-Range.h"

@implementation NSNumber (ResKnifeRangeExtensions)
@implementation NSNumber (NGSRange)

- (BOOL)isWithinRange:(NSRange)range // location <= self <= location+length
{
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Categories/NSOutlineView-SelectedItems.h
@@ -1,6 +1,6 @@
#import <Cocoa/Cocoa.h>

@interface NSOutlineView (ResKnifeSelectedItemExtensions)
@interface NSOutlineView (NGSSelectedItems)

- (id)selectedItem;
- (NSArray *)selectedItems;
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Categories/NSOutlineView-SelectedItems.m
Expand Up @@ -2,7 +2,7 @@

/* The methods in the following catagory were based upon those in OmniAppKit */

@implementation NSOutlineView (RKSelectedItemExtensions)
@implementation NSOutlineView (NGSSelectedItems)

- (id)selectedItem
{
Expand Down
4 changes: 2 additions & 2 deletions Cocoa/Categories/NSString-FSSpec.h
@@ -1,14 +1,14 @@
#import <Foundation/Foundation.h>

@interface NSString (ResKnifeFSSpecExtensions)
@interface NSString (NGSFSSpec)

- (FSRef *)createFSRef;
- (FSSpec *)createFSSpec;

@end


@interface NSString (ResKnifeBooleanExtensions)
@interface NSString (NGSBoolean)

- (BOOL)boolValue;
+ (NSString *)stringWithBool:(BOOL)boolean;
Expand Down
4 changes: 2 additions & 2 deletions Cocoa/Categories/NSString-FSSpec.m
@@ -1,6 +1,6 @@
#import "NSString-FSSpec.h"

@implementation NSString (ResKnifeFSSpecExtensions)
@implementation NSString (NGSFSSpec)

- (FSRef *)createFSRef
{
Expand Down Expand Up @@ -33,7 +33,7 @@ - (FSSpec *)createFSSpec

@end

@implementation NSString (ResKnifeBooleanExtensions)
@implementation NSString (NGSBoolean)

- (BOOL)boolValue
{
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Classes/CreateResourceSheetController.m
Expand Up @@ -77,7 +77,7 @@ - (IBAction)hideCreateResourceSheet:(id)sender
/*!
@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
Expand Down
2 changes: 1 addition & 1 deletion Cocoa/Plug-Ins/ResKnifePluginProtocol.h
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions README.txt
Expand Up @@ -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:
Expand All @@ -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]
...
Expand All @@ -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 :-(
*/
8 changes: 6 additions & 2 deletions ResKnife.xcodeproj/project.pbxproj
Expand Up @@ -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>"; };
Expand Down Expand Up @@ -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>";
Expand Down

0 comments on commit 13d961b

Please sign in to comment.