marshal.cpp

Go to the documentation of this file.
00001 #include <qfile.h>
00002 #include <assert.h>
00003 
00004 #include "sortdict.h"
00005 #include "marshal.h"
00006 #include "entry.h"
00007 #include "section.h"
00008 #include "memberlist.h"
00009 #include "definition.h"
00010 #include "groupdef.h"
00011 #include "example.h"
00012 
00013 #define HEADER ('D'<<24)+('O'<<16)+('X'<<8)+'!'
00014 
00015 void marshalInt(StorageIntf *s,int v)
00016 {
00017   uchar b[4];
00018   b[0]=((uint)v)>>24;
00019   b[1]=(((uint)v)>>16)&0xff;
00020   b[2]=(((uint)v)>>8)&0xff;
00021   b[3]=v&0xff;
00022   s->write((const char *)b,4);
00023 }
00024 
00025 void marshalUInt(StorageIntf *s,uint v)
00026 {
00027   uchar b[4];
00028   b[0]=v>>24;
00029   b[1]=(v>>16)&0xff;
00030   b[2]=(v>>8)&0xff;
00031   b[3]=v&0xff;
00032   s->write((const char *)b,4);
00033 }
00034 
00035 void marshalBool(StorageIntf *s,bool b)
00036 {
00037   char c = b;
00038   s->write(&c,sizeof(char));
00039 }
00040 
00041 void marshalQCString(StorageIntf *s,const QCString &str)
00042 {
00043   uint l=str.length();
00044   marshalUInt(s,l);
00045   if (l>0) s->write(str.data(),l);
00046 }
00047 
00048 void marshalQGString(StorageIntf *s,const QGString &str)
00049 {
00050   uint l=str.length();
00051   marshalUInt(s,l);
00052   if (l>0) s->write(str.data(),l);
00053 }
00054 
00055 void marshalArgumentList(StorageIntf *s,ArgumentList *argList)
00056 {
00057   if (argList==0)
00058   {
00059     marshalUInt(s,NULL_LIST); // null pointer representation
00060   }
00061   else
00062   {
00063     marshalUInt(s,argList->count());
00064     if (argList->count()>0)
00065     {
00066       ArgumentListIterator ali(*argList);
00067       Argument *a;
00068       for (ali.toFirst();(a=ali.current());++ali)
00069       {
00070         marshalQCString(s,a->attrib);    
00071         marshalQCString(s,a->type);    
00072         marshalQCString(s,a->canType);    
00073         marshalQCString(s,a->name);    
00074         marshalQCString(s,a->array);    
00075         marshalQCString(s,a->defval);    
00076         marshalQCString(s,a->docs);    
00077       }
00078     }
00079     marshalBool(s,argList->constSpecifier);
00080     marshalBool(s,argList->volatileSpecifier);
00081     marshalBool(s,argList->pureSpecifier);
00082   }
00083 }
00084 
00085 void marshalArgumentLists(StorageIntf *s,QList<ArgumentList> *argLists)
00086 {
00087   if (argLists==0)
00088   {
00089     marshalUInt(s,NULL_LIST); // null pointer representation
00090   }
00091   else
00092   {
00093     marshalUInt(s,argLists->count());
00094     QListIterator<ArgumentList> ali(*argLists);
00095     ArgumentList *al;
00096     for (ali.toFirst();(al=ali.current());++ali)
00097     {
00098       marshalArgumentList(s,al);
00099     }
00100   }
00101 }
00102 
00103 void marshalBaseInfoList(StorageIntf *s, QList<BaseInfo> *baseList)
00104 {
00105   if (baseList==0)
00106   {
00107     marshalUInt(s,NULL_LIST); // null pointer representation
00108   }
00109   else
00110   {
00111     marshalUInt(s,baseList->count());
00112     QListIterator<BaseInfo> bli(*baseList);
00113     BaseInfo *bi;
00114     for (bli.toFirst();(bi=bli.current());++bli)
00115     {
00116       marshalQCString(s,bi->name);
00117       marshalInt(s,(int)bi->prot);
00118       marshalInt(s,(int)bi->virt);
00119     }
00120   }
00121 }
00122 
00123 void marshalGroupingList(StorageIntf *s, QList<Grouping> *groups)
00124 {
00125   if (groups==0)
00126   {
00127     marshalUInt(s,NULL_LIST); // null pointer representation
00128   }
00129   else
00130   {
00131     marshalUInt(s,groups->count());
00132     QListIterator<Grouping> gli(*groups);
00133     Grouping *g;
00134     for (gli.toFirst();(g=gli.current());++gli)
00135     {
00136       marshalQCString(s,g->groupname);
00137       marshalInt(s,(int)g->pri);
00138     }
00139   }
00140 }
00141 
00142 void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors)
00143 {
00144   if (anchors==0)
00145   {
00146     marshalUInt(s,NULL_LIST); // null pointer representation
00147   }
00148   else
00149   {
00150     marshalUInt(s,anchors->count());
00151     QListIterator<SectionInfo> sli(*anchors);
00152     SectionInfo *si;
00153     for (sli.toFirst();(si=sli.current());++sli)
00154     {
00155       marshalQCString(s,si->label);
00156       marshalQCString(s,si->title);
00157       marshalQCString(s,si->ref);
00158       marshalInt(s,(int)si->type);
00159       marshalQCString(s,si->fileName);
00160     }
00161   }
00162 }
00163 
00164 void marshalItemInfoList(StorageIntf *s, QList<ListItemInfo> *sli)
00165 {
00166   if (sli==0)
00167   {
00168     marshalUInt(s,NULL_LIST); // null pointer representation
00169   }
00170   else
00171   {
00172     marshalUInt(s,sli->count());
00173     QListIterator<ListItemInfo> liii(*sli);
00174     ListItemInfo *lii;
00175     for (liii.toFirst();(lii=liii.current());++liii)
00176     {
00177       marshalQCString(s,lii->type);
00178       marshalInt(s,lii->itemId);
00179     }
00180   }
00181 }
00182 
00183 void marshalObjPointer(StorageIntf *s,void *obj)
00184 {
00185   char *b = (char *)&obj;
00186   s->write(b,sizeof(void *));
00187 }
00188 
00189 void marshalSectionDict(StorageIntf *s,SectionDict *sections)
00190 {
00191   if (sections==0)
00192   {
00193     marshalUInt(s,NULL_LIST); // null pointer representation
00194   }
00195   else
00196   {
00197     marshalUInt(s,sections->count());
00198     QDictIterator<SectionInfo> sli(*sections);
00199     SectionInfo *si;
00200     for (sli.toFirst();(si=sli.current());++sli)
00201     {
00202       marshalQCString(s,sli.currentKey());
00203       marshalObjPointer(s,si);
00204     }
00205   }
00206 }
00207 
00208 void marshalMemberSDict(StorageIntf *s,MemberSDict *memberSDict)
00209 {
00210   if (memberSDict==0)
00211   {
00212     marshalUInt(s,NULL_LIST); // null pointer representation
00213   }
00214   else
00215   {
00216     marshalUInt(s,memberSDict->count());
00217     //printf("  marshalMemberSDict: items=%d\n",memberSDict->count());
00218     SDict<MemberDef>::IteratorDict mdi(*memberSDict);
00219     MemberDef *md;
00220     int count=0;
00221     for (mdi.toFirst();(md=mdi.current());++mdi)
00222     {
00223       //printf("  marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md);
00224       marshalQCString(s,mdi.currentKey());
00225       marshalObjPointer(s,md);
00226       count++;
00227     }
00228     assert(count==memberSDict->count());
00229   }
00230 }
00231 
00232 void marshalDocInfo(StorageIntf *s,DocInfo *docInfo)
00233 {
00234   if (docInfo==0)
00235   {
00236     marshalUInt(s,NULL_LIST); // null pointer representation
00237   }
00238   else
00239   {
00240     marshalUInt(s,1); 
00241     marshalQCString(s,docInfo->doc);
00242     marshalInt(s,docInfo->line);
00243     marshalQCString(s,docInfo->file);
00244   }
00245 }
00246 
00247 void marshalBriefInfo(StorageIntf *s,BriefInfo *briefInfo)
00248 {
00249   if (briefInfo==0)
00250   {
00251     marshalUInt(s,NULL_LIST); // null pointer representation
00252   }
00253   else
00254   {
00255     marshalUInt(s,1); 
00256     marshalQCString(s,briefInfo->doc);
00257     marshalQCString(s,briefInfo->tooltip);
00258     marshalInt(s,briefInfo->line);
00259     marshalQCString(s,briefInfo->file);
00260   }
00261 }
00262 
00263 void marshalBodyInfo(StorageIntf *s,BodyInfo *bodyInfo)
00264 {
00265   if (bodyInfo==0)
00266   {
00267     marshalUInt(s,NULL_LIST); // null pointer representation
00268   }
00269   else
00270   {
00271     marshalUInt(s,1); 
00272     marshalInt(s,bodyInfo->startLine);
00273     marshalInt(s,bodyInfo->endLine);
00274     marshalObjPointer(s,bodyInfo->fileDef);
00275   }
00276 }
00277 
00278 void marshalGroupList(StorageIntf *s,GroupList *groupList)
00279 {
00280   if (groupList==0)
00281   {
00282     marshalUInt(s,NULL_LIST); // null pointer representation
00283   }
00284   else
00285   {
00286     marshalUInt(s,groupList->count());
00287     QListIterator<GroupDef> gli(*groupList);
00288     GroupDef *gd=0;
00289     for (gli.toFirst();(gd=gli.current());++gli)
00290     {
00291       marshalObjPointer(s,gd);
00292     }
00293   }
00294 }
00295 
00296 void marshalMemberList(StorageIntf *s,MemberList *ml)
00297 {
00298   if (ml==0)
00299   {
00300     marshalUInt(s,NULL_LIST); // null pointer representation
00301   }
00302   else
00303   {
00304     marshalUInt(s,ml->count());
00305     MemberListIterator mli(*ml);
00306     MemberDef *md;
00307     uint count=0;
00308     for (mli.toFirst();(md=mli.current());++mli)
00309     {
00310       marshalObjPointer(s,md);
00311       count++;
00312     }
00313     assert(count==ml->count());
00314 
00315     ml->marshal(s);
00316   }
00317 }
00318 
00319 void marshalExampleSDict(StorageIntf *s,ExampleSDict *ed)
00320 {
00321   if (ed==0)
00322   {
00323     marshalUInt(s,NULL_LIST); // null pointer representation
00324   }
00325   else
00326   {
00327     marshalUInt(s,ed->count());
00328     //printf("  marshalMemberSDict: items=%d\n",memberSDict->count());
00329     SDict<Example>::IteratorDict edi(*ed);
00330     Example *e;
00331     for (edi.toFirst();(e=edi.current());++edi)
00332     {
00333       //printf("  marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md);
00334       marshalQCString(s,edi.currentKey());
00335       marshalQCString(s,e->anchor);
00336       marshalQCString(s,e->name);
00337       marshalQCString(s,e->file);
00338     }
00339   }
00340 }
00341 
00342 void marshalMemberLists(StorageIntf *s,SDict<MemberList> *mls)
00343 {
00344   if (mls==0)
00345   {
00346     marshalUInt(s,NULL_LIST); // null pointer representation
00347   }
00348   else
00349   {
00350     marshalUInt(s,mls->count());
00351     //printf("  marshalMemberSDict: items=%d\n",memberSDict->count());
00352     SDict<MemberList>::IteratorDict mli(*mls);
00353     MemberList *ml;
00354     for (mli.toFirst();(ml=mli.current());++mli)
00355     {
00356       //printf("  marshalMemberSDict: %d: key=%s value=%p\n",count,mdi.currentKey().data(),md);
00357       marshalQCString(s,mli.currentKey());
00358       marshalObjPointer(s,ml); // assume we are not owner of the list
00359     }
00360   }
00361 }
00362 
00363 void marshalEntry(StorageIntf *s,Entry *e)
00364 {
00365   marshalUInt(s,HEADER);
00366   marshalQCString(s,e->name);
00367   marshalQCString(s,e->type);
00368   marshalInt(s,e->section);
00369   marshalInt(s,(int)e->protection);
00370   marshalInt(s,(int)e->mtype);
00371   marshalInt(s,e->spec);
00372   marshalInt(s,e->initLines);
00373   marshalBool(s,e->stat);
00374   marshalBool(s,e->explicitExternal);
00375   marshalBool(s,e->proto);
00376   marshalBool(s,e->subGrouping);
00377   marshalBool(s,e->callGraph);
00378   marshalBool(s,e->callerGraph);
00379   marshalInt(s,(int)e->virt);
00380   marshalQCString(s,e->args);
00381   marshalQCString(s,e->bitfields);
00382   marshalArgumentList(s,e->argList);
00383   marshalArgumentLists(s,e->tArgLists);
00384   marshalQGString(s,e->program);
00385   marshalQGString(s,e->initializer);
00386   marshalQCString(s,e->includeFile);
00387   marshalQCString(s,e->includeName);
00388   marshalQCString(s,e->doc);
00389   marshalInt(s,e->docLine);
00390   marshalQCString(s,e->docFile);
00391   marshalQCString(s,e->brief);
00392   marshalInt(s,e->briefLine);
00393   marshalQCString(s,e->briefFile);
00394   marshalQCString(s,e->inbodyDocs);
00395   marshalInt(s,e->inbodyLine);
00396   marshalQCString(s,e->inbodyFile);
00397   marshalQCString(s,e->relates);
00398   marshalBool(s,e->relatesDup);
00399   marshalQCString(s,e->read);
00400   marshalQCString(s,e->write);
00401   marshalQCString(s,e->inside);
00402   marshalQCString(s,e->exception);
00403   marshalArgumentList(s,e->typeConstr);
00404   marshalInt(s,e->bodyLine);
00405   marshalInt(s,e->endBodyLine);
00406   marshalInt(s,e->mGrpId);
00407   marshalBaseInfoList(s,e->extends);
00408   marshalGroupingList(s,e->groups);
00409   marshalSectionInfoList(s,e->anchors);
00410   marshalQCString(s,e->fileName);
00411   marshalInt(s,e->startLine);
00412   marshalItemInfoList(s,e->sli);
00413   marshalBool(s,e->objc);
00414   marshalBool(s,e->hidden);
00415   marshalBool(s,e->artificial);
00416   marshalInt(s,(int)e->groupDocType);
00417 }
00418 
00419 void marshalEntryTree(StorageIntf *s,Entry *e)
00420 {
00421   marshalEntry(s,e);
00422   marshalUInt(s,e->children()->count());
00423   QListIterator<Entry> eli(*e->children());
00424   Entry *child;
00425   for (eli.toFirst();(child=eli.current());++eli)
00426   {
00427     marshalEntryTree(s,child);
00428   }
00429 }
00430 
00431 //------------------------------------------------------------------
00432 
00433 int unmarshalInt(StorageIntf *s)
00434 {
00435   uchar b[4];
00436   s->read((char *)b,4);
00437   int result=(int)((((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3]);
00438   //printf("unmarshalInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos());
00439   return result;
00440 }
00441 
00442 uint unmarshalUInt(StorageIntf *s)
00443 {
00444   uchar b[4];
00445   s->read((char *)b,4);
00446   uint result=(((uint)b[0])<<24)+((uint)b[1]<<16)+((uint)b[2]<<8)+(uint)b[3];
00447   //printf("unmarshalUInt: %x %x %x %x: %x offset=%llx\n",b[0],b[1],b[2],b[3],result,f.pos());
00448   return result;
00449 }
00450 
00451 bool unmarshalBool(StorageIntf *s)
00452 {
00453   char result;
00454   s->read(&result,sizeof(result));
00455   //printf("unmarshalBool: %x offset=%llx\n",result,f.pos());
00456   return result;
00457 }
00458 
00459 QCString unmarshalQCString(StorageIntf *s)
00460 {
00461   uint len = unmarshalUInt(s);
00462   //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos());
00463   QCString result(len+1);
00464   result.at(len)='\0';
00465   if (len>0)
00466   {
00467     s->read(result.data(),len);
00468   }
00469   //printf("unmarshalQCString: result=%s\n",result.data());
00470   return result;
00471 }
00472 
00473 QGString unmarshalQGString(StorageIntf *s)
00474 {
00475   uint len = unmarshalUInt(s);
00476   //printf("unmarshalQCString: len=%d offset=%llx\n",len,f.pos());
00477   QGString result(len+1);
00478   result.at(len)='\0';
00479   if (len>0)
00480   {
00481     s->read(result.data(),len);
00482   }
00483   //printf("unmarshalQCString: result=%s\n",result.data());
00484   return result;
00485 }
00486 
00487 ArgumentList *unmarshalArgumentList(StorageIntf *s)
00488 {
00489   uint i;
00490   uint count = unmarshalUInt(s);
00491   if (count==NULL_LIST) return 0; // null list
00492   ArgumentList *result = new ArgumentList;
00493   assert(count<1000000);
00494   //printf("unmarshalArgumentList: %d\n",count);
00495   for (i=0;i<count;i++)
00496   {
00497     Argument *a = new Argument;
00498     a->attrib  = unmarshalQCString(s);
00499     a->type    = unmarshalQCString(s);
00500     a->canType = unmarshalQCString(s);
00501     a->name    = unmarshalQCString(s);
00502     a->array   = unmarshalQCString(s);
00503     a->defval  = unmarshalQCString(s);
00504     a->docs    = unmarshalQCString(s);
00505     result->append(a);
00506   }
00507   result->constSpecifier    = unmarshalBool(s);
00508   result->volatileSpecifier = unmarshalBool(s);
00509   result->pureSpecifier     = unmarshalBool(s);
00510   return result;
00511 }
00512 
00513 QList<ArgumentList> *unmarshalArgumentLists(StorageIntf *s)
00514 {
00515   uint i;
00516   uint count = unmarshalUInt(s);
00517   if (count==NULL_LIST) return 0; // null list
00518   QList<ArgumentList> *result = new QList<ArgumentList>;
00519   result->setAutoDelete(TRUE);
00520   assert(count<1000000);
00521   //printf("unmarshalArgumentLists: %d\n",count);
00522   for (i=0;i<count;i++)
00523   {
00524     result->append(unmarshalArgumentList(s));
00525   }
00526   return result;
00527 }
00528 
00529 QList<BaseInfo> *unmarshalBaseInfoList(StorageIntf *s)
00530 {
00531   uint i;
00532   uint count = unmarshalUInt(s);
00533   if (count==NULL_LIST) return 0; // null list
00534   QList<BaseInfo> *result = new QList<BaseInfo>;
00535   result->setAutoDelete(TRUE);
00536   assert(count<1000000);
00537   for (i=0;i<count;i++)
00538   {
00539     QCString name   = unmarshalQCString(s);
00540     Protection prot = (Protection)unmarshalInt(s);
00541     Specifier virt  = (Specifier)unmarshalInt(s);
00542     result->append(new BaseInfo(name,prot,virt));
00543   }
00544   return result;
00545 }
00546 
00547 QList<Grouping> *unmarshalGroupingList(StorageIntf *s)
00548 {
00549   uint i;
00550   uint count = unmarshalUInt(s);
00551   if (count==NULL_LIST) return 0; // null list
00552   QList<Grouping> *result = new QList<Grouping>;
00553   result->setAutoDelete(TRUE);
00554   assert(count<1000000);
00555   for (i=0;i<count;i++)
00556   {
00557     QCString name = unmarshalQCString(s);
00558     Grouping::GroupPri_t prio = (Grouping::GroupPri_t)unmarshalInt(s);
00559     result->append(new Grouping(name,prio));
00560   }
00561   return result;
00562 }
00563 
00564 QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s)
00565 {
00566   uint i;
00567   uint count = unmarshalUInt(s);
00568   if (count==NULL_LIST) return 0; // null list
00569   QList<SectionInfo> *result = new QList<SectionInfo>;
00570   result->setAutoDelete(TRUE);
00571   assert(count<1000000);
00572   for (i=0;i<count;i++)
00573   { 
00574     QCString label = unmarshalQCString(s);
00575     QCString title = unmarshalQCString(s);
00576     QCString ref   = unmarshalQCString(s);
00577     SectionInfo::SectionType type = (SectionInfo::SectionType)unmarshalInt(s);
00578     QCString fileName = unmarshalQCString(s);
00579     result->append(new SectionInfo(fileName,label,title,type,ref));
00580   }
00581   return result;
00582 }
00583 
00584 QList<ListItemInfo> *unmarshalItemInfoList(StorageIntf *s)
00585 {
00586   uint i;
00587   uint count = unmarshalUInt(s);
00588   if (count==NULL_LIST) return 0; // null list
00589   QList<ListItemInfo> *result = new QList<ListItemInfo>;
00590   result->setAutoDelete(TRUE);
00591   assert(count<1000000);
00592   for (i=0;i<count;i++)
00593   { 
00594     ListItemInfo *lii = new ListItemInfo;
00595     lii->type   = unmarshalQCString(s);
00596     lii->itemId = unmarshalInt(s);
00597     result->append(lii);
00598   }
00599   return result;
00600 }
00601 
00602 void *unmarshalObjPointer(StorageIntf *s)
00603 {
00604   void *result;
00605   s->read((char *)&result,sizeof(void*));
00606   return result;
00607 }
00608 
00609 SectionDict *unmarshalSectionDict(StorageIntf *s)
00610 {
00611   uint i;
00612   uint count = unmarshalUInt(s);
00613   //printf("unmarshalSectionDict count=%d\n",count);
00614   if (count==NULL_LIST) return 0; // null list
00615   SectionDict *result = new SectionDict(17);
00616   assert(count<1000000);
00617   for (i=0;i<count;i++)
00618   {
00619     QCString key    = unmarshalQCString(s);
00620     SectionInfo *si = (SectionInfo *)unmarshalObjPointer(s);
00621     //printf("  unmarshalSectionDict i=%d key=%s si=%s\n",count,key.data(),si->label.data());
00622     result->insert(key,si);
00623   }
00624   return result;
00625 }
00626 
00627 MemberSDict *unmarshalMemberSDict(StorageIntf *s)
00628 {
00629   uint i;
00630   uint count = unmarshalUInt(s);
00631   //printf("--- unmarshalMemberSDict count=%d\n",count);
00632   if (count==NULL_LIST) 
00633   {
00634     //printf("--- end unmarshalMemberSDict\n");
00635     return 0; // null list
00636   }
00637   MemberSDict *result = new MemberSDict;
00638   assert(count<1000000);
00639   //printf("Reading %d key-value pairs\n",count);
00640   for (i=0;i<count;i++)
00641   {
00642     //printf("  unmarshaling pair %d\n",i);
00643     QCString key    = unmarshalQCString(s);
00644     //printf("  unmarshaling key %s\n",key.data());
00645     MemberDef *md = (MemberDef *)unmarshalObjPointer(s);
00646     //printf("  unmarshalMemberSDict i=%d key=%s md=%p\n",i,key.data(),md);
00647     result->inSort(key,md); // note: this can lead to unmarshalling another object!
00648   }
00649   //printf("--- end unmarshalMemberSDict\n");
00650   return result;
00651 }
00652 
00653 DocInfo *unmarshalDocInfo(StorageIntf *s)
00654 {
00655   uint count = unmarshalUInt(s); 
00656   if (count==NULL_LIST) return 0;
00657   DocInfo *result = new DocInfo;
00658   result->doc  = unmarshalQCString(s);
00659   result->line = unmarshalInt(s);
00660   result->file = unmarshalQCString(s);
00661   return result;
00662 }
00663 
00664 BriefInfo *unmarshalBriefInfo(StorageIntf *s)
00665 {
00666   uint count = unmarshalUInt(s); 
00667   if (count==NULL_LIST) return 0;
00668   BriefInfo *result = new BriefInfo;
00669   result->doc     = unmarshalQCString(s);
00670   result->tooltip = unmarshalQCString(s);
00671   result->line    = unmarshalInt(s);
00672   result->file    = unmarshalQCString(s);
00673   return result;
00674 }
00675 
00676 BodyInfo *unmarshalBodyInfo(StorageIntf *s)
00677 {
00678   uint count = unmarshalUInt(s); 
00679   if (count==NULL_LIST) return 0;
00680   BodyInfo *result = new BodyInfo;
00681   result->startLine = unmarshalInt(s);
00682   result->endLine   = unmarshalInt(s);
00683   result->fileDef   = (FileDef*)unmarshalObjPointer(s);
00684   return result;
00685 }
00686 
00687 GroupList *unmarshalGroupList(StorageIntf *s)
00688 {
00689   uint i;
00690   uint count = unmarshalUInt(s);
00691   if (count==NULL_LIST) return 0; // null list
00692   assert(count<1000000);
00693   GroupList *result = new GroupList;
00694   for (i=0;i<count;i++)
00695   {
00696     GroupDef *gd = (GroupDef *)unmarshalObjPointer(s);
00697     result->append(gd);
00698   }
00699   return result;
00700 }
00701 
00702 MemberList *unmarshalMemberList(StorageIntf *s)
00703 {
00704   uint i;
00705   uint count = unmarshalUInt(s); 
00706   if (count==NULL_LIST) return 0;
00707   MemberList *result = new MemberList;
00708   assert(count<1000000);
00709   for (i=0;i<count;i++)
00710   {
00711     MemberDef *md = (MemberDef*)unmarshalObjPointer(s);
00712     result->append(md);
00713   }
00714   result->unmarshal(s);
00715   return result;
00716 }
00717 
00718 ExampleSDict *unmarshalExampleSDict(StorageIntf *s)
00719 {
00720   uint i;
00721   uint count = unmarshalUInt(s); 
00722   if (count==NULL_LIST) return 0;
00723   ExampleSDict *result = new ExampleSDict;
00724   assert(count<1000000);
00725   for (i=0;i<count;i++)
00726   {
00727     QCString key = unmarshalQCString(s);
00728     Example *e = new Example;
00729     e->anchor = unmarshalQCString(s);
00730     e->name   = unmarshalQCString(s);
00731     e->file   = unmarshalQCString(s);
00732     result->inSort(key,e);
00733   }
00734   return result;
00735 }
00736 
00737 SDict<MemberList> *unmarshalMemberLists(StorageIntf *s)
00738 {
00739   uint i;
00740   uint count = unmarshalUInt(s); 
00741   if (count==NULL_LIST) return 0;
00742   SDict<MemberList> *result = new SDict<MemberList>(7);
00743   assert(count<1000000);
00744   for (i=0;i<count;i++)
00745   {
00746     QCString key = unmarshalQCString(s);
00747     MemberList *ml = (MemberList *)unmarshalObjPointer(s);
00748     result->append(key,ml);
00749   }
00750   return result;
00751 }
00752 
00753 Entry * unmarshalEntry(StorageIntf *s)
00754 {
00755   Entry *e = new Entry;
00756   uint header=unmarshalUInt(s);
00757   ASSERT(header==HEADER);
00758   e->name             = unmarshalQCString(s);
00759   e->type             = unmarshalQCString(s);
00760   e->section          = unmarshalInt(s);
00761   e->protection       = (Protection)unmarshalInt(s);
00762   e->mtype            = (MethodTypes)unmarshalInt(s);
00763   e->spec             = unmarshalInt(s);
00764   e->initLines        = unmarshalInt(s);
00765   e->stat             = unmarshalBool(s);
00766   e->explicitExternal = unmarshalBool(s);
00767   e->proto            = unmarshalBool(s);
00768   e->subGrouping      = unmarshalBool(s);
00769   e->callGraph        = unmarshalBool(s);
00770   e->callerGraph      = unmarshalBool(s);
00771   e->virt             = (Specifier)unmarshalInt(s);
00772   e->args             = unmarshalQCString(s);
00773   e->bitfields        = unmarshalQCString(s);
00774   delete e->argList;
00775   e->argList          = unmarshalArgumentList(s);
00776   e->tArgLists        = unmarshalArgumentLists(s);
00777   e->program          = unmarshalQGString(s);
00778   e->initializer      = unmarshalQGString(s);
00779   e->includeFile      = unmarshalQCString(s);
00780   e->includeName      = unmarshalQCString(s);
00781   e->doc              = unmarshalQCString(s);
00782   e->docLine          = unmarshalInt(s);
00783   e->docFile          = unmarshalQCString(s);
00784   e->brief            = unmarshalQCString(s);
00785   e->briefLine        = unmarshalInt(s);
00786   e->briefFile        = unmarshalQCString(s);
00787   e->inbodyDocs       = unmarshalQCString(s);
00788   e->inbodyLine       = unmarshalInt(s);
00789   e->inbodyFile       = unmarshalQCString(s);
00790   e->relates          = unmarshalQCString(s);
00791   e->relatesDup       = unmarshalBool(s);
00792   e->read             = unmarshalQCString(s);
00793   e->write            = unmarshalQCString(s);
00794   e->inside           = unmarshalQCString(s);
00795   e->exception        = unmarshalQCString(s);
00796   e->typeConstr       = unmarshalArgumentList(s);
00797   e->bodyLine         = unmarshalInt(s);
00798   e->endBodyLine      = unmarshalInt(s);
00799   e->mGrpId           = unmarshalInt(s);
00800   delete e->extends;
00801   e->extends          = unmarshalBaseInfoList(s);
00802   delete e->groups;
00803   e->groups           = unmarshalGroupingList(s);
00804   delete e->anchors;
00805   e->anchors          = unmarshalSectionInfoList(s);
00806   e->fileName         = unmarshalQCString(s);
00807   e->startLine        = unmarshalInt(s);
00808   e->sli              = unmarshalItemInfoList(s);
00809   e->objc             = unmarshalBool(s);
00810   e->hidden           = unmarshalBool(s);
00811   e->artificial       = unmarshalBool(s);
00812   e->groupDocType     = (Entry::GroupDocType)unmarshalInt(s);
00813   return e;
00814 }
00815 
00816 Entry * unmarshalEntryTree(StorageIntf *s)
00817 {
00818   Entry *e = unmarshalEntry(s);
00819   uint count = unmarshalUInt(s);
00820   uint i;
00821   for (i=0;i<count;i++)
00822   {
00823     e->addSubEntry(unmarshalEntryTree(s));
00824   }
00825   return e;
00826 }



Generated on Mon Mar 31 10:58:40 2008 by  doxygen 1.5.1