NSObject.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* NSObject.h
  2. Copyright (c) 1994-2012, Apple Inc. All rights reserved.
  3. */
  4. #ifndef _OBJC_NSOBJECT_H_
  5. #define _OBJC_NSOBJECT_H_
  6. #if __OBJC__
  7. #include <objc/objc.h>
  8. #include <objc/NSObjCRuntime.h>
  9. @class NSString, NSMethodSignature, NSInvocation;
  10. @protocol NSObject
  11. - (BOOL)isEqual:(id)object;
  12. @property (readonly) NSUInteger hash;
  13. @property (readonly) Class superclass;
  14. - (Class)class OBJC_SWIFT_UNAVAILABLE("use 'type(of: anObject)' instead");
  15. - (instancetype)self;
  16. - (id)performSelector:(SEL)aSelector;
  17. - (id)performSelector:(SEL)aSelector withObject:(id)object;
  18. - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
  19. - (BOOL)isProxy;
  20. - (BOOL)isKindOfClass:(Class)aClass;
  21. - (BOOL)isMemberOfClass:(Class)aClass;
  22. - (BOOL)conformsToProtocol:(Protocol *)aProtocol;
  23. - (BOOL)respondsToSelector:(SEL)aSelector;
  24. - (instancetype)retain OBJC_ARC_UNAVAILABLE;
  25. - (oneway void)release OBJC_ARC_UNAVAILABLE;
  26. - (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
  27. - (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
  28. - (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
  29. @property (readonly, copy) NSString *description;
  30. @optional
  31. @property (readonly, copy) NSString *debugDescription;
  32. @end
  33. OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
  34. OBJC_ROOT_CLASS
  35. OBJC_EXPORT
  36. @interface NSObject <NSObject> {
  37. #pragma clang diagnostic push
  38. #pragma clang diagnostic ignored "-Wobjc-interface-ivars"
  39. Class isa OBJC_ISA_AVAILABILITY;
  40. #pragma clang diagnostic pop
  41. }
  42. + (void)load;
  43. + (void)initialize;
  44. - (instancetype)init
  45. #if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER
  46. NS_DESIGNATED_INITIALIZER
  47. #endif
  48. ;
  49. + (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
  50. + (instancetype)allocWithZone:(struct _NSZone *)zone OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
  51. + (instancetype)alloc OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
  52. - (void)dealloc OBJC_SWIFT_UNAVAILABLE("use 'deinit' to define a de-initializer");
  53. - (void)finalize OBJC_DEPRECATED("Objective-C garbage collection is no longer supported");
  54. - (id)copy;
  55. - (id)mutableCopy;
  56. + (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
  57. + (id)mutableCopyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
  58. + (BOOL)instancesRespondToSelector:(SEL)aSelector;
  59. + (BOOL)conformsToProtocol:(Protocol *)protocol;
  60. - (IMP)methodForSelector:(SEL)aSelector;
  61. + (IMP)instanceMethodForSelector:(SEL)aSelector;
  62. - (void)doesNotRecognizeSelector:(SEL)aSelector;
  63. - (id)forwardingTargetForSelector:(SEL)aSelector OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
  64. - (void)forwardInvocation:(NSInvocation *)anInvocation OBJC_SWIFT_UNAVAILABLE("");
  65. - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
  66. + (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
  67. - (BOOL)allowsWeakReference UNAVAILABLE_ATTRIBUTE;
  68. - (BOOL)retainWeakReference UNAVAILABLE_ATTRIBUTE;
  69. + (BOOL)isSubclassOfClass:(Class)aClass;
  70. + (BOOL)resolveClassMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
  71. + (BOOL)resolveInstanceMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
  72. + (NSUInteger)hash;
  73. + (Class)superclass;
  74. + (Class)class OBJC_SWIFT_UNAVAILABLE("use 'aClass.self' instead");
  75. + (NSString *)description;
  76. + (NSString *)debugDescription;
  77. @end
  78. #endif
  79. #endif