defgen.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: def.cpp,v 1.2 2001/01/01 10:15:18 root Exp $
00004  *
00005  *
00006  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00007  *
00008  * Permission to use, copy, modify, and distribute this software and its
00009  * documentation under the terms of the GNU General Public License is hereby 
00010  * granted. No representations are made about the suitability of this software 
00011  * for any purpose. It is provided "as is" without express or implied warranty.
00012  * See the GNU General Public License for more details.
00013  *
00014  * Documents produced by Doxygen are derivative works derived from the
00015  * input used in their production; they are not affected by this license.
00016  *
00017  */
00018 
00019 #include <stdlib.h>
00020 
00021 #include "qtbc.h"
00022 #include "defgen.h"
00023 #include "doxygen.h"
00024 #include "message.h"
00025 #include "config.h"
00026 #include "classlist.h"
00027 #include "util.h"
00028 #include "defargs.h"
00029 #include "outputgen.h"
00030 #include "dot.h"
00031 
00032 #include <qdir.h>
00033 #include <qfile.h>
00034 #include <qtextstream.h>
00035 
00036 #define DEF_DB(x)
00037 
00038 inline void writeDEFString(QTextStream &t,const char *s)
00039 {
00040   const char* p=s;
00041   char c;
00042 
00043   t << '\'';
00044   while ((c = *(p++)))
00045   {
00046     if (c == '\'')
00047       t << '\\';
00048     t << c;
00049   }
00050   t << '\'';
00051 }
00052 
00053 void generateDEFForMember(MemberDef *md,
00054     QTextStream &t,
00055     Definition *def,
00056     const char* Prefix)
00057 {
00058   QCString memPrefix;
00059 
00060   // + declaration
00061   // - reimplements
00062   // - reimplementedBy
00063   // - exceptions
00064   // - const/volatile specifiers
00065   // - examples
00066   // + source definition
00067   // - source references
00068   // - source referenced by
00069   // - include code 
00070 
00071   if (md->memberType()==MemberDef::EnumValue) return;
00072 
00073   QCString scopeName;
00074   if (md->getClassDef()) 
00075     scopeName=md->getClassDef()->name();
00076   else if (md->getNamespaceDef()) 
00077     scopeName=md->getNamespaceDef()->name();
00078 
00079   t << "    " << Prefix << "-member = {" << endl;
00080   memPrefix = "      ";
00081   memPrefix.append( Prefix );
00082   memPrefix.append( "-mem-" );
00083 
00084   QCString memType;
00085   bool isFunc=FALSE;
00086   switch (md->memberType())
00087   {
00088     case MemberDef::Define:      memType="define";    break;
00089     case MemberDef::EnumValue:   ASSERT(0);           break;
00090     case MemberDef::Property:    memType="property";  break;
00091     case MemberDef::Event:       memType="event";     break;
00092     case MemberDef::Variable:    memType="variable";  break;
00093     case MemberDef::Typedef:     memType="typedef";   break;
00094     case MemberDef::Enumeration: memType="enum";      break;
00095     case MemberDef::Function:    memType="function";  isFunc=TRUE; break;
00096     case MemberDef::Signal:      memType="signal";    isFunc=TRUE; break;
00097     case MemberDef::Prototype:   memType="prototype"; isFunc=TRUE; break;
00098     case MemberDef::Friend:      memType="friend";    isFunc=TRUE; break;
00099     case MemberDef::DCOP:        memType="dcop";      isFunc=TRUE; break;
00100     case MemberDef::Slot:        memType="slot";      isFunc=TRUE; break;
00101   }
00102 
00103   t << memPrefix << "kind = '" << memType << "';" << endl;
00104   t << memPrefix << "id   = '"
00105     << md->getOutputFileBase() << "_1" << md->anchor()
00106     << "';" << endl;
00107 
00108   t << memPrefix << "virt = ";
00109   switch (md->virtualness())
00110   {
00111     case Normal:  t << "normal;"       << endl; break;
00112     case Virtual: t << "virtual;"      << endl; break;
00113     case Pure:    t << "pure-virtual;" << endl; break;
00114     default: ASSERT(0);
00115   }
00116 
00117   t << memPrefix << "prot = ";
00118   switch(md->protection())
00119   {
00120     case Public:    t << "public;"    << endl; break;
00121     case Protected: t << "protected;" << endl; break;
00122     case Private:   t << "private;"   << endl; break;
00123     case Package:   t << "package;"   << endl; break;
00124   }
00125 
00126   if (md->memberType()!=MemberDef::Define &&
00127       md->memberType()!=MemberDef::Enumeration
00128      )
00129   {
00130     QCString typeStr = replaceAnonymousScopes(md->typeString());
00131     t << memPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl << typeStr << endl
00132       << "_EnD_oF_dEf_TeXt_;" << endl;
00133   }
00134 
00135   t << memPrefix << "name = '" << md->name() << "';" << endl;
00136 
00137   if (isFunc) //function
00138   {
00139     ArgumentList *declAl = new ArgumentList;
00140     LockingPtr<ArgumentList> defAl = md->argumentList();
00141     stringToArgumentList(md->argsString(),declAl);
00142     QCString fcnPrefix = "  " + memPrefix + "param-";
00143 
00144     if (declAl->count()>0)
00145     {
00146       ArgumentListIterator declAli(*declAl);
00147       ArgumentListIterator defAli(*defAl);
00148       Argument *a;
00149       for (declAli.toFirst();(a=declAli.current());++declAli)
00150       {
00151         Argument *defArg = defAli.current();
00152         t << memPrefix << "param = {" << endl;
00153         if (!a->attrib.isEmpty())
00154         {
00155           t << fcnPrefix << "attributes = ";
00156           writeDEFString(t,a->attrib);
00157           t << ';' << endl;
00158         }
00159         if (!a->type.isEmpty())
00160         {
00161           t << fcnPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl
00162             << a->type << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00163         }
00164         if (!a->name.isEmpty())
00165         {
00166           t << fcnPrefix << "declname = ";
00167           writeDEFString(t,a->name);
00168           t << ';' << endl;
00169         }
00170         if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
00171         {
00172           t << fcnPrefix << "defname = ";
00173           writeDEFString(t,defArg->name);
00174           t << ';' << endl;
00175         }
00176         if (!a->array.isEmpty())
00177         {
00178           t << fcnPrefix << "array = ";
00179           writeDEFString(t,a->array); 
00180           t << ';' << endl;
00181         }
00182         if (!a->defval.isEmpty())
00183         {
00184           t << fcnPrefix << "defval = <<_EnD_oF_dEf_TeXt_" << endl
00185             << a->defval << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00186         }
00187         if (defArg) ++defAli;
00188         t << "      }; /*" << fcnPrefix << "-param */" << endl;
00189       }
00190     }
00191     delete declAl;
00192   }
00193   else if (  md->memberType()==MemberDef::Define
00194       && md->argsString()!=0)
00195   {
00196     ArgumentListIterator ali(*md->argumentList());
00197     Argument *a;
00198     QCString defPrefix = "  " + memPrefix + "def-";
00199 
00200     for (ali.toFirst();(a=ali.current());++ali)
00201     {
00202       t << memPrefix << "param  = {" << endl;
00203       t << defPrefix << "name = '" << a->type << "';" << endl;
00204       t << "      }; /*" << defPrefix << "-param */" << endl;
00205     }
00206   }
00207 
00208   if (!md->initializer().isEmpty())
00209   {
00210     t << memPrefix << "initializer = <<_EnD_oF_dEf_TeXt_" << endl
00211       << md->initializer() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00212   }
00213   // TODO: exceptions, const volatile
00214   if (md->memberType()==MemberDef::Enumeration) // enum
00215   {
00216     LockingPtr<MemberList> enumList = md->enumFieldList();
00217     if (enumList!=0)
00218     {
00219       MemberListIterator emli(*enumList);
00220       MemberDef *emd;
00221       for (emli.toFirst();(emd=emli.current());++emli)
00222       {
00223         t << memPrefix << "enum = { enum-name = " << emd->name() << ';';
00224         if (!emd->initializer().isEmpty())
00225         {
00226           t << " enum-value = ";
00227           writeDEFString(t,emd->initializer());
00228           t << ';';
00229         }
00230         t << " };" << endl;
00231       }
00232     }
00233   }
00234 
00235   t << memPrefix << "desc-file = '" << md->getDefFileName() << "';" << endl;
00236   t << memPrefix << "desc-line = '" << md->getDefLine()     << "';" << endl;
00237   t << memPrefix << "briefdesc =    <<_EnD_oF_dEf_TeXt_"    << endl
00238     << md->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00239   t << memPrefix << "documentation = <<_EnD_oF_dEf_TeXt_"   << endl
00240     << md->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00241 
00242   //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers());
00243 
00244   LockingPtr<MemberSDict> mdict = md->getReferencesMembers();
00245   if (!mdict.isNull())
00246   {
00247     MemberSDict::Iterator mdi(*mdict);
00248     MemberDef *rmd;
00249     QCString refPrefix = "  " + memPrefix + "ref-";
00250 
00251     for (mdi.toFirst();(rmd=mdi.current());++mdi)
00252     {
00253       if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
00254       {
00255         t << memPrefix << "referenceto = {" << endl;
00256         t << refPrefix << "id = '"
00257           << rmd->getBodyDef()->getOutputFileBase()
00258           << "_1"   // encoded `:' character (see util.cpp:convertNameToFile)
00259           << rmd->anchor() << "';" << endl;
00260 
00261         t << refPrefix << "line = '"
00262           << rmd->getStartBodyLine() << "';" << endl;
00263 
00264         QCString scope = rmd->getScopeString();
00265         QCString name = rmd->name();
00266         if (!scope.isEmpty() && scope!=def->name())
00267         {
00268           name.prepend(scope+"::");
00269         }
00270 
00271         t << refPrefix << "name = ";
00272         writeDEFString(t,name);
00273         t << ';' << endl << "    };" << endl;
00274       }
00275     } /* for (mdi.toFirst...) */
00276   }
00277   mdict = md->getReferencedByMembers();
00278   if (!mdict.isNull())
00279   {
00280     MemberSDict::Iterator mdi(*mdict);
00281     MemberDef *rmd;
00282     QCString refPrefix = "  " + memPrefix + "ref-";
00283 
00284     for (mdi.toFirst();(rmd=mdi.current());++mdi)
00285     {
00286       if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
00287       {
00288         t << memPrefix << "referenceby = {" << endl;
00289         t << refPrefix << "id = '"
00290           << rmd->getBodyDef()->getOutputFileBase()
00291           << "_1"   // encoded `:' character (see util.cpp:convertNameToFile)
00292           << rmd->anchor() << "';" << endl;
00293 
00294         t << refPrefix << "line = '"
00295           << rmd->getStartBodyLine() << "';" << endl;
00296 
00297         QCString scope = rmd->getScopeString();
00298         QCString name = rmd->name();
00299         if (!scope.isEmpty() && scope!=def->name())
00300         {
00301           name.prepend(scope+"::");
00302         }
00303 
00304         t << refPrefix << "name = ";
00305         writeDEFString(t,name);
00306         t << ';' << endl << "    };" << endl;
00307       }
00308     } /* for (mdi.toFirst...) */
00309   }
00310 
00311   t << "    }; /* " << Prefix << "-member */" << endl;
00312 }
00313 
00314 
00315 void generateDEFClassSection(ClassDef *cd,
00316     QTextStream &t,
00317     MemberList *ml,
00318     const char *kind)
00319 {
00320   if (cd && ml && ml->count()>0)
00321   {
00322     t << "  cp-section = {" << endl;
00323     t << "    sec-kind = '" << kind << "';" << endl;
00324 
00325     MemberListIterator mli(*ml);
00326     MemberDef *md;
00327     for (mli.toFirst();(md=mli.current());++mli)
00328     {
00329       generateDEFForMember(md,t,cd,"sec");
00330     }
00331     t << "  }; /* cp-section */" << endl;
00332   }
00333 }
00334 
00335 void generateDEFForClass(ClassDef *cd,QTextStream &t)
00336 {
00337   // + brief description
00338   // + detailed description
00339   // - template arguments
00340   // - include files
00341   // + inheritance diagram
00342   // + list of direct super classes
00343   // + list of direct sub classes
00344   // + collaboration diagram
00345   // - list of all members
00346   // + user defined member sections
00347   // + standard member sections
00348   // + detailed member documentation
00349   // - examples
00350 
00351   if (cd->isReference()) return; // skip external references.
00352   if (cd->name().find('@')!=-1) return; // skip anonymous compounds.
00353   if (cd->templateMaster()!=0) return; // skip generated template instances.
00354 
00355   t << cd->compoundTypeString() << " = {" << endl;
00356   t << "  cp-id     = '" << cd->getOutputFileBase() << "';" << endl;
00357   t << "  cp-name   = '" << cd->name() << "';" << endl;
00358 
00359   if (cd->baseClasses())
00360   {
00361     BaseClassListIterator bcli(*cd->baseClasses());
00362     BaseClassDef *bcd;
00363     for (bcli.toFirst();(bcd=bcli.current());++bcli)
00364     {
00365       t << "  cp-ref     = {" << endl << "    ref-type = base;" << endl;
00366       t << "    ref-id   = '"
00367         << bcd->classDef->getOutputFileBase() << "';" << endl;
00368       t << "    ref-prot = ";
00369       switch (bcd->prot)
00370       {
00371         case Public:    t << "public;"    << endl; break;
00372         case Package: // package scope is not possible
00373         case Protected: t << "protected;" << endl; break;
00374         case Private:   t << "private;"   << endl; break;
00375       }
00376       t << "    ref-virt = ";
00377       switch(bcd->virt)
00378       {
00379         case Normal:  t << "non-virtual;";  break;
00380         case Virtual: t << "virtual;";      break;
00381         case Pure:    t << "pure-virtual;"; break;
00382       }
00383       t << endl << "  };" << endl;
00384     }
00385   }
00386 
00387   if (cd->subClasses())
00388   {
00389     BaseClassListIterator bcli(*cd->subClasses());
00390     BaseClassDef *bcd;
00391     for (bcli.toFirst();(bcd=bcli.current());++bcli)
00392     {
00393       t << "  cp-ref     = {" << endl << "    ref-type = derived;" << endl;
00394       t << "    ref-id   = '"
00395         << bcd->classDef->getOutputFileBase() << "';" << endl;
00396       t << "    ref-prot = ";
00397       switch (bcd->prot)
00398       {
00399         case Public:    t << "public;"    << endl; break;
00400         case Package: // packet scope is not possible!
00401         case Protected: t << "protected;" << endl; break;
00402         case Private:   t << "private;"   << endl; break;
00403       }
00404       t << "    ref-virt = ";
00405       switch(bcd->virt)
00406       {
00407         case Normal:  t << "non-virtual;";  break;
00408         case Virtual: t << "virtual;";      break;
00409         case Pure:    t << "pure-virtual;"; break;
00410       }
00411       t << endl << "  };" << endl;
00412     }
00413   }
00414 
00415   int numMembers = 0;
00416   QListIterator<MemberList> mli(cd->getMemberLists());
00417   MemberList *ml;
00418   for (mli.toFirst();(ml=mli.current());++mli)
00419   {
00420     if ((ml->listType()&MemberList::detailedLists)==0)
00421     {
00422       numMembers+=ml->count();
00423     }
00424   }
00425   if (numMembers>0)
00426   {
00427     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubTypes),"public-type");
00428     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubMethods),"public-func");
00429     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubAttribs),"public-attrib");
00430     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubSlots),"public-slot");
00431     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::signals),"signal");
00432     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::dcopMethods),"dcop-func");
00433     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::properties),"property");
00434     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubStaticMethods),"public-static-func");
00435     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::pubStaticAttribs),"public-static-attrib");
00436     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proTypes),"protected-type");
00437     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proMethods),"protected-func");
00438     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proAttribs),"protected-attrib");
00439     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proSlots),"protected-slot");
00440     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proStaticMethods),"protected-static-func");
00441     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::proStaticAttribs),"protected-static-attrib");
00442     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priTypes),"private-type");
00443     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priMethods),"private-func");
00444     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priAttribs),"private-attrib");
00445     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priSlots),"private-slot");
00446     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priStaticMethods),"private-static-func");
00447     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::priStaticAttribs),"private-static-attrib");
00448     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::friends),"signal");
00449     generateDEFClassSection(cd,t,cd->getMemberList(MemberList::related),"related");
00450   }
00451 
00452   t << "  cp-filename  = '" << cd->getDefFileName() << "';" << endl;
00453   t << "  cp-fileline  = '" << cd->getDefLine()     << "';" << endl;
00454   t << "  cp-briefdesc = <<_EnD_oF_dEf_TeXt_" << endl
00455     << cd->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00456 
00457   t << "  cp-documentation = <<_EnD_oF_dEf_TeXt_" << endl
00458     << cd->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00459 
00460   DotClassGraph inheritanceGraph(cd,DotNode::Inheritance);
00461   if (!inheritanceGraph.isTrivial())
00462   {
00463     t << "  cp-inheritancegraph = <<_EnD_oF_dEf_TeXt_" << endl;
00464     inheritanceGraph.writeDEF(t);
00465     t << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00466   }
00467   DotClassGraph collaborationGraph(cd,DotNode::Collaboration);
00468   if (!collaborationGraph.isTrivial())
00469   {
00470     t << "  cp-collaborationgraph = <<_EnD_oF_dEf_TeXt_" << endl;
00471     collaborationGraph.writeDEF(t);
00472     t << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00473   }
00474   t << "}; /* " <<  cd->compoundTypeString() << " */" << endl;
00475 }
00476 
00477 void generateDEFSection(Definition *d,
00478     QTextStream &t,
00479     MemberList *ml,
00480     const char *kind)
00481 {
00482   if (ml->count()>0)
00483   {
00484     t << "    " << kind << " = {" << endl;
00485     MemberListIterator mli(*ml);
00486     MemberDef *md;
00487     for (mli.toFirst();(md=mli.current());++mli)
00488     {
00489       generateDEFForMember(md,t,d,kind);
00490     }
00491     t << "    };" << endl;
00492   }
00493 }
00494 
00495 void generateDEFForNamespace(NamespaceDef *nd,QTextStream &t)
00496 {
00497   if (nd->isReference()) return; // skip external references
00498   t << "  namespace = {" << endl;
00499   t << "    ns-id   = '" << nd->getOutputFileBase() << "';" << endl;
00500   t << "    ns-name = ";
00501   writeDEFString(t,nd->name());
00502   t << ';' << endl;
00503 
00504   generateDEFSection(nd,t,nd->getMemberList(MemberList::decDefineMembers),"define");
00505   generateDEFSection(nd,t,nd->getMemberList(MemberList::decProtoMembers),"prototype");
00506   generateDEFSection(nd,t,nd->getMemberList(MemberList::decTypedefMembers),"typedef");
00507   generateDEFSection(nd,t,nd->getMemberList(MemberList::decEnumMembers),"enum");
00508   generateDEFSection(nd,t,nd->getMemberList(MemberList::decFuncMembers),"func");
00509   generateDEFSection(nd,t,nd->getMemberList(MemberList::decVarMembers),"var");
00510 
00511   t << "  ns-filename  = '" << nd->getDefFileName() << "';" << endl;
00512   t << "  ns-fileline  = '" << nd->getDefLine()     << "';" << endl;
00513   t << "  ns-briefdesc = <<_EnD_oF_dEf_TeXt_" << endl
00514     << nd->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00515 
00516   t << "  ns-documentation = <<_EnD_oF_dEf_TeXt_" << endl
00517     << nd->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00518   t << "  };" << endl;
00519 }
00520 
00521 void generateDEFForFile(FileDef *fd,QTextStream &t)
00522 {
00523   if (fd->isReference()) return; // skip external references
00524 
00525   t << "file = {" << endl;
00526   t << "  file-id   = '" << fd->getOutputFileBase() << "';" << endl;
00527   t << "  file-name = ";
00528   writeDEFString(t,fd->name());
00529   t << ';' << endl;
00530 
00531   generateDEFSection(fd,t,fd->getMemberList(MemberList::decDefineMembers),"define");
00532   generateDEFSection(fd,t,fd->getMemberList(MemberList::decProtoMembers),"prototype");
00533   generateDEFSection(fd,t,fd->getMemberList(MemberList::decTypedefMembers),"typedef");
00534   generateDEFSection(fd,t,fd->getMemberList(MemberList::decEnumMembers),"enum");
00535   generateDEFSection(fd,t,fd->getMemberList(MemberList::decFuncMembers),"func");
00536   generateDEFSection(fd,t,fd->getMemberList(MemberList::decVarMembers),"var");
00537 
00538   t << "  file-full-name  = '" << fd->getDefFileName() << "';" << endl;
00539   t << "  file-first-line = '" << fd->getDefLine()     << "';" << endl;
00540 
00541   t << "  file-briefdesc  = <<_EnD_oF_dEf_TeXt_" << endl
00542     << fd->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00543 
00544   t << "  file-documentation = <<_EnD_oF_dEf_TeXt_" << endl
00545     << fd->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
00546 
00547   t << "}; /* file */" << endl;
00548 }
00549 
00550 
00551 void generateDEF()
00552 {
00553   QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY");
00554   if (outputDirectory.isEmpty())
00555   {
00556     outputDirectory=QDir::currentDirPath();
00557   }
00558   else
00559   {
00560     QDir dir(outputDirectory);
00561     if (!dir.exists())
00562     {
00563       dir.setPath(QDir::currentDirPath());
00564       if (!dir.mkdir(outputDirectory))
00565       {
00566         err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
00567             "exist and cannot be created\n",outputDirectory.data());
00568         exit(1);
00569       }
00570       else if (!Config_getBool("QUIET"))
00571       {
00572         err("Notice: Output directory `%s' does not exist. "
00573             "I have created it for you.\n", outputDirectory.data());
00574       }
00575       dir.cd(outputDirectory);
00576     }
00577     outputDirectory=dir.absPath();
00578   }
00579 
00580   QDir dir(outputDirectory);
00581   if (!dir.exists())
00582   {
00583     dir.setPath(QDir::currentDirPath());
00584     if (!dir.mkdir(outputDirectory))
00585     {
00586       err("Cannot create directory %s\n",outputDirectory.data());
00587       return;
00588     }
00589   }
00590   QDir defDir(outputDirectory+"/def");
00591   if (!defDir.exists() && !defDir.mkdir(outputDirectory+"/def"))
00592   {
00593     err("Could not create def directory in %s\n",outputDirectory.data());
00594     return;
00595   }
00596 
00597   QCString fileName=outputDirectory+"/def/doxygen.def";
00598   QFile f(fileName);
00599   if (!f.open(IO_WriteOnly))
00600   {
00601     err("Cannot open file %s for writing!\n",fileName.data());
00602     return;
00603   }
00604   QTextStream t(&f);
00605   t << "AutoGen Definitions dummy;" << endl;
00606 
00607   if (Doxygen::classSDict->count()+Doxygen::inputNameList->count()>0)
00608   {
00609     ClassSDict::Iterator cli(*Doxygen::classSDict);
00610     ClassDef *cd;
00611     for (cli.toFirst();(cd=cli.current());++cli)
00612     {
00613       generateDEFForClass(cd,t);
00614     }
00615     FileNameListIterator fnli(*Doxygen::inputNameList);
00616     FileName *fn;
00617     for (;(fn=fnli.current());++fnli)
00618     {
00619       FileNameIterator fni(*fn);
00620       FileDef *fd;
00621       for (;(fd=fni.current());++fni)
00622       {
00623         generateDEFForFile(fd,t);
00624       }
00625     }
00626   }
00627   else
00628   {
00629     t << "dummy_value = true;" << endl;
00630   }
00631 }



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