]> git.saurik.com Git - apple/objc4.git/blob - runtime/OldClasses.subproj/List.h
objc4-208.tar.gz
[apple/objc4.git] / runtime / OldClasses.subproj / List.h
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.1 (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-1996 NeXT Software, Inc.
27
28 DEFINED AS: A common class
29 HEADER FILES: objc/List.h
30
31 */
32
33 #warning the API in this header is obsolete
34
35 #ifndef _OBJC_LIST_H_
36 #define _OBJC_LIST_H_
37
38 #import <objc/Object.h>
39
40 @interface List : Object
41 {
42 @public
43 id *dataPtr; /* data of the List object */
44 unsigned numElements; /* Actual number of elements */
45 unsigned maxElements; /* Total allocated elements */
46 }
47
48 /* Creating, freeing */
49
50 - free;
51 - freeObjects;
52 - copyFromZone:(void *)z;
53
54 /* Initializing */
55
56 - init;
57 - initCount:(unsigned)numSlots;
58
59 /* Comparing two lists */
60
61 - (BOOL)isEqual: anObject;
62
63 /* Managing the storage capacity */
64
65 - (unsigned)capacity;
66 - setAvailableCapacity:(unsigned)numSlots;
67
68 /* Manipulating objects by index */
69
70 - (unsigned)count;
71 - objectAt:(unsigned)index;
72 - lastObject;
73 - addObject:anObject;
74 - insertObject:anObject at:(unsigned)index;
75 - removeObjectAt:(unsigned)index;
76 - removeLastObject;
77 - replaceObjectAt:(unsigned)index with:newObject;
78 - appendList: (List *)otherList;
79
80 /* Manipulating objects by id */
81
82 - (unsigned)indexOf:anObject;
83 - addObjectIfAbsent:anObject;
84 - removeObject:anObject;
85 - replaceObject:anObject with:newObject;
86
87 /* Emptying the list */
88
89 - empty;
90
91 /* Sending messages to elements of the list */
92
93 - makeObjectsPerform:(SEL)aSelector;
94 - makeObjectsPerform:(SEL)aSelector with:anObject;
95
96 /*
97 * The following new... methods are now obsolete. They remain in this
98 * interface file for backward compatibility only. Use Object's alloc method
99 * and the init... methods defined in this class instead.
100 */
101
102 + new;
103 + newCount:(unsigned)numSlots;
104
105 @end
106
107 typedef struct {
108 @defs(List)
109 } NXListId;
110
111 #define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr)
112
113 #define NX_NOT_IN_LIST 0xffffffff
114
115 #endif /* _OBJC_LIST_H_ */