|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.0 (the 'License'). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License." ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: /* ! 25: List.h ! 26: Copyright 1988, 1989 NeXT, Inc. ! 27: ! 28: DEFINED AS: A common class ! 29: HEADER FILES: objc/List.h ! 30: ! 31: */ ! 32: ! 33: #ifndef _OBJC_LIST_H_ ! 34: #define _OBJC_LIST_H_ ! 35: ! 36: #import "Object.h" ! 37: #import "typedstream.h" ! 38: ! 39: @interface List : Object ! 40: { ! 41: @public ! 42: id *dataPtr; /* data of the List object */ ! 43: unsigned numElements; /* Actual number of elements */ ! 44: unsigned maxElements; /* Total allocated elements */ ! 45: } ! 46: ! 47: /* Creating, freeing */ ! 48: ! 49: - free; ! 50: - freeObjects; ! 51: - copyFromZone:(NXZone *)zone; ! 52: ! 53: /* Initializing */ ! 54: ! 55: - init; ! 56: - initCount:(unsigned)numSlots; ! 57: ! 58: /* Comparing two lists */ ! 59: ! 60: - (BOOL)isEqual: anObject; ! 61: ! 62: /* Managing the storage capacity */ ! 63: ! 64: - (unsigned)capacity; ! 65: - setAvailableCapacity:(unsigned)numSlots; ! 66: ! 67: /* Manipulating objects by index */ ! 68: ! 69: - (unsigned)count; ! 70: - objectAt:(unsigned)index; ! 71: - lastObject; ! 72: - addObject:anObject; ! 73: - insertObject:anObject at:(unsigned)index; ! 74: - removeObjectAt:(unsigned)index; ! 75: - removeLastObject; ! 76: - replaceObjectAt:(unsigned)index with:newObject; ! 77: - appendList: (List *)otherList; ! 78: ! 79: /* Manipulating objects by id */ ! 80: ! 81: - (unsigned)indexOf:anObject; ! 82: - addObjectIfAbsent:anObject; ! 83: - removeObject:anObject; ! 84: - replaceObject:anObject with:newObject; ! 85: ! 86: /* Emptying the list */ ! 87: ! 88: - empty; ! 89: ! 90: /* Archiving */ ! 91: ! 92: - write:(NXTypedStream *)stream; ! 93: - read:(NXTypedStream *)stream; ! 94: ! 95: /* Sending messages to elements of the list */ ! 96: ! 97: - makeObjectsPerform:(SEL)aSelector; ! 98: - makeObjectsPerform:(SEL)aSelector with:anObject; ! 99: ! 100: /* ! 101: * The following new... methods are now obsolete. They remain in this ! 102: * interface file for backward compatibility only. Use Object's alloc method ! 103: * and the init... methods defined in this class instead. ! 104: */ ! 105: ! 106: + new; ! 107: + newCount:(unsigned)numSlots; ! 108: ! 109: @end ! 110: ! 111: typedef struct { ! 112: @defs(List) ! 113: } NXListId; ! 114: ! 115: #define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr) ! 116: ! 117: #define NX_NOT_IN_LIST 0xffffffff ! 118: ! 119: #endif /* _OBJC_LIST_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.