PageRenderTime 26ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/Foundation/objj.platform/CPKeyedUnarchiver.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 243 lines | 243 code | 0 blank | 0 comment | 0 complexity | 16f22dff9256927f4b4590afddbebd9e MD5 | raw file
  1i;8;CPNull.ji;9;CPCoder.jc;8106;
  2var _1=1,_2=1<<1,_3=1<<2,_4=1<<3,_5=1<<4;
  3var _6="$null";
  4_CPKeyedArchiverUIDKey="CP$UID",_CPKeyedArchiverTopKey="$top",_CPKeyedArchiverObjectsKey="$objects",_CPKeyedArchiverArchiverKey="$archiver",_CPKeyedArchiverVersionKey="$version",_CPKeyedArchiverClassNameKey="$classname",_CPKeyedArchiverClassesKey="$classes",_CPKeyedArchiverClassKey="$class";
  5var _7=Nil,_8=Nil,_9=Nil,_a=Nil,_b=Nil,_c=Nil;
  6var _d=objj_allocateClassPair(CPCoder,"CPKeyedUnarchiver"),_e=_d.isa;
  7class_addIvars(_d,[new objj_ivar("_delegate"),new objj_ivar("_delegateSelectors"),new objj_ivar("_data"),new objj_ivar("_replacementClasses"),new objj_ivar("_objects"),new objj_ivar("_archive"),new objj_ivar("_plistObject"),new objj_ivar("_plistObjects")]);
  8objj_registerClassPair(_d);
  9objj_addClassForBundle(_d,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 10class_addMethods(_d,[new objj_method(sel_getUid("initForReadingWithData:"),function(_f,_10,_11){
 11with(_f){
 12_f=objj_msgSendSuper({receiver:_f,super_class:objj_getClass("CPCoder")},"init");
 13if(_f){
 14_archive=objj_msgSend(_11,"plistObject");
 15_objects=objj_msgSend(CPArray,"arrayWithObject:",objj_msgSend(CPNull,"null"));
 16_plistObject=objj_msgSend(_archive,"objectForKey:",_CPKeyedArchiverTopKey);
 17_plistObjects=objj_msgSend(_archive,"objectForKey:",_CPKeyedArchiverObjectsKey);
 18_replacementClasses=objj_msgSend(CPDictionary,"dictionary");
 19}
 20return _f;
 21}
 22}),new objj_method(sel_getUid("containsValueForKey:"),function(_12,_13,_14){
 23with(_12){
 24return objj_msgSend(_plistObject,"objectForKey:",_14)!=nil;
 25}
 26}),new objj_method(sel_getUid("_decodeDictionaryOfObjectsForKey:"),function(_15,_16,_17){
 27with(_15){
 28var _18=objj_msgSend(_plistObject,"objectForKey:",_17);
 29if(objj_msgSend(_18,"isKindOfClass:",_9)){
 30var key,_1a=objj_msgSend(_18,"keyEnumerator"),_1b=objj_msgSend(CPDictionary,"dictionary");
 31while(key=objj_msgSend(_1a,"nextObject")){
 32objj_msgSend(_1b,"setObject:forKey:",_1c(_15,objj_msgSend(objj_msgSend(_18,"objectForKey:",key),"objectForKey:",_CPKeyedArchiverUIDKey)),key);
 33}
 34return _1b;
 35}
 36return nil;
 37}
 38}),new objj_method(sel_getUid("decodeBoolForKey:"),function(_1d,_1e,_1f){
 39with(_1d){
 40return objj_msgSend(_1d,"decodeObjectForKey:",_1f);
 41}
 42}),new objj_method(sel_getUid("decodeFloatForKey:"),function(_20,_21,_22){
 43with(_20){
 44return objj_msgSend(_20,"decodeObjectForKey:",_22);
 45}
 46}),new objj_method(sel_getUid("decodeDoubleForKey:"),function(_23,_24,_25){
 47with(_23){
 48return objj_msgSend(_23,"decodeObjectForKey:",_25);
 49}
 50}),new objj_method(sel_getUid("decodeIntForKey:"),function(_26,_27,_28){
 51with(_26){
 52return objj_msgSend(_26,"decodeObjectForKey:",_28);
 53}
 54}),new objj_method(sel_getUid("decodePointForKey:"),function(_29,_2a,_2b){
 55with(_29){
 56var _2c=objj_msgSend(_29,"decodeObjectForKey:",_2b);
 57if(_2c){
 58return CPPointFromString(_2c);
 59}else{
 60return CPPointMake(0,0);
 61}
 62}
 63}),new objj_method(sel_getUid("decodeRectForKey:"),function(_2d,_2e,_2f){
 64with(_2d){
 65var _30=objj_msgSend(_2d,"decodeObjectForKey:",_2f);
 66if(_30){
 67return CPRectFromString(_30);
 68}else{
 69return CPRectMakeZero();
 70}
 71}
 72}),new objj_method(sel_getUid("decodeSizeForKey:"),function(_31,_32,_33){
 73with(_31){
 74var _34=objj_msgSend(_31,"decodeObjectForKey:",_33);
 75if(_34){
 76return CPSizeFromString(_34);
 77}else{
 78return CPSizeMake(0,0);
 79}
 80}
 81}),new objj_method(sel_getUid("decodeObjectForKey:"),function(_35,_36,_37){
 82with(_35){
 83var _38=objj_msgSend(_plistObject,"objectForKey:",_37);
 84if(objj_msgSend(_38,"isKindOfClass:",_9)){
 85return _1c(_35,objj_msgSend(_38,"objectForKey:",_CPKeyedArchiverUIDKey));
 86}else{
 87if(objj_msgSend(_38,"isKindOfClass:",_a)||objj_msgSend(_38,"isKindOfClass:",_b)){
 88return _38;
 89}else{
 90if(objj_msgSend(_38,"isKindOfClass:",_7)){
 91var _39=0,_3a=_38.length,_3b=[];
 92for(;_39<_3a;++_39){
 93_3b[_39]=_1c(_35,objj_msgSend(_38[_39],"objectForKey:",_CPKeyedArchiverUIDKey));
 94}
 95return _3b;
 96}
 97}
 98}
 99return nil;
100}
101}),new objj_method(sel_getUid("decodeBytesForKey:"),function(_3c,_3d,_3e){
102with(_3c){
103var _3f=objj_msgSend(_3c,"decodeObjectForKey:",_3e);
104if(objj_msgSend(_3f,"isKindOfClass:",objj_msgSend(CPData,"class"))){
105return _3f.bytes;
106}
107return nil;
108}
109}),new objj_method(sel_getUid("finishDecoding"),function(_40,_41){
110with(_40){
111if(_delegateSelectors&_4){
112objj_msgSend(_delegate,"unarchiverWillFinish:",_40);
113}
114if(_delegateSelectors&_5){
115objj_msgSend(_delegate,"unarchiverDidFinish:",_40);
116}
117}
118}),new objj_method(sel_getUid("delegate"),function(_42,_43){
119with(_42){
120return _delegate;
121}
122}),new objj_method(sel_getUid("setDelegate:"),function(_44,_45,_46){
123with(_44){
124_delegate=_46;
125if(objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("unarchiver:cannotDecodeObjectOfClassName:originalClasses:"))){
126_delegateSelectors|=_1;
127}
128if(objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("unarchiver:didDecodeObject:"))){
129_delegateSelectors|=_2;
130}
131if(objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("unarchiver:willReplaceObject:withObject:"))){
132_delegateSelectors|=_3;
133}
134if(objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("unarchiverWillFinish:"))){
135_delegateSelectors|=_CPKeyedUnarchiverWilFinishSelector;
136}
137if(objj_msgSend(_delegate,"respondsToSelector:",sel_getUid("unarchiverDidFinish:"))){
138_delegateSelectors|=_5;
139}
140}
141}),new objj_method(sel_getUid("setClass:forClassName:"),function(_47,_48,_49,_4a){
142with(_47){
143objj_msgSend(_replacementClasses,"setObject:forKey:",_49,_4a);
144}
145}),new objj_method(sel_getUid("classForClassName:"),function(_4b,_4c,_4d){
146with(_4b){
147return objj_msgSend(_replacementClasses,"objectForKey:",_4d);
148}
149}),new objj_method(sel_getUid("allowsKeyedCoding"),function(_4e,_4f){
150with(_4e){
151return YES;
152}
153})]);
154class_addMethods(_e,[new objj_method(sel_getUid("initialize"),function(_50,_51){
155with(_50){
156if(_50!==objj_msgSend(CPKeyedUnarchiver,"class")){
157return;
158}
159_7=objj_msgSend(CPArray,"class");
160_8=objj_msgSend(CPString,"class");
161_9=objj_msgSend(CPDictionary,"class");
162_a=objj_msgSend(CPNumber,"class");
163_b=objj_msgSend(CPData,"class");
164_c=objj_msgSend(_CPKeyedArchiverValue,"class");
165}
166}),new objj_method(sel_getUid("unarchiveObjectWithData:"),function(_52,_53,_54){
167with(_52){
168var _55=objj_msgSend(objj_msgSend(_52,"alloc"),"initForReadingWithData:",_54),_56=objj_msgSend(_55,"decodeObjectForKey:","root");
169objj_msgSend(_55,"finishDecoding");
170return _56;
171}
172}),new objj_method(sel_getUid("unarchiveObjectWithFile:"),function(_57,_58,_59){
173with(_57){
174}
175}),new objj_method(sel_getUid("unarchiveObjectWithFile:asynchronously:"),function(_5a,_5b,_5c,_5d){
176with(_5a){
177}
178})]);
179var _1c=function(_5e,_5f){
180var _60=_5e._objects[_5f];
181if(_60){
182if(_60==_5e._objects[0]){
183return nil;
184}else{
185return _60;
186}
187}
188var _60,_61=_5e._plistObjects[_5f];
189if(objj_msgSend(_61,"isKindOfClass:",_9)){
190var _62=_5e._plistObjects[objj_msgSend(objj_msgSend(_61,"objectForKey:",_CPKeyedArchiverClassKey),"objectForKey:",_CPKeyedArchiverUIDKey)],_63=objj_msgSend(_62,"objectForKey:",_CPKeyedArchiverClassNameKey),_64=objj_msgSend(_62,"objectForKey:",_CPKeyedArchiverClassesKey),_65=objj_msgSend(_5e,"classForClassName:",_63);
191if(!_65){
192_65=CPClassFromString(_63);
193}
194_60=objj_msgSend(_65,"alloc");
195_5e._objects[_5f]=_60;
196var _66=_5e._plistObject;
197_5e._plistObject=_61;
198var _67=_63;
199var _68=objj_msgSend(_60,"initWithCoder:",_5e);
200_5e._plistObject=_66;
201if(_68!=_60){
202if(_5e._delegateSelectors&_3){
203objj_msgSend(_5e._delegate,"unarchiver:willReplaceObject:withObject:",_5e,_60,_68);
204}
205_60=_68;
206_5e._objects[_5f]=_68;
207}
208_68=objj_msgSend(_60,"awakeAfterUsingCoder:",_5e);
209if(_68!=_60){
210if(_5e._delegateSelectors&_3){
211objj_msgSend(_5e._delegate,"unarchiver:willReplaceObject:withObject:",_5e,_60,_68);
212}
213_60=_68;
214_5e._objects[_5f]=_68;
215}
216if(_5e._delegate){
217if(_5e._delegateSelectors&_2){
218_68=objj_msgSend(_5e._delegate,"unarchiver:didDecodeObject:",_5e,_60);
219}
220if(_68!=_60){
221if(_5e._delegateSelectors&_3){
222objj_msgSend(_5e._delegate,"unarchiver:willReplaceObject:withObject:",_5e,_60,_68);
223}
224_60=_68;
225_5e._objects[_5f]=_68;
226}
227}
228}else{
229_5e._objects[_5f]=_60=_61;
230if(objj_msgSend(_60,"class")==_8){
231if(_60==_6){
232_5e._objects[_5f]=_5e._objects[0];
233return nil;
234}else{
235_5e._objects[_5f]=_60=_61;
236}
237}
238}
239if(objj_msgSend(_60,"isMemberOfClass:",_c)){
240_60=objj_msgSend(_60,"JSObject");
241}
242return _60;
243};