summaryrefslogtreecommitdiffstats
path: root/src/pagedef.cpp
blob: ec1627617750ac5280c8a4f72595f246bbac9e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "pagedef.h"
#include "groupdef.h"
#include "docparser.h"
#include "config.h"
#include "util.h"
#include "outputlist.h"
#include "doxygen.h"


PageDef::PageDef(const char *f,int l,const char *n,
                 const char *d,const char *t)
 : Definition(f,l,n), m_title(t)
{
  setDocumentation(d,f,l);
  subPageDict = new PageSDict(7);
}

PageDef::~PageDef()
{
  delete subPageDict;
}

void PageDef::findSectionsInDocumentation()
{
  docFindSections(documentation(),this,0,docFile());
}

GroupDef *PageDef::getGroupDef() const 
{ 
  return partOfGroups() ? partOfGroups()->getFirst() : 0; 
}

QCString PageDef::getOutputFileBase() const 
{ 
  if (getGroupDef()) 
    return getGroupDef()->getOutputFileBase();
  else 
    return m_fileName; 
}

void PageDef::addInnerCompound(Definition *def)
{
  if (def->definitionType()==Definition::TypePage)
  {
    PageDef *pd = (PageDef*)def;
    subPageDict->append(pd->name(),pd);
    def->setOuterScope(this);
  }
}

void PageDef::writeDocumentation(OutputList &ol)
{
  //outputList->disable(OutputGenerator::Man);
  QCString pageName;
  if (Config_getBool("CASE_SENSE_NAMES"))
    pageName=name();
  else
    pageName=name().lower();

  startFile(ol,pageName,pageName,title());

  if (getOuterScope()!=Doxygen::globalScope && !Config_getBool("DISABLE_INDEX"))
  {
    getOuterScope()->writeNavigationPath(ol);
  }

  // save old generator state and write title only to Man generator
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Man);
  ol.startTitleHead(pageName);
  ol.endTitleHead(pageName, pageName);
  ol.popGeneratorState();

  SectionInfo *si=0;
  if (!title().isEmpty() && !name().isEmpty() &&
      (si=Doxygen::sectionDict.find(pageName))!=0)
  {
    ol.startSection(si->label,si->title,si->type);
    ol.docify(si->title);
    ol.endSection(si->label,si->type);
  }
  ol.startTextBlock();
  ol.parseDoc(docFile(),       // fileName
      docLine(),           // startLine
      this,                // context
      0,                   // memberdef
      documentation(),     // docStr
      TRUE,                // index words
      FALSE                // not an example
      );
  ol.endTextBlock();
  endFile(ol);
  //outputList->enable(OutputGenerator::Man);

  if (!Config_getString("GENERATE_TAGFILE").isEmpty())
  {
    bool found=FALSE;
    QDictIterator<RefList> rli(*Doxygen::xrefLists);
    RefList *rl;
    for (rli.toFirst();(rl=rli.current());++rli)
    {
      if (rl->listName()==name())
      {
        found=TRUE;
        break;
      }
    }
    if (!found) // not one of the generated related pages
    {
      Doxygen::tagFile << "  <compound kind=\"page\">" << endl;
      Doxygen::tagFile << "    <name>" << name() << "</name>" << endl;
      Doxygen::tagFile << "    <title>" << convertToXML(title()) << "</title>" << endl;
      Doxygen::tagFile << "    <filename>" << getOutputFileBase() << "</filename>" << endl;
      writeDocAnchorsToTagFile();
      Doxygen::tagFile << "  </compound>" << endl;
    }
  }
}