Guest User

Untitled

a guest
Mar 1st, 2018
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. commit de7ef99e819e2f6091dee4ead0f400924e76ec08
  2. Author: Vladimir Pouzanov <farcaller@gmail.com>
  3. Date: Sun Feb 8 19:23:25 2009 +0200
  4.  
  5. Added more api docs to CPObject
  6.  
  7. diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j
  8. index a586e6a..b868521 100644
  9. --- a/Foundation/CPObject.j
  10. +++ b/Foundation/CPObject.j
  11. @@ -23,13 +23,48 @@
  12. /*!
  13. @class CPObject
  14.  
  15. - CPObject is the root class for most Cappuccino classes. Your custom classes
  16. - should almost always subclass CPObject or one of its children.
  17. + CPObject is the root class for most Cappuccino classes. Like in Objective-C,
  18. + you have to declare parent class explicitly in Objective-J, so your custom
  19. + classes should almost always subclass CPObject or one of its children.
  20. +
  21. + CPObject provides facilities for class allocation and initialization,
  22. + querying runtime about parent classes and available selectors, using KVC
  23. + (key-value coding).
  24. +
  25. + When you subclass CPObject, most of the time you override one selector - init.
  26. + It is called for default initialization of custom object. You must call
  27. + parent class init in your overriden code:
  28. + <pre>- (id)init
  29. +{
  30. + self = [super init];
  31. + if(self) {
  32. + ... provide default initialization code for your object ...
  33. + }
  34. + return self;
  35. +}</pre>
  36. +
  37. + One more useful thing to override is description(). This selector
  38. + is used to provide developer-readable information about object. description
  39. + selector is often used with CPLog debugging:
  40. + <pre>- (CPString)description
  41. +{
  42. + return [CPString stringWithFormat:@"<SomeClass %d>", someValue];
  43. +}</pre>
  44. + To get description value you can use %@ specifier everywhere where format
  45. + specifiers are allowed:
  46. + <pre>var inst = [[SomeClass alloc] initWithSomeValue:10];
  47. +CPLog(@"Got some class: %@", inst);</pre>
  48. + would output:
  49. + <pre>Got some class: <SomeClass 10></pre>
  50. +
  51. + @todo document KVC usage.
  52. */
  53. @implementation CPObject
  54. +/// @cond DOXYFIX
  55. {
  56. Class isa;
  57. }
  58. +/// @endcond
  59.  
  60. + (void)load
  61. {
Add Comment
Please, Sign In to add comment