/usr/include/GNUstep/Foundation/NSHashTable.h is in libgnustep-base-dev 1.24.0-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /* NSHashTable interface for GNUStep.
* Copyright (C) 1994, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
*
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
* Created: Mon Dec 12 23:56:03 EST 1994
* Updated: Thu Mar 21 15:13:46 EST 1996
* Serial: 96.03.21.06
* Modified by: Richard Frith-Macdonald <rfm@gnu.org>
*
* This file is part of the GNUstep Base Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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 Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, 02111 USA.
*/
#ifndef __NSHashTable_h_GNUSTEP_BASE_INCLUDE
#define __NSHashTable_h_GNUSTEP_BASE_INCLUDE 1
#import <GNUstepBase/GSVersionMacros.h>
/**** Included Headers *******************************************************/
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSPointerFunctions.h>
#import <Foundation/NSString.h>
#if defined(__cplusplus)
extern "C" {
#endif
@class NSArray, NSSet, NSHashTable;
/**** Type, Constant, and Macro Definitions **********************************/
enum {
NSHashTableStrongMemory
= NSPointerFunctionsStrongMemory,
NSHashTableZeroingWeakMemory
= NSPointerFunctionsZeroingWeakMemory,
NSHashTableCopyIn
= NSPointerFunctionsCopyIn,
NSHashTableObjectPointerPersonality
= NSPointerFunctionsObjectPointerPersonality,
};
typedef NSUInteger NSHashTableOptions;
@interface NSHashTable : NSObject <NSCopying, NSCoding, NSFastEnumeration>
+ (id) hashTableWithOptions: (NSPointerFunctionsOptions)options;
+ (id) hashTableWithWeakObjects;
- (id) initWithOptions: (NSPointerFunctionsOptions)options
capacity: (NSUInteger)initialCapacity;
- (id) initWithPointerFunctions: (NSPointerFunctions*)functions
capacity: (NSUInteger)initialCapacity;
/** Adds the object to the receiver.
*/
- (void) addObject: (id)object;
/** Returns an array containing all objects in the receiver.
*/
- (NSArray*) allObjects;
/** Returns any objct from the receiver, or nil if the receiver contains no
* objects.
*/
- (id) anyObject;
/** Returns YES if the receiver contains an item equal to anObject, or NO
* otherwise.
*/
- (BOOL) containsObject: (id)anObject;
/** Return the number of items atored in the receiver.
*/
- (NSUInteger) count;
/** Removes from the receiver any items which are not also present in 'other'.
*/
- (void) intersectHashTable: (NSHashTable*)other;
/** Returns YES if the receiver and 'other' contain any items in common.
*/
- (BOOL) intersectsHashTable: (NSHashTable*)other;
/** Returns YES if the receiver and 'other' contain equal sets of items.
*/
- (BOOL) isEqualToHashTable: (NSHashTable*)other;
/** Returns YES fi all the items in the receiver are also present in 'other'
*/
- (BOOL) isSubsetOfHashTable: (NSHashTable*)other;
/** Returns an item stored in the receiver which is equal to the supplied
* object argument, or nil if no matchi is found.
*/
- (id) member: (id)object;
/** Removes from the receivr all those items which are prsent in both
* the receiver and in 'other'.
*/
- (void) minusHashTable: (NSHashTable*)other;
/** Return an enumerator for the receiver.
*/
- (NSEnumerator*) objectEnumerator;
/** Return an NSPointerFunctions value describing the functions used by the
* receiver to handle its contents.
*/
- (NSPointerFunctions*) pointerFunctions;
/** Removes all objects.
*/
- (void) removeAllObjects;
/** Remove the object (or any equal object) from the receiver.
*/
- (void) removeObject: (id)object;
/** Returns a set containing all the objects in the receiver.
*/
- (NSSet*) setRepresentation;
/** Adds to the receiver thse items present in 'other' which were
* not present in the receiver.
*/
- (void) unionHashTable: (NSHashTable*)other;
@end
/**
* Type for enumerating.<br />
* NB. Implementation detail ... in GNUstep the layout <strong>must</strong>
* correspond to that used by the GSIMap macros.
*/
typedef struct { void *map; void *node; size_t bucket; } NSHashEnumerator;
/** Callback functions for an NSHashTable. See NSCreateHashTable() . <br />*/
typedef struct _NSHashTableCallBacks
{
/** <code>NSUInteger (*hash)(NSHashTable *, const void *)</code> ...
* Hashing function. NOTE: Elements with equal values must have equal hash
* function values. The default if NULL uses the pointer addresses
* directly. <br/>*/
NSUInteger (*hash)(NSHashTable *, const void *);
/** <code>BOOL (*isEqual)(NSHashTable *, const void *, const void *)</code>
* ... Comparison function. The default if NULL uses '<code>==</code>'.
* <br/>*/
BOOL (*isEqual)(NSHashTable *, const void *, const void *);
/** <code>void (*retain)(NSHashTable *, const void *)</code> ...
* Retaining function called when adding elements to the table.
* The default if NULL is a no-op (no reference counting). <br/> */
void (*retain)(NSHashTable *, const void *);
/** <code>void (*release)(NSHashTable *, void *)</code> ... Releasing
* function called when a data element is removed from the table.
* The default if NULL is a no-op (no reference counting).<br/>*/
void (*release)(NSHashTable *, void *);
/** <code>NSString *(*describe)(NSHashTable *, const void *)</code> ...
* Description function. The default if NULL prints boilerplate. <br /> */
NSString *(*describe)(NSHashTable *, const void *);
} NSHashTableCallBacks;
GS_EXPORT const NSHashTableCallBacks NSIntegerHashCallBacks;
GS_EXPORT const NSHashTableCallBacks NSIntHashCallBacks; /*DEPRECATED*/
GS_EXPORT const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks;
GS_EXPORT const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks;
GS_EXPORT const NSHashTableCallBacks NSObjectHashCallBacks;
GS_EXPORT const NSHashTableCallBacks NSOwnedPointerHashCallBacks;
GS_EXPORT const NSHashTableCallBacks NSPointerToStructHashCallBacks;
GS_EXPORT NSHashTable *
NSCreateHashTable(NSHashTableCallBacks callBacks,
NSUInteger capacity);
GS_EXPORT NSHashTable *
NSCreateHashTableWithZone(NSHashTableCallBacks callBacks,
NSUInteger capacity,
NSZone *zone);
GS_EXPORT NSHashTable *
NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone);
GS_EXPORT void
NSFreeHashTable(NSHashTable *table);
GS_EXPORT void
NSResetHashTable(NSHashTable *table);
GS_EXPORT BOOL
NSCompareHashTables(NSHashTable *table1, NSHashTable *table2);
GS_EXPORT NSUInteger
NSCountHashTable(NSHashTable *table);
GS_EXPORT void *
NSHashGet(NSHashTable *table, const void *element);
GS_EXPORT NSArray *
NSAllHashTableObjects(NSHashTable *table);
GS_EXPORT void
NSEndHashTableEnumeration(NSHashEnumerator *enumerator);
GS_EXPORT NSHashEnumerator
NSEnumerateHashTable(NSHashTable *table);
GS_EXPORT void *
NSNextHashEnumeratorItem(NSHashEnumerator *enumerator);
GS_EXPORT void
NSHashInsert(NSHashTable *table, const void *element);
GS_EXPORT void
NSHashInsertKnownAbsent(NSHashTable *table, const void *element);
GS_EXPORT void *
NSHashInsertIfAbsent(NSHashTable *table, const void *element);
GS_EXPORT void
NSHashRemove(NSHashTable *table, const void *element);
GS_EXPORT NSString *
NSStringFromHashTable(NSHashTable *table);
#if defined(__cplusplus)
}
#endif
#endif /* __NSHashTable_h_GNUSTEP_BASE_INCLUDE */
|