mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 01:01:03 +00:00
Merge pull request #57 from triplef/nshashtable-generics
Added generics support to NSHashTable
This commit is contained in:
commit
dcfbe9e0f8
1 changed files with 18 additions and 16 deletions
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
/**** Included Headers *******************************************************/
|
/**** Included Headers *******************************************************/
|
||||||
|
|
||||||
|
#import <Foundation/NSObject.h>
|
||||||
#import <Foundation/NSEnumerator.h>
|
#import <Foundation/NSEnumerator.h>
|
||||||
#import <Foundation/NSPointerFunctions.h>
|
#import <Foundation/NSPointerFunctions.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
@ -40,7 +41,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@class NSArray, NSSet, NSHashTable;
|
@class GS_GENERIC_CLASS(NSArray, ElementT);
|
||||||
|
@class GS_GENERIC_CLASS(NSSet, ElementT);
|
||||||
|
|
||||||
/**** Type, Constant, and Macro Definitions **********************************/
|
/**** Type, Constant, and Macro Definitions **********************************/
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ enum {
|
||||||
|
|
||||||
typedef NSUInteger NSHashTableOptions;
|
typedef NSUInteger NSHashTableOptions;
|
||||||
|
|
||||||
@interface NSHashTable : NSObject <NSCopying, NSCoding, NSFastEnumeration>
|
@interface GS_GENERIC_CLASS(NSHashTable, ElementT) : NSObject <NSCopying, NSCoding, NSFastEnumeration>
|
||||||
|
|
||||||
+ (id) hashTableWithOptions: (NSPointerFunctionsOptions)options;
|
+ (id) hashTableWithOptions: (NSPointerFunctionsOptions)options;
|
||||||
|
|
||||||
|
@ -81,21 +83,21 @@ typedef NSUInteger NSHashTableOptions;
|
||||||
|
|
||||||
/** Adds the object to the receiver.
|
/** Adds the object to the receiver.
|
||||||
*/
|
*/
|
||||||
- (void) addObject: (id)object;
|
- (void) addObject: (GS_GENERIC_TYPE(ElementT))object;
|
||||||
|
|
||||||
/** Returns an array containing all objects in the receiver.
|
/** Returns an array containing all objects in the receiver.
|
||||||
*/
|
*/
|
||||||
- (NSArray*) allObjects;
|
- (GS_GENERIC_CLASS(NSArray, ElementT)*) allObjects;
|
||||||
|
|
||||||
/** Returns any objct from the receiver, or nil if the receiver contains no
|
/** Returns any objct from the receiver, or nil if the receiver contains no
|
||||||
* objects.
|
* objects.
|
||||||
*/
|
*/
|
||||||
- (id) anyObject;
|
- (GS_GENERIC_TYPE(ElementT)) anyObject;
|
||||||
|
|
||||||
/** Returns YES if the receiver contains an item equal to anObject, or NO
|
/** Returns YES if the receiver contains an item equal to anObject, or NO
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
- (BOOL) containsObject: (id)anObject;
|
- (BOOL) containsObject: (GS_GENERIC_TYPE(ElementT))anObject;
|
||||||
|
|
||||||
/** Return the number of items atored in the receiver.
|
/** Return the number of items atored in the receiver.
|
||||||
*/
|
*/
|
||||||
|
@ -103,33 +105,33 @@ typedef NSUInteger NSHashTableOptions;
|
||||||
|
|
||||||
/** Removes from the receiver any items which are not also present in 'other'.
|
/** Removes from the receiver any items which are not also present in 'other'.
|
||||||
*/
|
*/
|
||||||
- (void) intersectHashTable: (NSHashTable*)other;
|
- (void) intersectHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
/** Returns YES if the receiver and 'other' contain any items in common.
|
/** Returns YES if the receiver and 'other' contain any items in common.
|
||||||
*/
|
*/
|
||||||
- (BOOL) intersectsHashTable: (NSHashTable*)other;
|
- (BOOL) intersectsHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
/** Returns YES if the receiver and 'other' contain equal sets of items.
|
/** Returns YES if the receiver and 'other' contain equal sets of items.
|
||||||
*/
|
*/
|
||||||
- (BOOL) isEqualToHashTable: (NSHashTable*)other;
|
- (BOOL) isEqualToHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
/** Returns YES fi all the items in the receiver are also present in 'other'
|
/** Returns YES fi all the items in the receiver are also present in 'other'
|
||||||
*/
|
*/
|
||||||
- (BOOL) isSubsetOfHashTable: (NSHashTable*)other;
|
- (BOOL) isSubsetOfHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
/** Returns an item stored in the receiver which is equal to the supplied
|
/** Returns an item stored in the receiver which is equal to the supplied
|
||||||
* object argument, or nil if no matchi is found.
|
* object argument, or nil if no matchi is found.
|
||||||
*/
|
*/
|
||||||
- (id) member: (id)object;
|
- (GS_GENERIC_TYPE(ElementT)) member: (GS_GENERIC_TYPE(ElementT))object;
|
||||||
|
|
||||||
/** Removes from the receivr all those items which are prsent in both
|
/** Removes from the receivr all those items which are prsent in both
|
||||||
* the receiver and in 'other'.
|
* the receiver and in 'other'.
|
||||||
*/
|
*/
|
||||||
- (void) minusHashTable: (NSHashTable*)other;
|
- (void) minusHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
/** Return an enumerator for the receiver.
|
/** Return an enumerator for the receiver.
|
||||||
*/
|
*/
|
||||||
- (NSEnumerator*) objectEnumerator;
|
- (GS_GENERIC_CLASS(NSEnumerator, ElementT)*) objectEnumerator;
|
||||||
|
|
||||||
/** Return an NSPointerFunctions value describing the functions used by the
|
/** Return an NSPointerFunctions value describing the functions used by the
|
||||||
* receiver to handle its contents.
|
* receiver to handle its contents.
|
||||||
|
@ -142,16 +144,16 @@ typedef NSUInteger NSHashTableOptions;
|
||||||
|
|
||||||
/** Remove the object (or any equal object) from the receiver.
|
/** Remove the object (or any equal object) from the receiver.
|
||||||
*/
|
*/
|
||||||
- (void) removeObject: (id)object;
|
- (void) removeObject: (GS_GENERIC_TYPE(ElementT))object;
|
||||||
|
|
||||||
/** Returns a set containing all the objects in the receiver.
|
/** Returns a set containing all the objects in the receiver.
|
||||||
*/
|
*/
|
||||||
- (NSSet*) setRepresentation;
|
- (GS_GENERIC_CLASS(NSSet, ElementT)*) setRepresentation;
|
||||||
|
|
||||||
/** Adds to the receiver thse items present in 'other' which were
|
/** Adds to the receiver thse items present in 'other' which were
|
||||||
* not present in the receiver.
|
* not present in the receiver.
|
||||||
*/
|
*/
|
||||||
- (void) unionHashTable: (NSHashTable*)other;
|
- (void) unionHashTable: (GS_GENERIC_CLASS(NSHashTable, ElementT)*)other;
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue