objcbase.pp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2009 by the Free Pascal development team
  4. This unit provides the definition of the NSObject root class
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit objcbase;
  12. {$ifdef FPC_HAS_FEATURE_OBJECTIVEC1}
  13. {$modeswitch objectivec1}
  14. interface
  15. uses
  16. ctypes;
  17. type
  18. {
  19. NSString = objcclass; external;
  20. NSZone = objcclass; external;
  21. NSInvocation = objcclass; external;
  22. NSMethodSignature = objcclass; external;
  23. NSCoder = objcclass; external;
  24. }
  25. Protocol = objcclass
  26. end; external;
  27. NSObjectProtocol = objcprotocol
  28. function isEqual_(obj: id): boolean; message 'isEqual:';
  29. function hash: cuint; message 'hash';
  30. function superclass: pobjc_class; message 'superclass';
  31. function _class: pobjc_class; message 'class';
  32. { "self" is both a hidden parameter to each method, and a method of
  33. NSObject and thereby of each subclass as well
  34. }
  35. function self: id; message 'self';
  36. function zone: id; message 'zone';{ NSZone }
  37. function performSelector_(aSelector: SEL): id; message 'performSelector:';
  38. function performSelector_withObject_(aSelector: SEL; obj: id): id; message 'performSelector:withObject:';
  39. function performSelector_withObject_withObject(aSelector: SEL; obj1, obj2: id): id; message 'performSelector:withObject:withObject:';
  40. function isProxy: boolean; message 'isProxy';
  41. function isKindOfClass_(aClass: pobjc_class): boolean; message 'isKindOfClass:';
  42. function isMemberOfClass_(aClass: pobjc_class): boolean; message 'isMemberOfClass:';
  43. function conformsToProtocol_(aProtocol: Protocol): boolean; message 'conformsToProtocol:';
  44. function respondsToSelector_(aSelector: SEL): boolean; message 'respondsToSelector:';
  45. function retain: id; message 'retain';
  46. procedure release; message 'release'; { oneway }
  47. function autorelease: id; message 'autorelease';
  48. function retainCount: cint; message 'retainCount';
  49. function description: {NSString} id; message 'description';
  50. end; external name 'NSObject';
  51. NSObject = objcclass(NSObjectProtocol)
  52. strict protected
  53. isa: pobjc_class;
  54. public
  55. { NSObjectProtocol -- the message names are copied from the protocol
  56. definition by the compiler, but you can still repeat them if you want }
  57. function isEqual_(obj: id): boolean;
  58. function hash: cuint;
  59. function superclass: pobjc_class;
  60. function _class: pobjc_class;
  61. { "self" is both a hidden parameter to each method, and a method of
  62. NSObject and thereby of each subclass as well
  63. }
  64. function self: id;
  65. function zone: id; { NSZone }
  66. function performSelector_(aSelector: SEL): id;
  67. function performSelector_withObject_(aSelector: SEL; obj: id): id;
  68. function performSelector_withObject_withObject(aSelector: SEL; obj1, obj2: id): id;
  69. function isProxy: boolean;
  70. function isKindOfClass_(aClass: pobjc_class): boolean;
  71. function isMemberOfClass_(aClass: pobjc_class): boolean;
  72. function conformsToProtocol_(aProtocol: Protocol): boolean;
  73. function respondsToSelector_(aSelector: SEL): boolean;
  74. function retain: id;
  75. procedure release; { oneway }
  76. function autorelease: id;
  77. function retainCount: cint;
  78. function description: {NSString} id;
  79. { NSObject class }
  80. { "class" prefix to method name to avoid name collision with NSObjectProtocol }
  81. class function classIsEqual_(obj: id): boolean; message 'isEqual:';
  82. { "class" prefix to method name to avoid name collision with NSObjectProtocol }
  83. class function classHash: cuint; message 'hash';
  84. { NSObject methods }
  85. class procedure load; message 'load';
  86. class procedure initialize; message 'initialize';
  87. function init: id; message 'init';
  88. class function new: id; message 'new';
  89. class function allocWithZone_(_zone: id {NSZone}): id; message 'allocWithZone:';
  90. class function alloc: id; message 'alloc';
  91. procedure dealloc; message 'dealloc';
  92. { if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
  93. procedure finalize; message 'finalize';
  94. { endif }
  95. function copy: id; message 'copy';
  96. function mutableCopy: id; message 'mutableCopy';
  97. class function copyWithZone_(_zone: id {NSZone}): id; message 'copyWithZone:';
  98. class function mutableCopyWithZone_(_zone: id {NSZone}): id; message 'mutableCopyWithZone:';
  99. { "class" prefix to method name to avoid name collision with NSObjectProtocol }
  100. class function classSuperclass: pobjc_class; message 'superclass';
  101. { "class" prefix to method name to avoid name collision with NSObjectProtocol }
  102. class function classClass: pobjc_class; message 'class';
  103. class procedure poseAsClass_(aClass: pobjc_class); message 'poseAsClass:';
  104. class function instancesRespondToSelector_(aSelector: SEL): boolean; message 'instancesRespondToSelector:';
  105. { "class" prefix to method name to avoid name collision with NSObjectProtocol }
  106. class function classConformsToProtocol_(aProtocol: Protocol): boolean; message 'conformsToProtocol:';
  107. function methodForSelector_(aSelector: SEL): IMP; message 'methodForSelector:';
  108. class function instanceMethodForSelector_(aSelector: SEL): IMP; message 'instanceMethodForSelector:';
  109. class function version: cint; message 'version';
  110. class procedure setVersion_(aVersion: cint); message 'setVersion:';
  111. procedure doesNotRecognizeSelector_(aSelector: SEL); message 'doesNotRecognizeSelector:';
  112. procedure forwardInvocation_(anInvocation: id {NSInvocation}); message 'forwardInvocation:';
  113. function methodSignatureForSelector_(aSelector: SEL): id {NSMethodSignature}; message 'methodSignatureForSelector:';
  114. class function classDescription: id {NSString}; message 'description';
  115. function classForCoder: pobjc_class; message 'classForCoder';
  116. function replacementObjectForCoder_(aCoder: id {NSCoder}): id; message 'replacementObjectForCoder:';
  117. function awakeAfterUsingCoder_(aDecoder: id {NSCoder}): id; message 'awakeAfterUsingCoder:';
  118. end; external;
  119. implementation
  120. {$else }
  121. interface
  122. implementation
  123. {$endif}
  124. end.