List.h 3.5 KB

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