/Frameworks/Debug/Foundation/objj.platform/CPData.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 82 lines · 81 code · 1 blank · 0 comment · 0 complexity · 6bdb5540ed3867bc1c9e812814fc4e12 MD5 · raw file

  1. i;10;CPObject.ji;10;CPString.jc;2933;
  2. {var the_class = objj_allocateClassPair(CPObject, "CPData"),
  3. meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_plistObject")]);
  4. objj_registerClassPair(the_class);
  5. objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(the_class, [new objj_method(sel_getUid("initWithString:"), function $CPData__initWithString_(self, _cmd, aString)
  7. { with(self)
  8. {
  9. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  10. if (self)
  11. string = aString;
  12. return self;
  13. }
  14. }), new objj_method(sel_getUid("initWithPlistObject:"), function $CPData__initWithPlistObject_(self, _cmd, aPlistObject)
  15. { with(self)
  16. {
  17. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  18. if (self)
  19. _plistObject = aPlistObject;
  20. return self;
  21. }
  22. }), new objj_method(sel_getUid("length"), function $CPData__length(self, _cmd)
  23. { with(self)
  24. {
  25. return objj_msgSend(objj_msgSend(self, "string"), "length");
  26. }
  27. }), new objj_method(sel_getUid("description"), function $CPData__description(self, _cmd)
  28. { with(self)
  29. {
  30. return string;
  31. }
  32. }), new objj_method(sel_getUid("string"), function $CPData__string(self, _cmd)
  33. { with(self)
  34. {
  35. if (!string && _plistObject)
  36. string = objj_msgSend(objj_msgSend(CPPropertyListSerialization, "dataFromPropertyList:format:errorDescription:", _plistObject, CPPropertyList280NorthFormat_v1_0, NULL), "string");
  37. return string;
  38. }
  39. }), new objj_method(sel_getUid("setString:"), function $CPData__setString_(self, _cmd, aString)
  40. { with(self)
  41. {
  42. string = aString;
  43. _plistObject = nil;
  44. }
  45. }), new objj_method(sel_getUid("plistObject"), function $CPData__plistObject(self, _cmd)
  46. { with(self)
  47. {
  48. if (string && !_plistObject)
  49. _plistObject = objj_msgSend(CPPropertyListSerialization, "propertyListFromData:format:errorDescription:", self, 0, NULL);
  50. return _plistObject;
  51. }
  52. }), new objj_method(sel_getUid("setPlistObject:"), function $CPData__setPlistObject_(self, _cmd, aPlistObject)
  53. { with(self)
  54. {
  55. string = nil;
  56. _plistObject = aPlistObject;
  57. }
  58. })]);
  59. class_addMethods(meta_class, [new objj_method(sel_getUid("alloc"), function $CPData__alloc(self, _cmd)
  60. { with(self)
  61. {
  62. return new objj_data();
  63. }
  64. }), new objj_method(sel_getUid("data"), function $CPData__data(self, _cmd)
  65. { with(self)
  66. {
  67. return objj_msgSend(objj_msgSend(self, "alloc"), "initWithPlistObject:", nil);
  68. }
  69. }), new objj_method(sel_getUid("dataWithString:"), function $CPData__dataWithString_(self, _cmd, aString)
  70. { with(self)
  71. {
  72. return objj_msgSend(objj_msgSend(self, "alloc"), "initWithString:", aString);
  73. }
  74. }), new objj_method(sel_getUid("dataWithPlistObject:"), function $CPData__dataWithPlistObject_(self, _cmd, aPlistObject)
  75. { with(self)
  76. {
  77. return objj_msgSend(objj_msgSend(self, "alloc"), "initWithPlistObject:", aPlistObject);
  78. }
  79. })]);
  80. }
  81. objj_data.prototype.isa = CPData;