classlist.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: classlist.cpp,v 1.14 2001/03/19 19:27:39 root Exp $
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  * Documents produced by Doxygen are derivative works derived from the
00014  * input used in their production; they are not affected by this license.
00015  *
00016  */
00017 
00018 #include "classlist.h"
00019 #include "config.h"
00020 #include "util.h"
00021 #include "outputlist.h"
00022 #include "language.h"
00023 #include "doxygen.h"
00024 #include "vhdldocgen.h"
00025 
00026 ClassList::ClassList() : QList<ClassDef>()
00027 {
00028 }
00029 
00030 ClassList::~ClassList()
00031 {
00032 }
00033 
00034 static int compItems(void *item1,void *item2)
00035 {
00036   ClassDef *c1=(ClassDef *)item1;
00037   ClassDef *c2=(ClassDef *)item2;
00038   static bool b = Config_getBool("SORT_BY_SCOPE_NAME");
00039   //printf("compItems: %d %s<->%s\n",b,c1->qualifiedName().data(),c2->qualifiedName().data());
00040   if (b) 
00041   { 
00042      return stricmp(c1->name(),
00043                     c2->name());
00044   }
00045   else
00046   {
00047      return stricmp(c1->className(),
00048                     c2->className());
00049   }
00050 }
00051 
00052 int ClassList::compareItems(GCI item1, GCI item2)
00053 {
00054   return compItems(item1,item2);
00055 }
00056 
00057 int ClassSDict::compareItems(GCI item1, GCI item2)
00058 {
00059   return compItems(item1,item2);
00060 }
00061 
00062 ClassListIterator::ClassListIterator(const ClassList &cllist) :
00063   QListIterator<ClassDef>(cllist)
00064 {
00065 }
00066 
00067 void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,
00068                                   const char *header,bool localNames)
00069 {
00070   static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
00071   static bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
00072   if (count()>0)
00073   {
00074     ClassSDict::Iterator sdi(*this);
00075     ClassDef *cd=0;
00076     bool found=FALSE;
00077     for (sdi.toFirst();(cd=sdi.current());++sdi)
00078     {
00079       if (cd->name().find('@')==-1 && 
00080           (filter==0 || *filter==cd->compoundType())
00081          )
00082       {
00083         bool isLink = cd->isLinkable();
00084         if (isLink || 
00085              (!Config_getBool("HIDE_UNDOC_CLASSES") && 
00086               (!cd->isLocal() || Config_getBool("EXTRACT_LOCAL_CLASSES"))
00087              )
00088            )
00089         {
00090           if (!found)
00091           {
00092             ol.startMemberHeader();
00093             if (header)
00094             {
00095               ol.parseText(header);
00096             }
00097             else if (vhdlOpt)
00098             {
00099               ol.parseText(VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE));
00100             }
00101             else
00102             {
00103               ol.parseText(fortranOpt ? theTranslator->trDataTypes() :
00104                                         theTranslator->trCompounds());
00105             }
00106             ol.endMemberHeader();
00107             ol.startMemberList();
00108             found=TRUE;
00109           }
00110           if (!Config_getString("GENERATE_TAGFILE").isEmpty() &&
00111               !cd->isReference())  // skip classes found in tag files
00112           {
00113             Doxygen::tagFile << "    <class kind=\"" << cd->compoundTypeString() 
00114               << "\">" << convertToXML(cd->name()) << "</class>" << endl;
00115           }
00116           ol.startMemberItem(FALSE);
00117           QCString tmp = cd->compoundTypeString();
00118           QCString cname;
00119           if (localNames)
00120           {
00121             cname = cd->localName();
00122           }
00123           else
00124           {
00125             cname = cd->displayName();
00126           }
00127 
00128           if (!vhdlOpt) // for VHDL we swap the name and the type
00129           {
00130             ol.writeString(tmp);
00131             ol.writeString(" ");
00132             ol.insertMemberAlign();
00133           }
00134           if (isLink) 
00135           {
00136             ol.writeObjectLink(cd->getReference(),
00137                 cd->getOutputFileBase(),
00138                 0,
00139                 cname
00140                 );
00141           }
00142           else 
00143           {
00144             ol.startBold();
00145             ol.docify(cname);
00146             ol.endBold();
00147           }
00148           if (vhdlOpt) // now write the type
00149           {
00150             ol.insertMemberAlign();
00151             VhdlDocGen::writeClassType(cd,ol,cname);
00152           }
00153           ol.endMemberItem();
00154           if (!cd->briefDescription().isEmpty())
00155           {
00156             ol.startMemberDescription();
00157             ol.parseDoc(cd->briefFile(),cd->briefLine(),cd,0,
00158                 cd->briefDescription(),FALSE,FALSE);
00159             if (//(!cd->briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
00161                 cd->isLinkableInProject()
00162                 )
00163             {
00164               ol.pushGeneratorState();
00165               ol.disableAllBut(OutputGenerator::Html);
00166               //ol.endEmphasis();
00167               ol.docify(" ");
00168               ol.startTextLink(cd->getOutputFileBase(),"_details");
00169               ol.parseText(theTranslator->trMore());
00170               ol.endTextLink();
00171               //ol.startEmphasis();
00172               ol.popGeneratorState();
00173             }
00174             ol.endMemberDescription();
00175           }
00176         }
00177       }
00178     }
00179     if (found) ol.endMemberList();
00180   }
00181 }
00182   



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