Object.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Copyright (c) 1999-2003, 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. Object.h
  25. Copyright 1988-1996 NeXT Software, Inc.
  26. DEFINED AS: A common class
  27. HEADER FILES: <objc/Object.h>
  28. */
  29. #ifndef _OBJC_OBJECT_H_
  30. #define _OBJC_OBJECT_H_
  31. #include <stdarg.h>
  32. #include <objc/objc-runtime.h>
  33. #if __OBJC__ && !__OBJC2__
  34. __OSX_AVAILABLE(10.0)
  35. __IOS_UNAVAILABLE __TVOS_UNAVAILABLE
  36. __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE
  37. OBJC_ROOT_CLASS
  38. @interface Object
  39. {
  40. Class isa; /* A pointer to the instance's class structure */
  41. }
  42. /* Initializing classes and instances */
  43. + (id)initialize;
  44. - (id)init;
  45. /* Creating, copying, and freeing instances */
  46. + (id)new;
  47. + (id)free;
  48. - (id)free;
  49. + (id)alloc;
  50. - (id)copy;
  51. + (id)allocFromZone:(void *)zone;
  52. - (id)copyFromZone:(void *)zone;
  53. - (void *)zone;
  54. /* Identifying classes */
  55. + (id)class;
  56. + (id)superclass;
  57. + (const char *) name;
  58. - (id)class;
  59. - (id)superclass;
  60. - (const char *) name;
  61. /* Identifying and comparing instances */
  62. - (id)self;
  63. - (unsigned int) hash;
  64. - (BOOL) isEqual:anObject;
  65. /* Testing inheritance relationships */
  66. - (BOOL) isKindOf: aClassObject;
  67. - (BOOL) isMemberOf: aClassObject;
  68. - (BOOL) isKindOfClassNamed: (const char *)aClassName;
  69. - (BOOL) isMemberOfClassNamed: (const char *)aClassName;
  70. /* Testing class functionality */
  71. + (BOOL) instancesRespondTo:(SEL)aSelector;
  72. - (BOOL) respondsTo:(SEL)aSelector;
  73. /* Testing protocol conformance */
  74. - (BOOL) conformsTo: (Protocol *)aProtocolObject;
  75. + (BOOL) conformsTo: (Protocol *)aProtocolObject;
  76. /* Obtaining method descriptors from protocols */
  77. - (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
  78. + (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
  79. /* Obtaining method handles */
  80. - (IMP) methodFor:(SEL)aSelector;
  81. + (IMP) instanceMethodFor:(SEL)aSelector;
  82. /* Sending messages determined at run time */
  83. - (id)perform:(SEL)aSelector;
  84. - (id)perform:(SEL)aSelector with:anObject;
  85. - (id)perform:(SEL)aSelector with:object1 with:object2;
  86. /* Posing */
  87. + (id)poseAs: aClassObject;
  88. /* Enforcing intentions */
  89. - (id)subclassResponsibility:(SEL)aSelector;
  90. - (id)notImplemented:(SEL)aSelector;
  91. /* Error handling */
  92. - (id)doesNotRecognize:(SEL)aSelector;
  93. - (id)error:(const char *)aString, ...;
  94. /* Debugging */
  95. - (void) printForDebugger:(void *)stream;
  96. /* Archiving */
  97. - (id)awake;
  98. - (id)write:(void *)stream;
  99. - (id)read:(void *)stream;
  100. + (int) version;
  101. + (id)setVersion: (int) aVersion;
  102. /* Forwarding */
  103. - (id)forward: (SEL)sel : (marg_list)args;
  104. - (id)performv: (SEL)sel : (marg_list)args;
  105. @end
  106. /* Abstract Protocol for Archiving */
  107. @interface Object (Archiving)
  108. - (id)startArchiving: (void *)stream;
  109. - (id)finishUnarchiving;
  110. @end
  111. /* Abstract Protocol for Dynamic Loading */
  112. @interface Object (DynamicLoading)
  113. //+ finishLoading:(headerType *)header;
  114. struct mach_header;
  115. + (id)finishLoading:(struct mach_header *)header;
  116. + (id)startUnloading;
  117. @end
  118. #endif
  119. #endif /* _OBJC_OBJECT_H_ */