This is KeyedCollecting.h in view mode; [Download] [Up]
/* Protocol for Objective-C objects holding (keyElement,contentElement) pairs.
Copyright (C) 1993 R. Andrew McCallum <mccallum@cs.rochester.edu>
Dept. of Computer Science, U. of Rochester, Rochester, NY 14627
This file is part of the GNU Objective-C Collection 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; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* The <KeyedCollecting> protocol inherits from the <Collecting> protocol.
The <KeyedCollecting> protocol defines the interface to a
collection of elements that are accessible by a key, where the key is
some unique element. Pairs of (key element, content element) may be
added, removed and replaced. The the key and content may be
tested, enumerated and copied.
*/
#ifndef __KeyedCollecting_h_GNU_INCLUDE
#define __KeyedCollecting_h_GNU_INCLUDE
#include <coll/Collecting.h>
#define COLL_NO_KEY COLL_NO_ELEMENT
@protocol KeyedCollecting <Collecting>
// ADDING OR REPLACING;
- insertObject: newContentObject atKey: (elt)aKey;
- replaceObjectAtKey: (elt)aKey with: newContentObject;
// REMOVING;
- removeObjectAtKey: (elt)aKey;
// GETTING ELEMENTS AND KEYS;
- objectAtKey: (elt)aKey;
- keyObjectOfObject: aContentObject; /* modeled on 'indexOfObject:', yucky? */
// TESTING;
- (BOOL) includesKey: (elt)aKey;
// GETTING COLLECTIONS OF KEYS OR CONTENTS SEPARATELY;
- shallowCopyKeysAs: aCollectionClass;
- shallowCopyContentsAs: aCollectionClass;
// ENUMERATIONS;
- makeKeysPerform: (SEL)aSel;
- makeKeysPerform: (SEL)aSel with: argObject;
- withKeysPerform: (SEL)aSel in: selObject;
- withKeysPerform: (SEL)aSel in: selObject with: argObject;
- withKeysAndContentsPerform: (SEL)aSel in: selObject;
- withContentsMakeKeysPerform: (SEL)aSel;
- withContentsMakeKeysPerform: (SEL)aSel with: argObject;
- withKeysMakeContentsPerform: (SEL)aSel;
- withKeysMakeContentsPerform: (SEL)aSel with: argObject;
// NON-OBJECT ELEMENT METHOD NAMES;
// INITIALIZING;
- initDescription: (const char *)contentType
keyDescription: (const char *)keyType;
- initKeyDescription: (const char *)keyType;
// ADDING OR REPLACING;
- insertElement: (elt)newContentElement atKey: (elt)aKey;
- (elt) replaceElementAtKey: (elt)aKey with: (elt)newContentElement;
// REMOVING;
- (elt) removeElementAtKey: (elt)aKey;
// GETTING ELEMENTS AND KEYS;
- (elt) elementAtKey: (elt)aKey;
- (elt) keyElementOfElement: (elt)aContentObject;
// TESTING;
- (const char *) keyDescription;
// ENUMERATING;
- (BOOL) getNextKey: (elt*)aKeyPtr content: (elt*)anElementPtr
withEnumState: (void**)enumState;
- withKeysCall: (void(*)(const elt))aFunc;
- withKeysAndContentsCall: (void(*)(const elt,elt))aFunc;
- withKeysAndContentsCall: (void(*)(const elt,elt))aFunc
whileTrue: (BOOL *)flag;
@end
#endif /* __KeyedCollecting_h_GNU_INCLUDE */
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.