ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/libFoundation.0.7.tgz#/libFoundation-0.7/FoundationExtensions/extensions/NSSet.h

This is NSSet.h in view mode; [Download] [Up]

/* 
   Copyright (C) 1996 
	Ovidiu Predescu <ovidiu@bx.logicnet.ro>
	Mircea Oancea <mircea@jupiter.elcom.pub.ro>

   Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>

   This file is part of the FoundationExtensions library.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef __NSSet_h__
#define __NSSet_h__

#include <stdarg.h>
#include <Foundation/NSObject.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSHashTable.h>
#include <Foundation/NSUtilities.h>

@class NSString;
@class NSArray;
@class NSDictionary;
@class NSEnumerator;

/*
 * NSSet class
 */

@interface NSSet : NSObject <NSCoding, NSCopying, NSMutableCopying>

/* Allocating and Initializing a Set */

+ (id)allocWithZone:(NSZone*)zone;
+ (id)set;
+ (id)setWithArray:(NSArray*)array;
+ (id)setWithObject:(id)anObject;
+ (id)setWithObjects:(id)firstObj,...;
- (id)initWithArray:(NSArray*)array;
- (id)initWithObjects:(id)firstObj,...;
- (id)initWithObject:(id)firstObj arglist:(va_list)arglist;
- (id)initWithObjects:(id*)objects count:(unsigned int)count;
- (id)initWithSet:(NSSet*)anotherSet;
- (id)initWithSet:(NSSet*)set copyItems:(BOOL)flag;

/* Querying the Set */

- (NSArray*)allObjects;
- (id)anyObject;
- (BOOL)containsObject:(id)anObject;
- (unsigned int)count;
- (id)member:(id)anObject;
- (NSEnumerator*)objectEnumerator;

/* Sending Messages to Elements of the Set */

- (void)makeObjectsPerform:(SEL)aSelector;
- (void)makeObjectsPerform:(SEL)aSelector withObject:(id)anObject;

/* Comparing Sets */

- (BOOL)intersectsSet:(NSSet*)otherSet;
- (BOOL)isEqualToSet:(NSSet*)otherSet;
- (BOOL)isSubsetOfSet:(NSSet*)otherSet;

/* Creating a String Description of the Set */

- (NSString*)description;
- (NSString*)descriptionWithLocale:(NSDictionary*)localeDictionary;

@end

/*
 * NSMutableSet
 */

@interface NSMutableSet : NSSet

+ (id)allocWithZone:(NSZone*)zone;
+ (id)setWithCapacity:(unsigned)numItems;
- (id)initWithCapacity:(unsigned)numItems;

/* Adding Objects */

- (void)addObject:(id)object;
- (void)addObjectsFromArray:(NSArray*)array;
- (void)unionSet:(NSSet*)other;

/* Removing Objects */

- (void)intersectSet:(NSSet*)other;
- (void)minusSet:(NSSet*)other;
- (void)removeAllObjects;
- (void)removeObject:(id)object;

@end

/*
 * NSCountedSet Class
 */

@interface NSCountedSet : NSMutableSet
{
	NSMapTable*	table;
}

/* Allocating and Initializing */

- (id)init;
- (id)initWithObjects:(id*)objects count:(unsigned int)count;
- (id)initWithSet:(NSSet*)set copyItems:(BOOL)flag;

/* Accessing keys and values */

- (unsigned int)count;
- (id)member:(id)anObject;
- (NSEnumerator*)objectEnumerator;

/* Add and remove entries */

- (void)addObject:(id)object;
- (void)removeObject:(id)object;
- (void)removeAllObjects;

/* Querying the NSCountedSet */

- (unsigned int)countForObject:(id)anObject;

/* Private */

- (void)__setObjectEnumerator:(void*)en;

@end

#endif /* __NSSet_h__ */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.