|
1 #include <qfile.h> |
|
2 #include <assert.h> |
|
3 |
|
4 #include "sortdict.h" |
|
5 #include "marshal.h" |
|
6 #include "entry.h" |
|
7 #include "section.h" |
|
8 #include "memberlist.h" |
|
9 #include "definition.h" |
|
10 #include "groupdef.h" |
|
11 #include "example.h" |
|
12 |
|
13 #define HEADER ('D'<<24)+('O'<<16)+('X'<<8)+'!' |
|
14 |
|
15 void marshalInt(StorageIntf *s,int v) |
|
16 { |
|
17 uchar b[4]; |
|
18 b[0]=((uint)v)>>24; |
|
19 b[1]=(((uint)v)>>16)&0xff; |
|
20 b[2]=(((uint)v)>>8)&0xff; |
|
21 b[3]=v&0xff; |
|
22 s->write((const char *)b,4); |
|
23 } |
|
24 |
|
25 void marshalUInt(StorageIntf *s,uint v) |
|
26 { |
|
27 uchar b[4]; |
|
28 b[0]=v>>24; |
|
29 b[1]=(v>>16)&0xff; |
|
30 b[2]=(v>>8)&0xff; |
|
31 b[3]=v&0xff; |
|
32 s->write((const char *)b,4); |
|
33 } |
|
34 |
|
35 void marshalBool(StorageIntf *s,bool b) |
|
36 { |
|
37 char c = b; |
|
38 s->write(&c,sizeof(char)); |
|
39 } |
|
40 |
|
41 void marshalQCString(StorageIntf *s,const QCString &str) |
|
42 { |
|
43 uint l=str.length(); |
|
44 marshalUInt(s,l); |
|
45 if (l>0) s->write(str.data(),l); |
|
46 } |
|
47 |
|
48 void marshalQGString(StorageIntf *s,const QGString &str) |
|
49 { |
|
50 uint l=str.length(); |
|
51 marshalUInt(s,l); |
|
52 if (l>0) s->write(str.data(),l); |
|
53 } |
|
54 |
|
55 void marshalArgumentList(StorageIntf *s,ArgumentList *argList) |
|
56 { |
|
57 if (argList==0) |
|
58 { |
|
59 marshalUInt(s,NULL_LIST); // null pointer representation |
|
60 } |
|
61 else |
|
62 { |
|
63 marshalUInt(s,argList->count()); |
|
64 if (argList->count()>0) |
|
65 { |
|
66 ArgumentListIterator ali(*argList); |
|
67 Argument *a; |
|
68 for (ali.toFirst();(a=ali.current());++ali) |
|
69 { |
|
70 marshalQCString(s,a->attrib); |
|
71 marshalQCString(s,a->type); |
|
72 marshalQCString(s,a->canType); |
|
73 marshalQCString(s,a->name); |
|
74 marshalQCString(s,a->array); |
|
75 marshalQCString(s,a->defval); |
|
76 marshalQCString(s,a->docs); |
|
77 } |
|
78 } |
|
79 marshalBool(s,argList->constSpecifier); |
|
80 marshalBool(s,argList->volatileSpecifier); |
|
81 marshalBool(s,argList->pureSpecifier); |
|
82 } |
|
83 } |
|
84 |
|
85 void marshalArgumentLists(StorageIntf *s,QList<ArgumentList> *argLists) |
|
86 { |
|
87 if (argLists==0) |
|
88 { |
|
89 marshalUInt(s,NULL_LIST); // null pointer representation |
|
90 } |
|
91 else |
|
92 { |
|
93 marshalUInt(s,argLists->count()); |
|
94 QListIterator<ArgumentList> ali(*argLists); |
|
95 ArgumentList *al; |
|
96 for (ali.toFirst();(al=ali.current());++ali) |
|
97 { |
|
98 marshalArgumentList(s,al); |
|
99 } |
|
100 } |
|
101 } |
|
102 |
|
103 void marshalBaseInfoList(StorageIntf *s, QList<BaseInfo> *baseList) |
|
104 { |
|
105 if (baseList==0) |
|
106 { |
|
107 marshalUInt(s,NULL_LIST); // null pointer representation |
|
108 } |
|
109 else |
|
110 { |
|
111 marshalUInt(s,baseList->count()); |
|
112 QListIterator<BaseInfo> bli(*baseList); |
|
113 BaseInfo *bi; |
|
114 for (bli.toFirst();(bi=bli.current());++bli) |
|
115 { |
|
116 marshalQCString(s,bi->name); |
|
117 marshalInt(s,(int)bi->prot); |
|
118 marshalInt(s,(int)bi->virt); |
|
119 } |
|
120 } |
|
121 } |
|
122 |
|
123 void marshalGroupingList(StorageIntf *s, QList<Grouping> *groups) |
|
124 { |
|
125 if (groups==0) |
|
126 { |
|
127 marshalUInt(s,NULL_LIST); // null pointer representation |
|
128 } |
|
129 else |
|
130 { |
|
131 marshalUInt(s,groups->count()); |
|
132 QListIterator<Grouping> gli(*groups); |
|
133 Grouping *g; |
|
134 for (gli.toFirst();(g=gli.current());++gli) |
|
135 { |
|
136 marshalQCString(s,g->groupname); |
|
137 marshalInt(s,(int)g->pri); |
|
138 } |
|
139 } |
|
140 } |
|
141 |
|
142 void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors) |
|
143 { |
|
144 if (anchors==0) |
|
145 { |
|
146 marshalUInt(s,NULL_LIST); // null pointer representation |
|
147 } |
|
148 else |
|
149 { |
|
150 marshalUInt(s,anchors->count()); |
|
151 QListIterator<SectionInfo> sli(*anchors); |
|
152 SectionInfo *si; |
|
153 for (sli.toFirst();(si=sli.current());++sli) |
|
154 { |
|
155 marshalQCString(s,si->label); |
|
156 marshalQCString(s,si->title); |
|
157 marshalQCString(s,si->ref); |
|
158 marshalInt(s,(int)si->type); |
|
159 marshalQCString(s,si->fileName); |
|
160 } |
|
161 } |
|
162 } |
|
163 |
|
164 void marshalItemInfoList(StorageIntf *s, QList<ListItemInfo> *sli) |
|
165 { |
|
166 if (sli==0) |
|
167 { |
|
168 marshalUInt(s,NULL_LIST); // null pointer representation |
|
169 } |
|
170 else |
|
171 { |
|
172 marshalUInt(s,sli->count()); |
|
173 QListIterator<ListItemInfo> liii(*sli); |
|
174 ListItemInfo *lii; |
|
175 for (liii.toFirst();(lii=liii.current());++liii) |
|
176 { |
|
177 marshalQCString(s,lii->type); |
|
178 marshalInt(s,lii->itemId); |
|
179 } |
|
180 } |
|
181 } |
|
182 |
|
183 void marshalObjPointer(StorageIntf *s,void *obj) |
|
184 { |
|
185 char *b = (char *)&obj; |
|
186 s->write(b,sizeof(void *)); |
|
187 } |
|
188 |
|
189 void marshalSectionDict(StorageIntf *s,SectionDict *sections) |
|
190 { |
|
191 if (sections==0) |
|
192 { |
|
193 marshalUInt(s,NULL_LIST); // null pointer representation |
|
194 } |
|
195 else |
|
196 { |
|
197 marshalUInt(s,sections->count()); |
|
198 QDictIterator<SectionInfo> sli(*sections); |
|
199 SectionInfo *si; |
|
200 for (sli.toFirst();(si=sli.current());++sli) |
|
201 { |
|
202 marshalQCString(s,sli.currentKey()); |
|
203 marshalObjPointer(s,si); |
|
204 } |
|
205 } |
|
206 } |
|
207 |
|
208 void marshalMemberSDict(StorageIntf *s,MemberSDict *memberSDict) |
|
209 { |
|
210 if (memberSDict==0) |
|
211 { |
|
212 marshalUInt(s,NULL_LIST); // null pointer representation |
|
213 } |
|
214 else |
|
215 { |
|
216 marshalUInt(s,memberSDict->count()); |
|
217 //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); |
|
218 SDict<MemberDef>::IteratorDict mdi(*memberSDict); |
|
219 MemberDef *md; |
|
220 int count=0; |
|
221 for (mdi.toFirst();(md=mdi.current());++mdi) |
|
222 { |
|
223 //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); |
|
224 marshalQCString(s,mdi.currentKey()); |
|
225 marshalObjPointer(s,md); |
|
226 count++; |
|
227 } |
|
228 assert(count==memberSDict->count()); |
|
229 } |
|
230 } |
|
231 |
|
232 void marshalDocInfo(StorageIntf *s,DocInfo *docInfo) |
|
233 { |
|
234 if (docInfo==0) |
|
235 { |
|
236 marshalUInt(s,NULL_LIST); // null pointer representation |
|
237 } |
|
238 else |
|
239 { |
|
240 marshalUInt(s,1); |
|
241 marshalQCString(s,docInfo->doc); |
|
242 marshalInt(s,docInfo->line); |
|
243 marshalQCString(s,docInfo->file); |
|
244 } |
|
245 } |
|
246 |
|
247 void marshalBriefInfo(StorageIntf *s,BriefInfo *briefInfo) |
|
248 { |
|
249 if (briefInfo==0) |
|
250 { |
|
251 marshalUInt(s,NULL_LIST); // null pointer representation |
|
252 } |
|
253 else |
|
254 { |
|
255 marshalUInt(s,1); |
|
256 marshalQCString(s,briefInfo->doc); |
|
257 marshalQCString(s,briefInfo->tooltip); |
|
258 marshalInt(s,briefInfo->line); |
|
259 marshalQCString(s,briefInfo->file); |
|
260 } |
|
261 } |
|
262 |
|
263 void marshalBodyInfo(StorageIntf *s,BodyInfo *bodyInfo) |
|
264 { |
|
265 if (bodyInfo==0) |
|
266 { |
|
267 marshalUInt(s,NULL_LIST); // null pointer representation |
|
268 } |
|
269 else |
|
270 { |
|
271 marshalUInt(s,1); |
|
272 marshalInt(s,bodyInfo->startLine); |
|
273 marshalInt(s,bodyInfo->endLine); |
|
274 marshalObjPointer(s,bodyInfo->fileDef); |
|
275 } |
|
276 } |
|
277 |
|
278 void marshalGroupList(StorageIntf *s,GroupList *groupList) |
|
279 { |
|
280 if (groupList==0) |
|
281 { |
|
282 marshalUInt(s,NULL_LIST); // null pointer representation |
|
283 } |
|
284 else |
|
285 { |
|
286 marshalUInt(s,groupList->count()); |
|
287 QListIterator<GroupDef> gli(*groupList); |
|
288 GroupDef *gd=0; |
|
289 for (gli.toFirst();(gd=gli.current());++gli) |
|
290 { |
|
291 marshalObjPointer(s,gd); |
|
292 } |
|
293 } |
|
294 } |
|
295 |
|
296 void marshalMemberList(StorageIntf *s,MemberList *ml) |
|
297 { |
|
298 if (ml==0) |
|
299 { |
|
300 marshalUInt(s,NULL_LIST); // null pointer representation |
|
301 } |
|
302 else |
|
303 { |
|
304 marshalUInt(s,ml->count()); |
|
305 MemberListIterator mli(*ml); |
|
306 MemberDef *md; |
|
307 uint count=0; |
|
308 for (mli.toFirst();(md=mli.current());++mli) |
|
309 { |
|
310 marshalObjPointer(s,md); |
|
311 count++; |
|
312 } |
|
313 assert(count==ml->count()); |
|
314 |
|
315 ml->marshal(s); |
|
316 } |
|
317 } |
|
318 |
|
319 void marshalExampleSDict(StorageIntf *s,ExampleSDict *ed) |
|
320 { |
|
321 if (ed==0) |
|
322 { |
|
323 marshalUInt(s,NULL_LIST); // null pointer representation |
|
324 } |
|
325 else |
|
326 { |
|
327 marshalUInt(s,ed->count()); |
|
328 //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); |
|
329 SDict<Example>::IteratorDict edi(*ed); |
|
330 Example *e; |
|
331 for (edi.toFirst();(e=edi.current());++edi) |
|
332 { |
|
333 //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); |
|
334 marshalQCString(s,edi.currentKey()); |
|
335 marshalQCString(s,e->anchor); |
|
336 marshalQCString(s,e->name); |
|
337 marshalQCString(s,e->file); |
|
338 } |
|
339 } |
|
340 } |
|
341 |
|
342 void marshalMemberLists(StorageIntf *s,SDict<MemberList> *mls) |
|
343 { |
|
344 if (mls==0) |
|
345 { |
|
346 marshalUInt(s,NULL_LIST); // null pointer representation |
|
347 } |
|
348 else |
|
349 { |
|
350 marshalUInt(s,mls->count()); |
|
351 //printf(" marshalMemberSDict: items=%d\n",memberSDict->count()); |
|
352 SDict<MemberList>::IteratorDict mli(*mls); |
|
353 MemberList *ml; |
|
354 for (mli.toFirst();(ml=mli.current());++mli) |
|
355 { |
|
356 //printf(" marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md); |
|
357 marshalQCString(s,mli.currentKey()); |
|
358 marshalObjPointer(s,ml); // assume we are not owner of the list |
|
359 } |
|
360 } |
|
361 } |
|
362 |
|
363 void marshalEntry(StorageIntf *s,Entry *e) |
|
364 { |
|
365 marshalUInt(s,HEADER); |
|
366 marshalQCString(s,e->name); |
|
367 marshalQCString(s,e->type); |
|
368 marshalInt(s,e->section); |
|
369 marshalInt(s,(int)e->protection); |
|
370 marshalInt(s,(int)e->mtype); |
|
371 marshalInt(s,e->spec); |
|
372 marshalInt(s,e->initLines); |
|
373 marshalBool(s,e->stat); |
|
374 marshalBool(s,e->explicitExternal); |
|
375 marshalBool(s,e->proto); |
|
376 marshalBool(s,e->subGrouping); |
|
377 marshalBool(s,e->callGraph); |
|
378 marshalBool(s,e->callerGraph); |
|
379 marshalInt(s,(int)e->virt); |
|
380 marshalQCString(s,e->args); |
|
381 marshalQCString(s,e->bitfields); |
|
382 marshalArgumentList(s,e->argList); |
|
383 marshalArgumentLists(s,e->tArgLists); |
|
384 marshalQGString(s,e->program); |
|
385 marshalQGString(s,e->initializer); |
|
386 marshalQCString(s,e->includeFile); |
|
387 marshalQCString(s,e->includeName); |
|
388 marshalQCString(s,e->doc); |
|
389 marshalInt(s,e->docLine); |
|
390 marshalQCString(s,e->docFile); |
|
391 marshalQCString(s,e->brief); |
|
392 marshalInt(s,e->briefLine); |
|
393 marshalQCString(s,e->briefFile); |
|
394 marshalQCString(s,e->inbodyDocs); |
|
395 marshalInt(s,e->inbodyLine); |
|
396 marshalQCString(s,e->inbodyFile); |
|
397 marshalQCString(s,e->relates); |
|
398 marshalInt(s,e->relatesType); |
|
399 marshalQCString(s,e->read); |
|
400 marshalQCString(s,e->write); |
|
401 marshalQCString(s,e->inside); |
|
402 marshalQCString(s,e->exception); |
|
403 marshalArgumentList(s,e->typeConstr); |
|
404 marshalInt(s,e->bodyLine); |
|
405 marshalInt(s,e->endBodyLine); |
|
406 marshalInt(s,e->mGrpId); |
|
407 marshalBaseInfoList(s,e->extends); |
|
408 marshalGroupingList(s,e->groups); |
|
409 marshalSectionInfoList(s,e->anchors); |
|
410 marshalQCString(s,e->fileName); |
|
411 marshalInt(s,e->startLine); |
|
412 marshalItemInfoList(s,e->sli); |
|
413 marshalBool(s,e->objc); |
|
414 marshalBool(s,e->hidden); |
|
415 marshalBool(s,e->artificial); |
|
416 marshalInt(s,(int)e->groupDocType); |
|
417 } |
|
418 |
|
419 void marshalEntryTree(StorageIntf *s,Entry *e) |
|
420 { |
|
421 marshalEntry(s,e); |
|
422 marshalUInt(s,e->children()->count()); |
|
423 QListIterator<Entry> eli(*e->children()); |
|
424 Entry *child; |
|
425 for (eli.toFirst();(child=eli.current());++eli) |
|
426 { |
|
427 marshalEntryTree(s,child); |
|
428 } |
|
429 } |
|
430 |
|
431 //------------------------------------------------------------------ |
|
432 |
|
433 int unmarshalInt(StorageIntf *s) |
|
434 { |
|
435 uchar b[4]; |
|
436 s->read((char *)b,4); |
|
437 int result=(int)((((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]); |
|
438 //printf("unmarshalInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); |
|
439 return result; |
|
440 } |
|
441 |
|
442 uint unmarshalUInt(StorageIntf *s) |
|
443 { |
|
444 uchar b[4]; |
|
445 s->read((char *)b,4); |
|
446 uint result=(((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]; |
|
447 //printf("unmarshalUInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos()); |
|
448 return result; |
|
449 } |
|
450 |
|
451 bool unmarshalBool(StorageIntf *s) |
|
452 { |
|
453 char result; |
|
454 s->read(&result,sizeof(result)); |
|
455 //printf("unmarshalBool: %x offset=%llx\n",result,f.pos()); |
|
456 return result; |
|
457 } |
|
458 |
|
459 QCString unmarshalQCString(StorageIntf *s) |
|
460 { |
|
461 uint len = unmarshalUInt(s); |
|
462 //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos()); |
|
463 QCString result(len+1); |
|
464 result.at(len)='\0'; |
|
465 if (len>0) |
|
466 { |
|
467 s->read(result.data(),len); |
|
468 } |
|
469 //printf("unmarshalQCString: result=%s\n",result.data()); |
|
470 return result; |
|
471 } |
|
472 |
|
473 QGString unmarshalQGString(StorageIntf *s) |
|
474 { |
|
475 uint len = unmarshalUInt(s); |
|
476 //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos()); |
|
477 QGString result(len+1); |
|
478 result.at(len)='\0'; |
|
479 if (len>0) |
|
480 { |
|
481 s->read(result.data(),len); |
|
482 } |
|
483 //printf("unmarshalQCString: result=%s\n",result.data()); |
|
484 return result; |
|
485 } |
|
486 |
|
487 ArgumentList *unmarshalArgumentList(StorageIntf *s) |
|
488 { |
|
489 uint i; |
|
490 uint count = unmarshalUInt(s); |
|
491 if (count==NULL_LIST) return 0; // null list |
|
492 ArgumentList *result = new ArgumentList; |
|
493 assert(count<1000000); |
|
494 //printf("unmarshalArgumentList: %d\n",count); |
|
495 for (i=0;i<count;i++) |
|
496 { |
|
497 Argument *a = new Argument; |
|
498 a->attrib = unmarshalQCString(s); |
|
499 a->type = unmarshalQCString(s); |
|
500 a->canType = unmarshalQCString(s); |
|
501 a->name = unmarshalQCString(s); |
|
502 a->array = unmarshalQCString(s); |
|
503 a->defval = unmarshalQCString(s); |
|
504 a->docs = unmarshalQCString(s); |
|
505 result->append(a); |
|
506 } |
|
507 result->constSpecifier = unmarshalBool(s); |
|
508 result->volatileSpecifier = unmarshalBool(s); |
|
509 result->pureSpecifier = unmarshalBool(s); |
|
510 return result; |
|
511 } |
|
512 |
|
513 QList<ArgumentList> *unmarshalArgumentLists(StorageIntf *s) |
|
514 { |
|
515 uint i; |
|
516 uint count = unmarshalUInt(s); |
|
517 if (count==NULL_LIST) return 0; // null list |
|
518 QList<ArgumentList> *result = new QList<ArgumentList>; |
|
519 result->setAutoDelete(TRUE); |
|
520 assert(count<1000000); |
|
521 //printf("unmarshalArgumentLists: %d\n",count); |
|
522 for (i=0;i<count;i++) |
|
523 { |
|
524 result->append(unmarshalArgumentList(s)); |
|
525 } |
|
526 return result; |
|
527 } |
|
528 |
|
529 QList<BaseInfo> *unmarshalBaseInfoList(StorageIntf *s) |
|
530 { |
|
531 uint i; |
|
532 uint count = unmarshalUInt(s); |
|
533 if (count==NULL_LIST) return 0; // null list |
|
534 QList<BaseInfo> *result = new QList<BaseInfo>; |
|
535 result->setAutoDelete(TRUE); |
|
536 assert(count<1000000); |
|
537 for (i=0;i<count;i++) |
|
538 { |
|
539 QCString name = unmarshalQCString(s); |
|
540 Protection prot = (Protection)unmarshalInt(s); |
|
541 Specifier virt = (Specifier)unmarshalInt(s); |
|
542 result->append(new BaseInfo(name,prot,virt)); |
|
543 } |
|
544 return result; |
|
545 } |
|
546 |
|
547 QList<Grouping> *unmarshalGroupingList(StorageIntf *s) |
|
548 { |
|
549 uint i; |
|
550 uint count = unmarshalUInt(s); |
|
551 if (count==NULL_LIST) return 0; // null list |
|
552 QList<Grouping> *result = new QList<Grouping>; |
|
553 result->setAutoDelete(TRUE); |
|
554 assert(count<1000000); |
|
555 for (i=0;i<count;i++) |
|
556 { |
|
557 QCString name = unmarshalQCString(s); |
|
558 Grouping::GroupPri_t prio = (Grouping::GroupPri_t)unmarshalInt(s); |
|
559 result->append(new Grouping(name,prio)); |
|
560 } |
|
561 return result; |
|
562 } |
|
563 |
|
564 QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s) |
|
565 { |
|
566 uint i; |
|
567 uint count = unmarshalUInt(s); |
|
568 if (count==NULL_LIST) return 0; // null list |
|
569 QList<SectionInfo> *result = new QList<SectionInfo>; |
|
570 result->setAutoDelete(TRUE); |
|
571 assert(count<1000000); |
|
572 for (i=0;i<count;i++) |
|
573 { |
|
574 QCString label = unmarshalQCString(s); |
|
575 QCString title = unmarshalQCString(s); |
|
576 QCString ref = unmarshalQCString(s); |
|
577 SectionInfo::SectionType type = (SectionInfo::SectionType)unmarshalInt(s); |
|
578 QCString fileName = unmarshalQCString(s); |
|
579 result->append(new SectionInfo(fileName,label,title,type,ref)); |
|
580 } |
|
581 return result; |
|
582 } |
|
583 |
|
584 QList<ListItemInfo> *unmarshalItemInfoList(StorageIntf *s) |
|
585 { |
|
586 uint i; |
|
587 uint count = unmarshalUInt(s); |
|
588 if (count==NULL_LIST) return 0; // null list |
|
589 QList<ListItemInfo> *result = new QList<ListItemInfo>; |
|
590 result->setAutoDelete(TRUE); |
|
591 assert(count<1000000); |
|
592 for (i=0;i<count;i++) |
|
593 { |
|
594 ListItemInfo *lii = new ListItemInfo; |
|
595 lii->type = unmarshalQCString(s); |
|
596 lii->itemId = unmarshalInt(s); |
|
597 result->append(lii); |
|
598 } |
|
599 return result; |
|
600 } |
|
601 |
|
602 void *unmarshalObjPointer(StorageIntf *s) |
|
603 { |
|
604 void *result; |
|
605 s->read((char *)&result,sizeof(void*)); |
|
606 return result; |
|
607 } |
|
608 |
|
609 SectionDict *unmarshalSectionDict(StorageIntf *s) |
|
610 { |
|
611 uint i; |
|
612 uint count = unmarshalUInt(s); |
|
613 //printf("unmarshalSectionDict count=%d\n",count); |
|
614 if (count==NULL_LIST) return 0; // null list |
|
615 SectionDict *result = new SectionDict(17); |
|
616 assert(count<1000000); |
|
617 for (i=0;i<count;i++) |
|
618 { |
|
619 QCString key = unmarshalQCString(s); |
|
620 SectionInfo *si = (SectionInfo *)unmarshalObjPointer(s); |
|
621 //printf(" unmarshalSectionDict i=%d key=%s si=%s\n",count,key.data(),si->label.data()); |
|
622 result->insert(key,si); |
|
623 } |
|
624 return result; |
|
625 } |
|
626 |
|
627 MemberSDict *unmarshalMemberSDict(StorageIntf *s) |
|
628 { |
|
629 uint i; |
|
630 uint count = unmarshalUInt(s); |
|
631 //printf("--- unmarshalMemberSDict count=%d\n",count); |
|
632 if (count==NULL_LIST) |
|
633 { |
|
634 //printf("--- end unmarshalMemberSDict\n"); |
|
635 return 0; // null list |
|
636 } |
|
637 MemberSDict *result = new MemberSDict; |
|
638 assert(count<1000000); |
|
639 //printf("Reading %d key-value pairs\n",count); |
|
640 for (i=0;i<count;i++) |
|
641 { |
|
642 //printf(" unmarshaling pair %d\n",i); |
|
643 QCString key = unmarshalQCString(s); |
|
644 //printf(" unmarshaling key %s\n",key.data()); |
|
645 MemberDef *md = (MemberDef *)unmarshalObjPointer(s); |
|
646 //printf(" unmarshalMemberSDict i=%d key=%s md=%p\n",i,key.data(),md); |
|
647 result->inSort(key,md); // note: this can lead to unmarshalling another object! |
|
648 } |
|
649 //printf("--- end unmarshalMemberSDict\n"); |
|
650 return result; |
|
651 } |
|
652 |
|
653 DocInfo *unmarshalDocInfo(StorageIntf *s) |
|
654 { |
|
655 uint count = unmarshalUInt(s); |
|
656 if (count==NULL_LIST) return 0; |
|
657 DocInfo *result = new DocInfo; |
|
658 result->doc = unmarshalQCString(s); |
|
659 result->line = unmarshalInt(s); |
|
660 result->file = unmarshalQCString(s); |
|
661 return result; |
|
662 } |
|
663 |
|
664 BriefInfo *unmarshalBriefInfo(StorageIntf *s) |
|
665 { |
|
666 uint count = unmarshalUInt(s); |
|
667 if (count==NULL_LIST) return 0; |
|
668 BriefInfo *result = new BriefInfo; |
|
669 result->doc = unmarshalQCString(s); |
|
670 result->tooltip = unmarshalQCString(s); |
|
671 result->line = unmarshalInt(s); |
|
672 result->file = unmarshalQCString(s); |
|
673 return result; |
|
674 } |
|
675 |
|
676 BodyInfo *unmarshalBodyInfo(StorageIntf *s) |
|
677 { |
|
678 uint count = unmarshalUInt(s); |
|
679 if (count==NULL_LIST) return 0; |
|
680 BodyInfo *result = new BodyInfo; |
|
681 result->startLine = unmarshalInt(s); |
|
682 result->endLine = unmarshalInt(s); |
|
683 result->fileDef = (FileDef*)unmarshalObjPointer(s); |
|
684 return result; |
|
685 } |
|
686 |
|
687 GroupList *unmarshalGroupList(StorageIntf *s) |
|
688 { |
|
689 uint i; |
|
690 uint count = unmarshalUInt(s); |
|
691 if (count==NULL_LIST) return 0; // null list |
|
692 assert(count<1000000); |
|
693 GroupList *result = new GroupList; |
|
694 for (i=0;i<count;i++) |
|
695 { |
|
696 GroupDef *gd = (GroupDef *)unmarshalObjPointer(s); |
|
697 result->append(gd); |
|
698 } |
|
699 return result; |
|
700 } |
|
701 |
|
702 MemberList *unmarshalMemberList(StorageIntf *s) |
|
703 { |
|
704 uint i; |
|
705 uint count = unmarshalUInt(s); |
|
706 if (count==NULL_LIST) return 0; |
|
707 MemberList *result = new MemberList; |
|
708 assert(count<1000000); |
|
709 for (i=0;i<count;i++) |
|
710 { |
|
711 MemberDef *md = (MemberDef*)unmarshalObjPointer(s); |
|
712 result->append(md); |
|
713 } |
|
714 result->unmarshal(s); |
|
715 return result; |
|
716 } |
|
717 |
|
718 ExampleSDict *unmarshalExampleSDict(StorageIntf *s) |
|
719 { |
|
720 uint i; |
|
721 uint count = unmarshalUInt(s); |
|
722 if (count==NULL_LIST) return 0; |
|
723 ExampleSDict *result = new ExampleSDict; |
|
724 assert(count<1000000); |
|
725 for (i=0;i<count;i++) |
|
726 { |
|
727 QCString key = unmarshalQCString(s); |
|
728 Example *e = new Example; |
|
729 e->anchor = unmarshalQCString(s); |
|
730 e->name = unmarshalQCString(s); |
|
731 e->file = unmarshalQCString(s); |
|
732 result->inSort(key,e); |
|
733 } |
|
734 return result; |
|
735 } |
|
736 |
|
737 SDict<MemberList> *unmarshalMemberLists(StorageIntf *s) |
|
738 { |
|
739 uint i; |
|
740 uint count = unmarshalUInt(s); |
|
741 if (count==NULL_LIST) return 0; |
|
742 SDict<MemberList> *result = new SDict<MemberList>(7); |
|
743 assert(count<1000000); |
|
744 for (i=0;i<count;i++) |
|
745 { |
|
746 QCString key = unmarshalQCString(s); |
|
747 MemberList *ml = (MemberList *)unmarshalObjPointer(s); |
|
748 result->append(key,ml); |
|
749 } |
|
750 return result; |
|
751 } |
|
752 |
|
753 Entry * unmarshalEntry(StorageIntf *s) |
|
754 { |
|
755 Entry *e = new Entry; |
|
756 uint header=unmarshalUInt(s); |
|
757 ASSERT(header==HEADER); |
|
758 e->name = unmarshalQCString(s); |
|
759 e->type = unmarshalQCString(s); |
|
760 e->section = unmarshalInt(s); |
|
761 e->protection = (Protection)unmarshalInt(s); |
|
762 e->mtype = (MethodTypes)unmarshalInt(s); |
|
763 e->spec = unmarshalInt(s); |
|
764 e->initLines = unmarshalInt(s); |
|
765 e->stat = unmarshalBool(s); |
|
766 e->explicitExternal = unmarshalBool(s); |
|
767 e->proto = unmarshalBool(s); |
|
768 e->subGrouping = unmarshalBool(s); |
|
769 e->callGraph = unmarshalBool(s); |
|
770 e->callerGraph = unmarshalBool(s); |
|
771 e->virt = (Specifier)unmarshalInt(s); |
|
772 e->args = unmarshalQCString(s); |
|
773 e->bitfields = unmarshalQCString(s); |
|
774 delete e->argList; |
|
775 e->argList = unmarshalArgumentList(s); |
|
776 e->tArgLists = unmarshalArgumentLists(s); |
|
777 e->program = unmarshalQGString(s); |
|
778 e->initializer = unmarshalQGString(s); |
|
779 e->includeFile = unmarshalQCString(s); |
|
780 e->includeName = unmarshalQCString(s); |
|
781 e->doc = unmarshalQCString(s); |
|
782 e->docLine = unmarshalInt(s); |
|
783 e->docFile = unmarshalQCString(s); |
|
784 e->brief = unmarshalQCString(s); |
|
785 e->briefLine = unmarshalInt(s); |
|
786 e->briefFile = unmarshalQCString(s); |
|
787 e->inbodyDocs = unmarshalQCString(s); |
|
788 e->inbodyLine = unmarshalInt(s); |
|
789 e->inbodyFile = unmarshalQCString(s); |
|
790 e->relates = unmarshalQCString(s); |
|
791 e->relatesType = (RelatesType)unmarshalInt(s); |
|
792 e->read = unmarshalQCString(s); |
|
793 e->write = unmarshalQCString(s); |
|
794 e->inside = unmarshalQCString(s); |
|
795 e->exception = unmarshalQCString(s); |
|
796 e->typeConstr = unmarshalArgumentList(s); |
|
797 e->bodyLine = unmarshalInt(s); |
|
798 e->endBodyLine = unmarshalInt(s); |
|
799 e->mGrpId = unmarshalInt(s); |
|
800 delete e->extends; |
|
801 e->extends = unmarshalBaseInfoList(s); |
|
802 delete e->groups; |
|
803 e->groups = unmarshalGroupingList(s); |
|
804 delete e->anchors; |
|
805 e->anchors = unmarshalSectionInfoList(s); |
|
806 e->fileName = unmarshalQCString(s); |
|
807 e->startLine = unmarshalInt(s); |
|
808 e->sli = unmarshalItemInfoList(s); |
|
809 e->objc = unmarshalBool(s); |
|
810 e->hidden = unmarshalBool(s); |
|
811 e->artificial = unmarshalBool(s); |
|
812 e->groupDocType = (Entry::GroupDocType)unmarshalInt(s); |
|
813 return e; |
|
814 } |
|
815 |
|
816 Entry * unmarshalEntryTree(StorageIntf *s) |
|
817 { |
|
818 Entry *e = unmarshalEntry(s); |
|
819 uint count = unmarshalUInt(s); |
|
820 uint i; |
|
821 for (i=0;i<count;i++) |
|
822 { |
|
823 e->addSubEntry(unmarshalEntryTree(s)); |
|
824 } |
|
825 return e; |
|
826 } |