home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSSet.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.6 KB  |  111 lines

  1. /*    NSSet.h
  2.     Sets of objects
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSObject.h>
  7.  
  8. @class NSArray, NSDictionary, NSEnumerator, NSString;
  9.  
  10. /****************    Immutable Set    ****************/
  11.  
  12. @interface NSSet : NSObject <NSCopying, NSMutableCopying, NSCoding>
  13.  
  14. - (unsigned)count;
  15. - (id)member:(id)object;
  16. - (NSEnumerator *)objectEnumerator;
  17.  
  18. @end
  19.  
  20. @interface NSSet (NSExtendedSet)
  21.  
  22. - (NSArray *)allObjects;
  23. - (id)anyObject;
  24. - (BOOL)containsObject:(id)anObject;
  25. - (NSString *)description;
  26. - (NSString *)descriptionWithLocale:(NSDictionary *)locale;
  27. - (BOOL)intersectsSet:(NSSet *)otherSet;
  28. - (BOOL)isEqualToSet:(NSSet *)otherSet;
  29. - (BOOL)isSubsetOfSet:(NSSet *)otherSet;
  30.  
  31. - (void)makeObjectsPerform:(SEL)aSelector;                /* OBSOLETE */
  32. - (void)makeObjectsPerform:(SEL)aSelector withObject:(id)argument;    /* OBSOLETE */
  33.  
  34. #if !defined(STRICT_OPENSTEP)
  35. - (void)makeObjectsPerformSelector:(SEL)aSelector;
  36. - (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)argument;
  37. #endif /* !STRICT_OPENSTEP */
  38.  
  39. @end
  40.  
  41. @interface NSSet (NSSetCreation)
  42.  
  43. + (id)set;
  44. + (id)setWithArray:(NSArray *)array;
  45. + (id)setWithObject:(id)object;
  46. + (id)setWithObjects:(id)firstObj, ...;
  47. - (id)initWithArray:(NSArray *)array;
  48. - (id)initWithObjects:(id *)objects count:(unsigned)count;
  49. - (id)initWithObjects:(id)firstObj, ...;
  50. - (id)initWithSet:(NSSet *)set;
  51. - (id)initWithSet:(NSSet *)set copyItems:(BOOL)flag;
  52.  
  53. #if !defined(STRICT_OPENSTEP)
  54. + (id)setWithSet:(NSSet *)set;
  55. + (id)setWithObjects:(id *)objs count:(unsigned)cnt;
  56. #endif /* !STRICT_OPENSTEP */
  57.  
  58. @end
  59.  
  60. /****************    Mutable Set    ****************/
  61.  
  62. @interface NSMutableSet : NSSet
  63.  
  64. - (void)addObject:(id)object;
  65. - (void)removeObject:(id)object;
  66.  
  67. @end
  68.  
  69. @interface NSMutableSet (NSExtendedMutableSet)
  70.  
  71. - (void)addObjectsFromArray:(NSArray *)array;
  72. - (void)intersectSet:(NSSet *)otherSet;
  73. - (void)minusSet:(NSSet *)otherSet;
  74. - (void)removeAllObjects;
  75. - (void)unionSet:(NSSet *)otherSet;
  76.  
  77. #if !defined(STRICT_OPENSTEP)
  78. - (void)setSet:(NSSet *)otherSet;
  79. #endif /* !STRICT_OPENSTEP */
  80.  
  81. @end
  82.  
  83. @interface NSMutableSet (NSMutableSetCreation)
  84.  
  85. + (id)setWithCapacity:(unsigned)numItems;
  86. - (id)initWithCapacity:(unsigned)numItems;
  87.     
  88. @end
  89.  
  90. /****************    Counted Set    ****************/
  91.  
  92. @interface NSCountedSet : NSMutableSet {
  93.     @private
  94.     void *_table;
  95.     void *_reserved;
  96. }
  97.  
  98. - (id)initWithCapacity:(unsigned)numItems; // designated initializer
  99.  
  100. - (id)initWithArray:(NSArray *)array;
  101. - (id)initWithSet:(NSSet *)set;
  102.  
  103. - (unsigned)countForObject:(id)object;
  104.  
  105. - (NSEnumerator *)objectEnumerator;
  106. - (void)addObject:(id)object;
  107. - (void)removeObject:(id)object;
  108.  
  109. @end
  110.  
  111.