pagedef.cpp

Go to the documentation of this file.
00001 #include "pagedef.h"
00002 #include "groupdef.h"
00003 #include "docparser.h"
00004 #include "config.h"
00005 #include "util.h"
00006 #include "outputlist.h"
00007 #include "doxygen.h"
00008 #include "language.h"
00009 
00010 
00011 PageDef::PageDef(const char *f,int l,const char *n,
00012                  const char *d,const char *t)
00013  : Definition(f,l,n), m_title(t)
00014 {
00015   setDocumentation(d,f,l);
00016   subPageDict = new PageSDict(7);
00017   pageScope = 0;
00018 }
00019 
00020 PageDef::~PageDef()
00021 {
00022   delete subPageDict;
00023 }
00024 
00025 void PageDef::findSectionsInDocumentation()
00026 {
00027   docFindSections(documentation(),this,0,docFile());
00028 }
00029 
00030 GroupDef *PageDef::getGroupDef() const 
00031 { 
00032   LockingPtr<GroupList> groups = partOfGroups();
00033   return groups!=0 ? groups->getFirst() : 0; 
00034 }
00035 
00036 QCString PageDef::getOutputFileBase() const 
00037 { 
00038   if (getGroupDef()) 
00039     return getGroupDef()->getOutputFileBase();
00040   else 
00041     return m_fileName; 
00042 }
00043 
00044 void PageDef::addInnerCompound(Definition *def)
00045 {
00046   if (def->definitionType()==Definition::TypePage)
00047   {
00048     PageDef *pd = (PageDef*)def;
00049     subPageDict->append(pd->name(),pd);
00050     def->setOuterScope(this);
00051   }
00052 }
00053 
00054 void PageDef::writeDocumentation(OutputList &ol)
00055 {
00056   //outputList->disable(OutputGenerator::Man);
00057   QCString pageName;
00058   if (Config_getBool("CASE_SENSE_NAMES"))
00059     pageName=name();
00060   else
00061     pageName=name().lower();
00062 
00063   startFile(ol,pageName,pageName,title(),HLI_None,TRUE);
00064 
00065   if (getOuterScope()!=Doxygen::globalScope && !Config_getBool("DISABLE_INDEX"))
00066   {
00067     getOuterScope()->writeNavigationPath(ol);
00068   }
00069 
00070   ol.endQuickIndices();
00071   ol.startContents();
00072 
00073   // save old generator state and write title only to Man generator
00074   ol.pushGeneratorState();
00075   ol.disableAllBut(OutputGenerator::Man);
00076   ol.startTitleHead(pageName);
00077   ol.endTitleHead(pageName, pageName);
00078   ol.popGeneratorState();
00079 
00080   // for Latex the section is already generated as a chapter in the index!
00081   ol.pushGeneratorState();
00082   ol.disable(OutputGenerator::Latex);
00083   SectionInfo *si=0;
00084   if (!title().isEmpty() && !name().isEmpty() &&
00085       (si=Doxygen::sectionDict.find(pageName))!=0)
00086   {
00087     ol.startSection(si->label,si->title,si->type);
00088     ol.parseDoc(docFile(),docLine(),this,0,si->title,TRUE,FALSE);
00089     stringToSearchIndex(getOutputFileBase(),
00090                         theTranslator->trPage(TRUE,TRUE)+" "+si->title,
00091                         si->title);
00092     ol.endSection(si->label,si->type);
00093   }
00094   ol.popGeneratorState();
00095 
00096   ol.startTextBlock();
00097   ol.parseDoc(docFile(),       // fileName
00098       docLine(),           // startLine
00099       this,                // context
00100       0,                   // memberdef
00101       documentation(),     // docStr
00102       TRUE,                // index words
00103       FALSE                // not an example
00104       );
00105   ol.endTextBlock();
00106   endFile(ol);
00107   //outputList->enable(OutputGenerator::Man);
00108 
00109   if (!Config_getString("GENERATE_TAGFILE").isEmpty())
00110   {
00111     bool found=FALSE;
00112     QDictIterator<RefList> rli(*Doxygen::xrefLists);
00113     RefList *rl;
00114     for (rli.toFirst();(rl=rli.current());++rli)
00115     {
00116       if (rl->listName()==name())
00117       {
00118         found=TRUE;
00119         break;
00120       }
00121     }
00122     if (!found) // not one of the generated related pages
00123     {
00124       Doxygen::tagFile << "  <compound kind=\"page\">" << endl;
00125       Doxygen::tagFile << "    <name>" << name() << "</name>" << endl;
00126       Doxygen::tagFile << "    <title>" << convertToXML(title()) << "</title>" << endl;
00127       Doxygen::tagFile << "    <filename>" << getOutputFileBase() << "</filename>" << endl;
00128       writeDocAnchorsToTagFile();
00129       Doxygen::tagFile << "  </compound>" << endl;
00130     }
00131   }
00132 }
00133 
00134 bool PageDef::visibleInIndex() const
00135 {
00136    return // not part of a group
00137           !getGroupDef() && 
00138           // not an externally defined page
00139           (!isReference() || Config_getBool("ALLEXTERNALS")) &&
00140           // not a subpage
00141           (getOuterScope()==0 || 
00142            getOuterScope()->definitionType()!=Definition::TypePage
00143           );
00144 }
00145 
00146 bool PageDef::documentedPage() const
00147 {
00148    return // not part of a group
00149           !getGroupDef() && 
00150           // not an externally defined page
00151           !isReference();
00152 }
00153 
00154 bool PageDef::hasSubPages() const
00155 {
00156   return subPageDict->count()>0;
00157 }
00158 
00159 



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