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