// // DSArrayCategories.h // Shared categories // // Created by David Sinclair on Fri May 30 2003. // Copyright (c) 2003 - 2007 Dejal Systems, LLC. All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // Redistributions of source code must retain this list of conditions and the following disclaimer. // // The name of Dejal Systems, LLC may not be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS 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 OF THIRD PARTY RIGHTS. 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 THIS SOFTWARE. // #import @interface NSArray (DSArrayCategories) - (BOOL)isValidIndex:(int)index; - (id)objectMatching:(id)match usingKey:(NSString *)key; - (unsigned)indexOfObjectMatching:(id)match usingKey:(NSString *)key; - (id)objectMatching:(id)match usingSelector:(SEL)selector; - (id)objectMatching:(id)match orDefault:(id)defaultMatch orFirst:(BOOL)firstIfNotFound usingSelector:(SEL)selector; - (NSArray *)arrayWithObjectsMatching:(id)match usingKey:(NSString *)key; - (NSArray *)arrayWithObjectsMatching:(id)match usingSelector:(SEL)selector; - (NSArray *)arrayUsingSelector:(SEL)selector; - (NSArray *)arrayByRemovingObjectsInArray:(NSArray *)otherArray; - (NSArray *)reverseArray; - (BOOL)containsObjectIdenticalTo:(id)obj; - (BOOL)containsObjectEquivalentTo:(id)obj; - (unsigned)indexOfObjectEquivalentTo:(id)obj; - (id)firstObject; - (id)penultimateObject; - (id)deepCopy; @end // ---------------------------------------------------------------------------------------- #pragma mark - // ---------------------------------------------------------------------------------------- @interface NSMutableArray (DSArrayCategories) - (int)insertObject:(id)object atIndex:(int)index orEnd:(BOOL)atEnd; - (void)insertObjectsFromArray:(NSArray *)array atIndex:(int)index; - (int)insertOrMoveObjectsFromArray:(NSArray *)array atIndex:(int)index; - (void)addOrMoveObjectsFromArray:(NSArray *)array; - (NSMutableArray *)arrayWithIndexEnumerator:(NSEnumerator *)enumerator; - (void)removeObjectsFromIndexEnumerator:(NSEnumerator *)enumerator; - (void)removeObjectsFromIndexSet:(NSIndexSet *)indexSet; - (void)removeObjectsMatching:(id)match usingKey:(NSString *)key; - (NSMutableArray *)reverseArray; @end // ---------------------------------------------------------------------------------------- #pragma mark - // ---------------------------------------------------------------------------------------- @interface NSMutableArray (DSToolbarCategories) - (NSToolbarItem *)toolbarItemForIdentifier:(NSString *)identifier; - (NSArray *)toolbarItemIdentifiersIncludingStandardItems:(BOOL)inclStd; - (void)addToolbarItem:(NSString *)identifier label:(NSString *)label paletteLabel:(NSString *)paletteLabel toolTip:(NSString *)toolTip view:(id)view minWidth:(float)minWidth maxWidth:(float)maxWidth minHeight:(float)minHeight maxHeight:(float)maxHeight menuRepresentation:(NSMenuItem *)menuItem submenu:(NSMenu *)submenu enabled:(BOOL)enable target:(id)target action:(SEL)action tag:(int)tag; - (void)addToolbarItem:(NSString *)identifier label:(NSString *)label paletteLabel:(NSString *)paletteLabel toolTip:(NSString *)toolTip imageNamed:(NSString *)imageName enabled:(BOOL)enable target:(id)target action:(SEL)action tag:(int)tag; - (void)addToolbarItem:(NSString *)identifier label:(NSString *)label paletteLabel:(NSString *)paletteLabel toolTip:(NSString *)toolTip imageNamed:(NSString *)imageName enabled:(BOOL)enable target:(id)target action:(SEL)action; @end