index.cpp 112 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4
 *
5
 * Copyright (C) 1997-2008 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6 7 8 9 10 11 12
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
13 14
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
15 16 17
 *
 */

18 19 20 21
/** @file
 *  @brief This file contains functions for the various index pages.
 */

Dimitri van Heesch's avatar
Dimitri van Heesch committed
22 23
#include <stdlib.h>

24 25 26
#include <qtextstream.h>
#include <qdatetime.h>
#include <qdir.h>
27
#include <qregexp.h>
28

Dimitri van Heesch's avatar
Dimitri van Heesch committed
29 30 31 32 33 34 35 36 37
#include "message.h"
#include "index.h"
#include "doxygen.h"
#include "config.h"
#include "filedef.h"
#include "outputlist.h"
#include "util.h"
#include "groupdef.h"
#include "language.h"
38
#include "htmlgen.h"
39
#include "htmlhelp.h"
40
#include "ftvhelp.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
41
#include "dot.h"
42
#include "pagedef.h"
43
#include "dirdef.h"
44
#include "vhdldocgen.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
45

46 47 48
#define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
#define MAX_ITEMS_BEFORE_QUICK_INDEX 30

49 50 51 52 53 54 55 56
static const char search_styleSheet[] =
#include "search_css.h"
;

static const char search_script[]=
#include "search_js.h"
;

57 58 59 60 61 62 63 64 65
int annotatedClasses;
int hierarchyClasses;
int documentedFiles;
int documentedGroups;
int documentedNamespaces;
int indexedPages;
int documentedClassMembers[CMHL_Total];
int documentedFileMembers[FMHL_Total];
int documentedNamespaceMembers[NMHL_Total];
66 67
int documentedHtmlFiles;
int documentedPages;
68
int documentedDirs;
69 70

int countClassHierarchy();
71 72
int countClassMembers(int filter=CMHL_All);
int countFileMembers(int filter=FMHL_All);
73 74
void countFiles(int &htmlFiles,int &files);
int countGroups();
75
int countDirs();
76 77
int countNamespaces();
int countAnnotatedClasses();
78
int countNamespaceMembers(int filter=NMHL_All);
79
int countIncludeFiles();
80
void countRelatedPages(int &docPages,int &indexPages);
81 82 83 84 85 86

void countDataStructures()
{
  annotatedClasses           = countAnnotatedClasses();
  hierarchyClasses           = countClassHierarchy();
  countFiles(documentedHtmlFiles,documentedFiles);
87
  countRelatedPages(documentedPages,indexedPages);
88 89
  documentedGroups           = countGroups();
  documentedNamespaces       = countNamespaces();
90
  documentedDirs             = countDirs();
91 92
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
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
static void startIndexHierarchy(OutputList &ol,int level)
{
  ol.pushGeneratorState();
  ol.disable(OutputGenerator::Man);
  ol.disable(OutputGenerator::Html);
  if (level<6) ol.startIndexList();
  ol.enableAll();
  ol.disable(OutputGenerator::Latex);
  ol.disable(OutputGenerator::RTF);
  ol.startItemList();
  ol.popGeneratorState();
}

static void endIndexHierarchy(OutputList &ol,int level)
{
  ol.pushGeneratorState();
  ol.disable(OutputGenerator::Man);
  ol.disable(OutputGenerator::Html);
  if (level<6) ol.endIndexList();
  ol.enableAll();
  ol.disable(OutputGenerator::Latex);
  ol.disable(OutputGenerator::RTF);
  ol.endItemList();
  ol.popGeneratorState();
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
119 120
//----------------------------------------------------------------------------

121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
class MemberIndexList : public QList<MemberDef>
{
  public:
    MemberIndexList() : QList<MemberDef>() {}
    ~MemberIndexList() {}
    int compareItems(GCI item1, GCI item2)
    {
      MemberDef *md1=(MemberDef *)item1;
      MemberDef *md2=(MemberDef *)item2;
      return stricmp(md1->name(),md2->name());
    }
};

#define MEMBER_INDEX_ENTRIES 128

static MemberIndexList g_memberIndexLetterUsed[CMHL_Total][MEMBER_INDEX_ENTRIES];
static MemberIndexList g_fileIndexLetterUsed[FMHL_Total][MEMBER_INDEX_ENTRIES];
static MemberIndexList g_namespaceIndexLetterUsed[NMHL_Total][MEMBER_INDEX_ENTRIES];

140
static bool g_classIndexLetterUsed[CHL_Total][256];
Dimitri van Heesch's avatar
Dimitri van Heesch committed
141

142
const int maxItemsBeforeQuickIndex = MAX_ITEMS_BEFORE_QUICK_INDEX;
143

144 145
//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
146
// strips w from s iff s starts with w
147
bool stripWord(QCString &s,QCString w)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
148 149 150 151 152 153 154 155 156 157 158 159
{
  bool success=FALSE;
  if (s.left(w.length())==w) 
  {
    success=TRUE;
    s=s.right(s.length()-w.length());
  }
  return success;
}

//----------------------------------------------------------------------------
// some quasi intelligent brief description abbreviator :^)
160
QCString abbreviate(const char *s,const char *name)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
161
{
162 163
  QCString scopelessName=name;
  int i=scopelessName.findRev("::");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
164
  if (i!=-1) scopelessName=scopelessName.mid(i+2);
165
  QCString result=s;
166
  result=result.stripWhiteSpace();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
167
  // strip trailing .
Dimitri van Heesch's avatar
Dimitri van Heesch committed
168
  if (!result.isEmpty() && result.at(result.length()-1)=='.') 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
169
    result=result.left(result.length()-1);
170 171

  // strip any predefined prefix
172
  QStrList &briefDescAbbrev = Config_getList("ABBREVIATE_BRIEF");
173 174
  const char *p = briefDescAbbrev.first();
  while (p)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
175
  {
176 177 178 179 180
    QCString s = p;
    s.replace(QRegExp("\\$name"), scopelessName);  // replace $name with entity name
    s += " ";
    stripWord(result,s);
    p = briefDescAbbrev.next();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
181
  }
182 183

  // capitalize first word
Dimitri van Heesch's avatar
Dimitri van Heesch committed
184
  if (!result.isEmpty())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
185 186 187 188 189 190 191 192 193 194
  {
    int c=result[0];
    if (c>='a' && c<='z') c+='A'-'a';
    result[0]=c;
  }
  return result;
}

//----------------------------------------------------------------------------

195 196 197 198 199
static void startQuickIndexList(OutputList &ol)
{
  bool fancyTabs = TRUE;
  if (fancyTabs)
  {
200 201
    ol.writeString("  <div class=\"tabs\">\n"); 
    ol.writeString("    <ul>\n"); 
202 203 204
  }
  else
  {
205
    ol.writeString("  <div class=\"qindex\">"); 
206 207 208 209 210 211 212 213
  }
}

static void endQuickIndexList(OutputList &ol)
{
  bool fancyTabs = TRUE;
  if (fancyTabs)
  {
214
    ol.writeString("    </ul>\n");
215
  }
216
  ol.writeString("  </div>\n");
217 218
}

219
static void startQuickIndexItem(OutputList &ol,const char *l,
220
                                bool hl,bool compact,bool &first)
221
{
222 223
  bool fancyTabs = TRUE;
  if (!first && compact && !fancyTabs) ol.writeString(" | ");
224
  first=FALSE;
225
  if (fancyTabs)
226
  {
227
    ol.writeString("      <li"); 
228
    if (hl) ol.writeString(" class=\"current\"");
229
    ol.writeString("><a ");
230
  }
231
  else
232
  {
233 234 235 236 237 238 239 240 241
    if (!compact) ol.writeString("<li>");
    if (hl && compact)
    {
      ol.writeString("<a class=\"qindexHL\" ");
    }
    else
    {
      ol.writeString("<a class=\"qindex\" ");
    }
242 243 244 245
  }
  ol.writeString("href=\""); 
  ol.writeString(l);
  ol.writeString("\">");
246 247 248 249
  if (fancyTabs)
  {
    ol.writeString("<span>");
  }
250 251 252 253
}

static void endQuickIndexItem(OutputList &ol)
{
254 255
  bool fancyTabs=TRUE;
  if (fancyTabs) ol.writeString("</span>");
256
  ol.writeString("</a>");
257
  if (fancyTabs) ol.writeString("</li>\n");
258 259
}

260

261 262 263 264 265
static QCString fixSpaces(const QCString &s)
{
  return substitute(s," ","&nbsp;");
}

266 267 268 269

void startTitle(OutputList &ol,const char *fileName)
{
  ol.startTitleHead(fileName);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
270 271
  ol.pushGeneratorState();
  ol.disable(OutputGenerator::Man);
272 273 274 275
}

void endTitle(OutputList &ol,const char *fileName,const char *name)
{
Dimitri van Heesch's avatar
Dimitri van Heesch committed
276
  ol.popGeneratorState();
277 278 279
  ol.endTitleHead(fileName,name);
}

280
void startFile(OutputList &ol,const char *name,const char *manName,
281
               const char *title,HighlightedItem hli,bool additionalIndices)
282
{
283
  ol.startFile(name,manName,title);
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
  if (!Config_getBool("DISABLE_INDEX")) 
  {
    ol.startQuickIndices();
    ol.writeQuickLinks(TRUE,hli);
    if (!additionalIndices)
    {
      ol.endQuickIndices();
      ol.startContents();
    }
  }
  else
  {
    if (!additionalIndices)
    {
      ol.startContents();
    }
  }
301 302
}

303
void endFile(OutputList &ol,bool)
304
{
305
  ol.endContents();
306 307
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);
308
  ol.writeFooter(); // write the footer
309 310 311 312 313 314
  ol.popGeneratorState();
  ol.endFile();
}

//----------------------------------------------------------------------------

315 316
static bool classHasVisibleChildren(ClassDef *cd)
{
317
  if (cd->subClasses()==0) return FALSE;
318 319 320 321 322 323 324 325 326 327 328 329
  BaseClassList *bcl=cd->subClasses();
  BaseClassListIterator bcli(*bcl);
  for ( ; bcli.current() ; ++bcli)
  {
    if (bcli.current()->classDef->isVisibleInHierarchy())
    {
      return TRUE;
    }
  }
  return FALSE;
}

330
void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level,FTVHelp* ftv)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
331
{
332
  if (bcl==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
333 334 335 336 337
  BaseClassListIterator bcli(*bcl);
  bool started=FALSE;
  for ( ; bcli.current() ; ++bcli)
  {
    ClassDef *cd=bcli.current()->classDef;
338
    if (cd->isVisibleInHierarchy() && hasVisibleRoot(cd->baseClasses()))
Dimitri van Heesch's avatar
Dimitri van Heesch committed
339 340 341
    {
      if (!started)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
342
        startIndexHierarchy(ol,level);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
343
        Doxygen::indexList.incContentsDepth();
344 345
        if (ftv)
          ftv->incContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
346 347
        started=TRUE;
      }
348
      ol.startIndexListItem();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
349
      //printf("Passed...\n");
350 351
      bool hasChildren = !cd->visited && !hideSuper && classHasVisibleChildren(cd);
      //printf("tree4: Has children %s: %d\n",cd->name().data(),hasChildren);
352
      if (cd->isLinkable())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
353
      {
354
        //printf("Writing class %s\n",cd->displayName().data());
355 356 357
        ol.startIndexItem(cd->getReference(),cd->getOutputFileBase());
        ol.parseText(cd->displayName());
        ol.endIndexItem(cd->getReference(),cd->getOutputFileBase());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
358 359 360 361 362 363
        if (cd->isReference()) 
        { 
          ol.startTypewriter(); 
          ol.docify(" [external]");
          ol.endTypewriter();
        }
364 365 366
        Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
        if (ftv)
          ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
367 368 369
      }
      else
      {
370 371 372
        ol.startIndexItem(0,0);
        ol.parseText(cd->name());
        ol.endIndexItem(0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
373
        Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),0,0,0);
374 375
        if (ftv)
          ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
376
      }
377
      if (hasChildren)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
378
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
379 380
        //printf("Class %s at %p visited=%d\n",cd->name().data(),cd,cd->visited);
        bool wasVisited=cd->visited;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
381
        cd->visited=TRUE;
382
        writeClassTree(ol,cd->subClasses(),wasVisited,level+1,ftv);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
383
      }
384
      ol.endIndexListItem();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
385 386
    }
  }
387 388
  if (started) 
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
389
    endIndexHierarchy(ol,level);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
390
    Doxygen::indexList.decContentsDepth();
391 392
    if (ftv)
      ftv->decContentsDepth();
393 394 395 396 397 398 399
  }
}


//----------------------------------------------------------------------------
/*! Generates HTML Help tree of classes */

Dimitri van Heesch's avatar
Dimitri van Heesch committed
400
void writeClassTree(BaseClassList *cl,int level)
401
{
402
  if (cl==0) return;
403 404 405 406 407
  BaseClassListIterator cli(*cl);
  bool started=FALSE;
  for ( ; cli.current() ; ++cli)
  {
    ClassDef *cd=cli.current()->classDef;
408 409
    if (cd->isVisibleInHierarchy() && hasVisibleRoot(cd->baseClasses()))
    //if (cd->isVisibleInHierarchy() && !cd->visited)
410 411 412
    {
      if (!started)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
413
        Doxygen::indexList.incContentsDepth();
414 415
        started=TRUE;
      }
416 417
      bool hasChildren = !cd->visited && classHasVisibleChildren(cd);
      //printf("tree2: Has children %s: %d\n",cd->name().data(),hasChildren);
418
      if (cd->isLinkable())
419
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
420
        Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
421 422 423
      }
      if (hasChildren)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
424
        writeClassTree(cd->subClasses(),level+1);
425 426 427 428 429 430
      }
      cd->visited=TRUE;
    }
  }
  if (started) 
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
431
    Doxygen::indexList.decContentsDepth();
432 433 434 435 436 437
  }
}

//----------------------------------------------------------------------------
/*! Generates HTML Help tree of classes */

Dimitri van Heesch's avatar
Dimitri van Heesch committed
438
void writeClassTreeNode(ClassDef *cd,bool &started,int level)
439
{
440 441 442 443
  //printf("writeClassTreeNode(%s) visited=%d\n",cd->name().data(),cd->visited);
  if (cd->isVisibleInHierarchy() && !cd->visited)
  {
    if (!started)
444
    {
445 446 447 448
      started=TRUE;
    }
    bool hasChildren = classHasVisibleChildren(cd);
    //printf("node: Has children %s: %d\n",cd->name().data(),hasChildren);
449
    if (cd->isLinkable())
450
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
451
      Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
452
    }
453 454 455 456 457 458
    if (hasChildren)
    {
      writeClassTree(cd->subClasses(),level+1);
    }
    cd->visited=TRUE;
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
459 460
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
461
void writeClassTree(ClassList *cl,int level)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
462
{
463
  if (cl==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
464 465
  ClassListIterator cli(*cl);
  bool started=FALSE;
466 467 468 469 470
  for ( cli.toFirst() ; cli.current() ; ++cli)
  {
    cli.current()->visited=FALSE;
  }
  for ( cli.toFirst() ; cli.current() ; ++cli)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
471
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
472
    writeClassTreeNode(cli.current(),started,level);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
473 474 475
  }
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
476
void writeClassTree(ClassSDict *d,int level)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
477
{
478
  if (d==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
479 480
  ClassSDict::Iterator cli(*d);
  bool started=FALSE;
481 482 483 484 485
  for ( cli.toFirst() ; cli.current() ; ++cli)
  {
    cli.current()->visited=FALSE;
  }
  for ( cli.toFirst() ; cli.current() ; ++cli)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
486
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
487
    writeClassTreeNode(cli.current(),started,level);
488
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
489 490 491 492
}

//----------------------------------------------------------------------------

493
static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FTVHelp* ftv)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
494
{
495
  ClassSDict::Iterator cli(*cl);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
496 497 498
  for (;cli.current(); ++cli)
  {
    ClassDef *cd=cli.current();
499 500 501 502 503
    //printf("class %s hasVisibleRoot=%d isVisibleInHierarchy=%d\n",
    //             cd->name().data(),
    //              hasVisibleRoot(cd->baseClasses()),
    //              cd->isVisibleInHierarchy()
    //      );
Dimitri van Heesch's avatar
Dimitri van Heesch committed
504
    if (!hasVisibleRoot(cd->baseClasses())) // filter on root classes
Dimitri van Heesch's avatar
Dimitri van Heesch committed
505
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
506
      if (cd->isVisibleInHierarchy()) // should it be visible
Dimitri van Heesch's avatar
Dimitri van Heesch committed
507 508 509
      {
        if (!started)
        {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
510
          startIndexHierarchy(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
511
          Doxygen::indexList.incContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
512 513
          started=TRUE;
        }
514
        ol.startIndexListItem();
515 516
        bool hasChildren = !cd->visited && classHasVisibleChildren(cd); 
        //printf("list: Has children %s: %d\n",cd->name().data(),hasChildren);
517
        if (cd->isLinkable())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
518
        {
519 520
          //printf("Writing class %s isLinkable()=%d isLinkableInProject()=%d cd->templateMaster()=%p\n",
          //    cd->displayName().data(),cd->isLinkable(),cd->isLinkableInProject(),cd->templateMaster());
521 522 523
          ol.startIndexItem(cd->getReference(),cd->getOutputFileBase());
          ol.parseText(cd->displayName());
          ol.endIndexItem(cd->getReference(),cd->getOutputFileBase());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
524 525 526 527 528 529
          if (cd->isReference()) 
          {
            ol.startTypewriter(); 
            ol.docify(" [external]");
            ol.endTypewriter();
          }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
530
          Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
531 532
          if (ftv)
            ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
533 534 535
        }
        else
        {
536 537 538
          ol.startIndexItem(0,0);
          ol.parseText(cd->displayName());
          ol.endIndexItem(0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
539
          Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),0,0,0);
540 541
          if (ftv)
            ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
542
        }
543
        if (hasChildren) 
544
        {
545
          writeClassTree(ol,cd->subClasses(),cd->visited,1,ftv);
546 547
          cd->visited=TRUE;
        }
548
        ol.endIndexListItem();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
549 550 551
      }
    }
  }
552 553
}

554
void writeClassHierarchy(OutputList &ol, FTVHelp* ftv)
555
{
556 557
  initClassHierarchy(Doxygen::classSDict);
  initClassHierarchy(Doxygen::hiddenClasses);
558 559 560 561 562
  if (ftv)
  {
    ol.pushGeneratorState(); 
    ol.disable(OutputGenerator::Html);
  }
563
  bool started=FALSE;
564 565
  writeClassTreeForList(ol,Doxygen::classSDict,started,ftv);
  writeClassTreeForList(ol,Doxygen::hiddenClasses,started,ftv);
566 567
  if (started) 
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
568
    endIndexHierarchy(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
569
    Doxygen::indexList.decContentsDepth();
570
  }
571 572
  if (ftv)
    ol.popGeneratorState(); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
573 574 575 576
}

//----------------------------------------------------------------------------

577 578 579 580 581 582 583 584 585 586 587
static int countClassesInTreeList(const ClassSDict &cl)
{
  int count=0;
  ClassSDict::Iterator cli(cl);
  for (;cli.current(); ++cli)
  {
    ClassDef *cd=cli.current();
    if (!hasVisibleRoot(cd->baseClasses())) // filter on root classes
    {
      if (cd->isVisibleInHierarchy()) // should it be visible
      {
588
        if (cd->subClasses()) // should have sub classes
Dimitri van Heesch's avatar
Dimitri van Heesch committed
589 590 591
        {
          count++;
        }
592 593 594 595 596 597
      }
    }
  }
  return count;
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
598 599
int countClassHierarchy()
{
600
  int count=0;
601 602 603 604
  initClassHierarchy(Doxygen::classSDict);
  initClassHierarchy(Doxygen::hiddenClasses);
  count+=countClassesInTreeList(*Doxygen::classSDict);
  count+=countClassesInTreeList(*Doxygen::hiddenClasses);
605
  return count;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
606 607 608 609 610 611
}

//----------------------------------------------------------------------------

void writeHierarchicalIndex(OutputList &ol)
{
612
  bool vhdlOpt=Config_getBool("OPTIMIZE_OUTPUT_VHDL");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
613
  if (hierarchyClasses==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
614
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
615
  ol.disable(OutputGenerator::Man);
616 617
  startFile(ol,"hierarchy",0, theTranslator->trHierarchicalIndex().data(), 
            HLI_Hierarchy);
618
  startTitle(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
619
  QCString title = theTranslator->trClassHierarchy();
620 621 622 623 624
  if (vhdlOpt) title = VhdlDocGen::trDesignUnitHierarchy();
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
625
  ol.parseText(title);
626
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
627
  ol.startTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
628
  Doxygen::indexList.addContentsItem(TRUE,title,0,"hierarchy",0); 
629
  if (Config_getBool("HAVE_DOT") && Config_getBool("GRAPHICAL_HIERARCHY"))
Dimitri van Heesch's avatar
Dimitri van Heesch committed
630 631 632
  {
    ol.disable(OutputGenerator::Latex);
    ol.disable(OutputGenerator::RTF);
633
    ol.startParagraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
634
    ol.startTextLink("inherits",0);
635
    ol.parseText(theTranslator->trGotoGraphicalHierarchy());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
636
    ol.endTextLink();
637
    ol.endParagraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
638 639 640
    ol.enable(OutputGenerator::Latex);
    ol.enable(OutputGenerator::RTF);
  }
641
  ol.parseText(theTranslator->trClassHierarchyDescription());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
642
  ol.endTextBlock();
643

644 645 646
  FTVHelp* ftv = 0;
  bool treeView=Config_getBool("USE_INLINE_TREES");
  if (treeView)
647 648 649 650 651 652 653 654 655 656 657 658 659 660
    ftv = new FTVHelp(false);

  writeClassHierarchy(ol,ftv);

  if (ftv)
  {
    QString OutStr;
    ftv->generateTreeView(&OutStr);
    ol.pushGeneratorState(); 
    ol.disableAllBut(OutputGenerator::Html);
    ol.writeString(OutStr);
    ol.popGeneratorState();
    delete ftv;
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
661
  endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
662 663 664 665 666 667 668 669 670 671
  ol.popGeneratorState();
}

//----------------------------------------------------------------------------

void writeGraphicalClassHierarchy(OutputList &ol)
{
  if (hierarchyClasses==0) return;
  ol.disableAllBut(OutputGenerator::Html);
  QCString title = theTranslator->trGraphicalHierarchy();
672
  startFile(ol,"inherits",0,title.data(),HLI_Hierarchy);
673
  startTitle(ol,0);
674 675 676 677
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
678
  ol.parseText(title);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
679 680
  endTitle(ol,0,0);
  ol.startTextBlock();
681
  Doxygen::indexList.addContentsItem(FALSE,theTranslator->trGraphicalHierarchy(),0,"inherits",0); 
682
  ol.startParagraph();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
683
  ol.startTextLink("hierarchy",0);
684
  ol.parseText(theTranslator->trGotoTextualHierarchy());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
685
  ol.endTextLink();
686
  ol.endParagraph();
687
  //parseText(ol,theTranslator->trClassHierarchyDescription());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
688 689 690 691 692 693
  //ol.newParagraph();
  ol.endTextBlock();
  DotGfxHierarchyTable g;
  ol.writeGraphicalHierarchy(g);
  endFile(ol);
  ol.enableAll();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
694 695 696 697
}

//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
698
void countFiles(int &htmlFiles,int &files)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
699
{
Dimitri van Heesch's avatar
Dimitri van Heesch committed
700 701
  htmlFiles=0;
  files=0;
702
  FileNameListIterator fnli(*Doxygen::inputNameList);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
703 704 705 706 707 708 709
  FileName *fn;
  for (;(fn=fnli.current());++fnli)
  {
    FileNameIterator fni(*fn);
    FileDef *fd;
    for (;(fd=fni.current());++fni)
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
710
      bool doc = fd->isLinkableInProject();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
711
      bool src = fd->generateSourceFile();
712
      bool nameOk = !fd->isDocumentationFile();
713
      if (nameOk)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
714
      {
715 716 717 718 719 720 721 722
        if (doc || src)
        {
          htmlFiles++;
        }
        if (doc)
        {
          files++;
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
723
      }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
724 725 726 727 728 729 730 731
    }
  }
}

//----------------------------------------------------------------------------

void writeFileIndex(OutputList &ol)
{
Dimitri van Heesch's avatar
Dimitri van Heesch committed
732
  if (documentedHtmlFiles==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
733
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
734
  ol.disable(OutputGenerator::Man);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
735
  if (documentedFiles==0) ol.disableAllBut(OutputGenerator::Html);
736
  startFile(ol,"files",0,theTranslator->trFileIndex().data(),HLI_Files);
737
  startTitle(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
738
  QCString title = theTranslator->trFileList();
739 740 741 742
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
743
  ol.parseText(title);
744
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
745
  ol.startTextBlock();
746
  Doxygen::indexList.addContentsItem(TRUE,theTranslator->trFileList(),0,"files",0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
747
  Doxygen::indexList.incContentsDepth();
748
  ol.parseText(theTranslator->trFileListDescription(Config_getBool("EXTRACT_ALL")));
Dimitri van Heesch's avatar
Dimitri van Heesch committed
749
  ol.endTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
750

751 752 753 754
  OutputNameDict outputNameDict(1009);
  OutputNameList outputNameList;
  outputNameList.setAutoDelete(TRUE);
  
755
  if (Config_getBool("FULL_PATH_NAMES"))
Dimitri van Heesch's avatar
Dimitri van Heesch committed
756
  {
757
    // re-sort input files in (dir,file) output order instead of (file,dir) input order 
758
    FileName *fn=Doxygen::inputNameList->first();
759
    while (fn)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
760
    {
761 762
      FileDef *fd=fn->first();
      while (fd)
763
      {
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780
        QCString path=fd->getPath();
        if (path.isEmpty()) path="[external]";
        FileList *fl = outputNameDict.find(path);
        if (fl)
        {
          fl->inSort(fd);
          //printf("+ inserting %s---%s\n",fd->getPath().data(),fd->name().data());
        }
        else
        {
          //printf("o inserting %s---%s\n",fd->getPath().data(),fd->name().data());
          fl = new FileList(path);
          fl->inSort(fd);
          outputNameList.inSort(fl);
          outputNameDict.insert(path,fl);
        }
        fd=fn->next();
781
      }
782
      fn=Doxygen::inputNameList->next();
783 784 785 786
    }
  }
  
  ol.startIndexList();
787
  FileList *fl=0;
788
  if (Config_getBool("FULL_PATH_NAMES"))
789 790 791 792 793
  {
    fl = outputNameList.first();
  }
  else
  {
794
    fl = Doxygen::inputNameList->first();
795
  }
796 797 798 799 800 801
  while (fl)
  {
    FileDef *fd=fl->first();
    while (fd)
    {
      //printf("Found filedef %s\n",fd->name().data());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
802
      bool doc = fd->isLinkableInProject();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
803
      bool src = fd->generateSourceFile();
804
      bool nameOk = !fd->isDocumentationFile();
805 806
      if (nameOk && (doc || src) && 
              !fd->isReference())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
807
      {
808
        QCString path;
809
        if (Config_getBool("FULL_PATH_NAMES")) 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
810
        {
811
          path=stripFromPath(fd->getPath().copy());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
812
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
813
        QCString fullName=fd->name();
814 815 816 817 818
        if (!path.isEmpty()) 
        {
          if (path.at(path.length()-1)!='/') fullName.prepend("/");
          fullName.prepend(path);
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
819

820
        ol.startIndexKey();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
821 822 823 824
        ol.docify(path);
        if (doc)
        {
          ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
825
          Doxygen::indexList.addContentsItem(FALSE,fullName,fd->getReference(),fd->getOutputFileBase(),0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
826 827 828
        }
        else
        {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
829 830 831
          ol.startBold();
          ol.docify(fd->name());
          ol.endBold();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
832
          Doxygen::indexList.addContentsItem(FALSE,fullName,0,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
833
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
834 835
        if (src)
        {
836 837
          ol.pushGeneratorState();
          ol.disableAllBut(OutputGenerator::Html);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
838 839 840
          ol.docify(" ");
          ol.startTextLink(fd->includeName(),0);
          ol.docify("[");
841
          ol.parseText(theTranslator->trCode());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
842 843
          ol.docify("]");
          ol.endTextLink();
844
          ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
845
        }
846
        ol.endIndexKey();
847 848 849
        bool hasBrief = !fd->briefDescription().isEmpty();
        ol.startIndexValue(hasBrief);
        if (hasBrief)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
850
        {
851
          //ol.docify(" (");
852
          ol.parseDoc(
853
              fd->briefFile(),fd->briefLine(),
854
              fd,0,
855
              abbreviate(fd->briefDescription(),fd->name()),
856
              FALSE, // index words
857 858
              FALSE, // isExample
              0,     // example name
859 860
              TRUE,  // single line
              TRUE   // link from index
861
             );
862
          //ol.docify(")");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
863
        }
864
        ol.endIndexValue(fd->getOutputFileBase(),hasBrief);
865
        //ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
866
        // --------------------------------------------------------
Dimitri van Heesch's avatar
Dimitri van Heesch committed
867
      }
868
      fd=fl->next();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
869
    }
870
    if (Config_getBool("FULL_PATH_NAMES"))
871 872 873 874 875
    {
      fl=outputNameList.next();
    }
    else
    {
876
      fl=Doxygen::inputNameList->next();
877
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
878 879
  }
  ol.endIndexList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
880
  Doxygen::indexList.decContentsDepth();
881
  endFile(ol);
882
  ol.popGeneratorState();
883 884
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
885
//----------------------------------------------------------------------------
886
int countNamespaces()
Dimitri van Heesch's avatar
Dimitri van Heesch committed
887 888
{
  int count=0;
889
  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
890 891 892
  NamespaceDef *nd;
  for (;(nd=nli.current());++nli)
  {
893
    if (nd->isLinkableInProject()) count++;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
894 895 896 897 898 899 900 901
  }
  return count;
}

//----------------------------------------------------------------------------

void writeNamespaceIndex(OutputList &ol)
{
902
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
903
  if (documentedNamespaces==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
904
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
905
  ol.disable(OutputGenerator::Man);
906 907 908
  QCString title;
  if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
  {
909
    startFile(ol,"namespaces",0,theTranslator->trPackageList().data(),HLI_Namespaces);
910 911
    title = theTranslator->trPackageList();
  }
912 913 914 915 916
  else if (fortranOpt)
  {
    startFile(ol,"namespaces",0,theTranslator->trModulesIndex().data(),HLI_Namespaces);
    title = theTranslator->trModulesList();
  }
917 918
  else
  {
919
    startFile(ol,"namespaces",0,theTranslator->trNamespaceIndex().data(),HLI_Namespaces);
920 921
    title = theTranslator->trNamespaceList();
  }
922
  startTitle(ol,0);
923 924 925 926 927 928
  QCString longTitle = title;
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
  ol.parseText(longTitle);
929
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
930
  ol.startTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
931 932
  Doxygen::indexList.addContentsItem(TRUE,title,0,"namespaces",0); 
  Doxygen::indexList.incContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
933
  //ol.newParagraph();
934 935
  if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
  {
936
    ol.parseText(theTranslator->trPackageListDescription());
937
  }
938 939 940 941
  else if (fortranOpt)
  {
    ol.parseText(theTranslator->trModulesListDescription(Config_getBool("EXTRACT_ALL")));
  }
942 943
  else
  {
944
    ol.parseText(theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL")));
945
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
946 947
  //ol.newParagraph();
  ol.endTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
948

Dimitri van Heesch's avatar
Dimitri van Heesch committed
949
  bool first=TRUE;
950

951
  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
952 953
  NamespaceDef *nd;
  for (nli.toFirst();(nd=nli.current());++nli)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
954
  {
955
    if (nd->isLinkableInProject())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
956
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
957 958 959 960 961
      if (first)
      {
        ol.startIndexList();
        first=FALSE;
      }
962 963
      //ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name());
      ol.startIndexKey();
964
      ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->displayName());
965
      ol.endIndexKey();
966 967 968
      bool hasBrief = !nd->briefDescription().isEmpty();
      ol.startIndexValue(hasBrief);
      if (hasBrief)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
969
      {
970
        //ol.docify(" (");
971
        ol.parseDoc(
972
                 nd->briefFile(),nd->briefLine(),
973
                 nd,0,
974
                 abbreviate(nd->briefDescription(),nd->displayName()),
975
                 FALSE, // index words
976 977 978 979
                 FALSE, // isExample
                 0,     // example name
                 TRUE,  // single line
                 TRUE   // link from index
980
                );
981
        //ol.docify(")");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
982
      }
983
      ol.endIndexValue(nd->getOutputFileBase(),hasBrief);
984
      //ol.writeEndAnnoItem(nd->getOutputFileBase());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
985
      Doxygen::indexList.addContentsItem(FALSE,nd->displayName(),nd->getReference(),nd->getOutputFileBase(),0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
986 987
    }
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
988
  if (!first) ol.endIndexList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
989
  Doxygen::indexList.decContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
990
  endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
991
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
992 993 994 995 996 997 998
}

//----------------------------------------------------------------------------

int countAnnotatedClasses()
{
  int count=0;
999
  //ClassDef *cd=Doxygen::classList.first();
1000
  ClassSDict::Iterator cli(*Doxygen::classSDict);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1001 1002 1003
  ClassDef *cd;
  for (;(cd=cli.current());++cli)
  {
1004
    if (cd->isLinkableInProject() && cd->templateMaster()==0) 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
    { 
      //printf("Annotated class %s\n",cd->name().data()); 
      count++; 
    }
  }
  return count;
}

//----------------------------------------------------------------------

void writeAnnotatedClassList(OutputList &ol)
{
  ol.startIndexList(); 
1018
  ClassSDict::Iterator cli(*Doxygen::classSDict);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1019
  ClassDef *cd;
1020 1021
  
  // clear index
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1022 1023
  int x,y;
  for (y=0;y<CHL_Total;y++)
1024
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1025
    for (x=0;x<256;x++)
1026 1027 1028 1029 1030 1031 1032 1033
    {
      g_classIndexLetterUsed[y][x]=FALSE;
    }
  }
  
  // see which elements are in use
  for (cli.toFirst();(cd=cli.current());++cli)
  {
1034
    if (cd->isLinkableInProject() && cd->templateMaster()==0)
1035
    {
1036 1037
      QCString dispName = cd->displayName();
      int c = dispName.at(getPrefixIndex(dispName));
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067
      g_classIndexLetterUsed[CHL_All][c]=TRUE;
      switch(cd->compoundType())
      {
        case ClassDef::Class:
          g_classIndexLetterUsed[CHL_Classes][c]=TRUE;
          break;
        case ClassDef::Struct:
          g_classIndexLetterUsed[CHL_Structs][c]=TRUE;
          break;
        case ClassDef::Union:
          g_classIndexLetterUsed[CHL_Unions][c]=TRUE;
          break;
        case ClassDef::Interface:
          g_classIndexLetterUsed[CHL_Interfaces][c]=TRUE;
          break;
        case ClassDef::Protocol:
          g_classIndexLetterUsed[CHL_Protocols][c]=TRUE;
          break;
        case ClassDef::Category:
          g_classIndexLetterUsed[CHL_Categories][c]=TRUE;
          break;
        case ClassDef::Exception:
          g_classIndexLetterUsed[CHL_Exceptions][c]=TRUE;
          break;

      }
    }
  }
  
  for (cli.toFirst();(cd=cli.current());++cli)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1068
  {
1069
    if (cd->isLinkableInProject() && cd->templateMaster()==0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1070
    {
1071
      QCString type=cd->compoundTypeString();
1072 1073 1074
      ol.startIndexKey();
      ol.writeObjectLink(0,cd->getOutputFileBase(),0,cd->displayName());
      ol.endIndexKey();
1075 1076 1077
      bool hasBrief = !cd->briefDescription().isEmpty();
      ol.startIndexValue(hasBrief);
      if (hasBrief)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1078
      {
1079
        ol.parseDoc(
1080
                 cd->briefFile(),cd->briefLine(),
1081
                 cd,0,
1082
                 abbreviate(cd->briefDescription(),cd->displayName()),
1083
                 FALSE,  // indexWords
1084 1085 1086 1087
                 FALSE,  // isExample
                 0,     // example name
                 TRUE,  // single line
                 TRUE   // link from index
1088
                );
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1089
      }
1090
      ol.endIndexValue(cd->getOutputFileBase(),hasBrief);
1091
      //ol.writeEndAnnoItem(cd->getOutputFileBase());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1092
      Doxygen::indexList.addContentsItem(FALSE,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1093
    }
1094 1095 1096 1097
  }
  ol.endIndexList();
}

1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116
static QCString letterToLabel(char startLetter)
{
  QCString s(5); 
  if (isId(startLetter))
  {
    s[0]=startLetter; s[1]=0;
  }
  else
  {
    const char hex[]="0123456789abcdef";
    s[0]='0';
    s[1]='x';
    s[2]=hex[startLetter>>4];
    s[3]=hex[startLetter&0xF];
    s[4]=0;
  }
  return s;
}

1117 1118
//----------------------------------------------------------------------------

1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
class PrefixIgnoreClassList : public ClassList
{
public:
  virtual int compareItems(GCI item1, GCI item2)
  {
    ClassDef *c1=(ClassDef *)item1;
    ClassDef *c2=(ClassDef *)item2;

    QCString n1 = c1->className();
    n1.remove (0, getPrefixIndex(n1));
    QCString n2 = c2->className();
    n2.remove (0, getPrefixIndex(n2));
    
    return stricmp (n1, n2);
  }
};

1136 1137
// write an alphabetical index of all class with a header for each letter
void writeAlphabeticalClassList(OutputList &ol)
1138
{
1139
  //ol.startAlphabeticalIndexList(); 
1140 1141 1142
  // What starting letters are used
  bool indexLetterUsed[256];
  memset (indexLetterUsed, 0, sizeof (indexLetterUsed));
1143 1144

  // first count the number of headers
1145
  ClassSDict::Iterator cli(*Doxygen::classSDict);
1146
  ClassDef *cd;
1147
  uint startLetter=0;
1148
  int headerItems=0;
1149
  for (;(cd=cli.current());++cli)
1150
  {
1151
    if (cd->isLinkableInProject() && cd->templateMaster()==0)
1152
    {
1153
      int index = getPrefixIndex(cd->className());
1154
      //printf("name=%s index=%d\n",cd->className().data(),index);
1155 1156 1157 1158 1159
      startLetter=toupper(cd->className().at(index));
      indexLetterUsed[startLetter] = true;
    }
  }

1160
  QCString alphaLinks = "<div class=\"qindex\">";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1161 1162
  int l;
  for (l = 0; l < 256; l++)
1163 1164 1165 1166 1167 1168 1169 1170
  {
    if (indexLetterUsed[l])
    {
      if (headerItems) alphaLinks += "&nbsp;|&nbsp;";
      headerItems++;
      alphaLinks += (QCString)"<a class=\"qindex\" href=\"#letter_" + 
                    (char)l + "\">" + 
                    (char)l + "</a>";
1171 1172
    }
  }
1173

1174
  alphaLinks += "</div>\n";
1175 1176
  ol.writeString(alphaLinks);

1177
  ol.writeString("<table align=\"center\" width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
1178 1179

  // the number of columns in the table
1180
  const int columns = Config_getInt("COLS_IN_ALPHA_INDEX");
1181 1182 1183 1184 1185 1186 1187 1188 1189

  int i,j;
  int totalItems = headerItems + annotatedClasses;            // number of items in the table
  int rows = (totalItems + columns - 1)/columns;              // number of rows in the table
  int itemsInLastRow = (totalItems + columns -1)%columns + 1; // number of items in the last row

  //printf("headerItems=%d totalItems=%d columns=%d rows=%d itemsInLastRow=%d\n",
  //    headerItems,totalItems,columns,rows,itemsInLastRow);

1190 1191
  // Keep a list of classes for each starting letter
  PrefixIgnoreClassList classesByLetter[256];
1192 1193 1194 1195 1196 1197 1198

  // fill the columns with the class list (row elements in each column,
  // expect for the columns with number >= itemsInLastRow, which get on
  // item less.
  //int icount=0;
  startLetter=0;
  for (cli.toFirst();(cd=cli.current());++cli)
1199
  {
1200
    if (cd->isLinkableInProject() && cd->templateMaster()==0)
1201
    {
1202
      int index = getPrefixIndex(cd->className());
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
      startLetter=toupper(cd->className().at(index));
      // Do some sorting again, since the classes are sorted by name with 
      // prefix, which should be ignored really.
      classesByLetter[startLetter].inSort (cd);
    }
  }

  // create one class list for each column 
  ClassList *colList = new ClassList[columns];

  // fill the columns with the class list (row elements in each column,
  // expect for the columns with number >= itemsInLastRow, which get on
  // item less.
  int col=0,row=0;
  //int icount=0;
  startLetter=0;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1219
  for (l = 0; l < 256; l++)
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
  {
    if (!indexLetterUsed[l]) continue;

    // insert a new header using a dummy class pointer.
    colList[col].append((ClassDef *)8); // insert dummy for the header
    row++;
    if ( row >= rows + ((col<itemsInLastRow) ? 0 : -1)) 
    { 
      // if the header is the last item in the row, we add an extra
      // row to make it easier to find the text of the header (this
      // is then contained in the next cell)
      colList[col].append(classesByLetter[l].at (0)); 
      col++; 
      row=0; 
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1235 1236
    uint i;
    for (i = 0; i < classesByLetter[l].count(); i++)
1237
    {
1238
      // add the class definition to the correct column list
1239
      colList[col].append (classesByLetter[l].at (i));
1240 1241
      row++;
      if ( row >= rows + ((col<itemsInLastRow) ? 0 : -1)) { col++; row=0; }
1242 1243
    }
  }
1244 1245 1246 1247 1248 1249 1250 1251 1252

  // create iterators for each column
  ClassListIterator **colIterators = new ClassListIterator*[columns];
  for (i=0;i<columns;i++)
  {
    colIterators[i] = new ClassListIterator(colList[i]);
  }

  // generate table
1253
  for (i=0;i<rows;i++) // foreach table row
1254
  {
1255 1256
    //ol.nextTableRow();
    ol.writeString("<tr>");
1257 1258 1259 1260 1261
    // the last column may contain less items then the others
    int colsInRow = (i<rows-1) ? columns : itemsInLastRow; 
    //printf("row [%d]\n",i);
    for (j=0;j<colsInRow;j++) // foreach table column
    {
1262
      ol.writeString("<td>");
1263 1264 1265 1266 1267 1268 1269 1270
      ClassDef *cd = colIterators[j]->current();
      //printf("columns [%d] cd=%p\n",j,cd);
      if (cd==(ClassDef *)8) // the class pointer is really a header
      {
        cd=++(*colIterators[j]); // get the next item
        if (cd)
        {
          //printf("head ClassDef=%p %s\n",cd,cd ? cd->name().data() : "<none>");
1271 1272
          int index = getPrefixIndex(cd->className());
          startLetter=toupper(cd->className().at(index));
1273
          QCString s = letterToLabel(startLetter);
1274
          //ol.writeIndexHeading(s);
1275 1276 1277
          ol.writeString("<a name=\"letter_");
          ol.writeString(s);
          ol.writeString("\"></a>");
1278 1279 1280 1281
          ol.writeString("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
                           "<tr>"
                             "<td><div class=\"ah\">&nbsp;&nbsp;"); 
          ol.writeString(s);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1282
          ol.writeString(         "&nbsp;&nbsp;</div>"
1283 1284 1285 1286
                             "</td>"
                           "</tr>"
                         "</table>\n");

1287 1288 1289 1290
        }
      }
      else if (cd) // a real class, insert a link
      {
1291 1292 1293 1294
        QCString namesp,cname;
        //if (cd->getNamespaceDef()) namesp=cd->getNamespaceDef()->displayName();
        //QCString cname=cd->className();
        extractNamespaceName(cd->name(),cname,namesp);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1295 1296 1297 1298 1299 1300 1301 1302 1303
        QCString nsDispName;
        if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
        {
          nsDispName=substitute(namesp,"::",".");
        }
        else
        {
          nsDispName=namesp.copy();
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1304

1305
        ol.writeObjectLink(cd->getReference(),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1306 1307 1308 1309
                           cd->getOutputFileBase(),0,cname);
        if (!namesp.isEmpty())
        {
          ol.docify(" (");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1310
          NamespaceDef *nd = getResolvedNamespace(namesp);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1311 1312 1313
          if (nd && nd->isLinkable())
          {
            ol.writeObjectLink(nd->getReference(),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1314
                           nd->getOutputFileBase(),0,nsDispName);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1315 1316 1317
          }
          else
          {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1318
            ol.docify(nsDispName);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1319 1320 1321
          }
          ol.docify(")");
        }
1322
        ol.writeNonBreakableSpace(3);
1323 1324 1325
        //printf("item ClassDef=%p %s\n",cd,cd ? cd->name().data() : "<none>");
        ++(*colIterators[j]);
      }
1326 1327 1328
      //ol.endTableColumn();
      ol.writeString("</td>");
      //if (j<colsInRow-1) ol.nextTableColumn();
1329
    }
1330 1331
    //ol.endTableRow();
    ol.writeString("</tr>");
1332
  }
1333 1334
  //ol.endAlphabeticalIndexList();
  ol.writeString("</table>");
1335 1336
  
  ol.writeString(alphaLinks);
1337 1338 1339 1340 1341 1342 1343 1344

  // release the temporary memory
  for (i=0;i<columns;i++)
  {
    delete colIterators[i];
  }
  delete[] colIterators;
  delete[] colList;
1345 1346 1347 1348 1349 1350
}

//----------------------------------------------------------------------------

void writeAlphabeticalIndex(OutputList &ol)
{
1351 1352
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
1353
  if (annotatedClasses==0) return;
1354 1355
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);
1356
  startFile(ol,"classes"+Doxygen::htmlFileExtension,0,theTranslator->trAlphabeticalList().data(),HLI_Classes); 
1357
  startTitle(ol,0);
1358 1359 1360 1361 1362
  ol.parseText(/*Config_getString("PROJECT_NAME")+" "+*/
               (fortranOpt ? theTranslator->trCompoundIndexFortran() :
                vhdlOpt    ? VhdlDocGen::trDesignUnitIndex()             :
                             theTranslator->trCompoundIndex()
               ));
1363 1364
  endTitle(ol,0,0);
  writeAlphabeticalClassList(ol);
1365
  endFile(ol);
1366
  ol.popGeneratorState();
1367 1368 1369 1370
}

//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1371 1372
void writeAnnotatedIndex(OutputList &ol)
{
1373 1374
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1375 1376
  if (annotatedClasses==0) return;
  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1377
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1378
  ol.disable(OutputGenerator::Man);
1379 1380 1381
  QCString title = fortranOpt ? theTranslator->trCompoundListFortran() :
                   vhdlOpt    ? VhdlDocGen::trDesignUnitList()             :
                                theTranslator->trCompoundList()        ;
1382 1383
  startFile(ol,"annotated",0,title.data(),HLI_Annotated);
  startTitle(ol,0);
1384 1385 1386 1387 1388 1389
  QCString longTitle = title;
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
  ol.parseText(longTitle);
1390
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1391
  ol.startTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1392 1393
  Doxygen::indexList.addContentsItem(TRUE,title,0,"annotated",0); 
  Doxygen::indexList.incContentsDepth();
1394 1395 1396 1397
  QCString desc = fortranOpt ? theTranslator->trCompoundListDescriptionFortran() :
                  vhdlOpt    ? VhdlDocGen::trDesignUnitListDescription()             :
                               theTranslator->trCompoundListDescription()        ;
  ol.parseText(desc);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1398
  ol.endTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1399
  writeAnnotatedClassList(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1400
  Doxygen::indexList.decContentsDepth();
1401
  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1402
  endFile(ol);
1403 1404 1405 1406
  ol.popGeneratorState();
}

//----------------------------------------------------------------------------
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419
static void writeClassLinkForMember(OutputList &ol,MemberDef *md,const char *separator,
                             QCString &prevClassName)
{
  ClassDef *cd=md->getClassDef();
  if ( cd && prevClassName!=cd->displayName())
  {
    ol.docify(separator);
    ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(),
        cd->displayName());
    ol.writeString("\n");
    prevClassName = cd->displayName();
  }
}
1420

1421 1422
static void writeFileLinkForMember(OutputList &ol,MemberDef *md,const char *separator,
                             QCString &prevFileName)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1423
{
1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
  FileDef *fd=md->getFileDef();
  if (fd && prevFileName!=fd->name())
  {
    ol.docify(separator);
    ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(),
        fd->name());
    ol.writeString("\n");
    prevFileName = fd->name();
  }
}

static void writeNamespaceLinkForMember(OutputList &ol,MemberDef *md,const char *separator,
                             QCString &prevNamespaceName)
{
  NamespaceDef *nd=md->getNamespaceDef();
  if (nd && prevNamespaceName!=nd->name())
  {
    ol.docify(separator);
    ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(),
        nd->name());
    ol.writeString("\n");
    prevNamespaceName = nd->name();
  }
}

static void writeMemberList(OutputList &ol,bool useSections,int page,
                            MemberIndexList memberLists[MEMBER_INDEX_ENTRIES],
                            DefinitionIntf::DefType type)
{
  int pi;
1454 1455
  // page==-1 => write all member indices to one page (used when total members is small)
  // page!=-1 => write all member for this page only (used when total member is large)
1456 1457 1458
  int startIndex = page==-1 ? 0                      : page;
  int endIndex   = page==-1 ? MEMBER_INDEX_ENTRIES-1 : page;
  ASSERT((int)type<3);
1459 1460 1461 1462 1463

  typedef void (*writeLinkForMember_t)(OutputList &ol,MemberDef *md,const char *separator,
                                   QCString &prevNamespaceName);

  // each index tab has its own write function
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473
  static writeLinkForMember_t writeLinkForMemberMap[3] = 
  { 
    &writeClassLinkForMember, 
    &writeFileLinkForMember,
    &writeNamespaceLinkForMember
  };
  QCString prevName;
  QCString prevDefName;
  bool first=TRUE;
  bool firstSection=TRUE;
1474
  bool firstItem=TRUE;
1475 1476 1477 1478 1479 1480 1481 1482 1483
  for (pi=startIndex; pi<=endIndex; pi++) // page==-1 => pi=[0..127], page!=-1 => pi=page 
  {
    MemberIndexList *ml = &memberLists[pi];
    if (ml->count()==0) continue;
    ml->sort();
    QListIterator<MemberDef> mli(*ml);
    MemberDef *md;
    for (mli.toFirst();(md=mli.current());++mli)
    {
1484
      const char *sep;
1485 1486 1487
      bool isFunc=!md->isObjCMethod() && 
        (md->isFunction() || md->isSlot() || md->isSignal()); 
      QCString name=md->name();
1488 1489
      int startIndex = getPrefixIndex(name);
      if (QCString(name.data()+startIndex)!=prevName) // new entry
1490
      {
1491 1492 1493
        if ((prevName.isEmpty() || 
            tolower(name.at(startIndex))!=tolower(prevName.at(0))) && 
            useSections) // new section
1494
        {
1495
          if (!firstItem)    ol.endItemListItem();
1496
          if (!firstSection) ol.endItemList();
1497 1498 1499 1500
          char cl[2];
          cl[0] = tolower(name.at(startIndex));
          cl[1] = 0;
          QCString cs = letterToLabel(cl[0]);
1501
          QCString anchor=(QCString)"index_"+cs;
1502
          QCString title=(QCString)"- "+cl+" -";
1503 1504 1505 1506 1507
          ol.startSection(anchor,title,SectionInfo::Subsection);
          ol.docify(title);
          ol.endSection(anchor,SectionInfo::Subsection);
          ol.startItemList();
          firstSection=FALSE;
1508
          firstItem=TRUE;
1509 1510 1511 1512 1513 1514 1515 1516
        }
        else if (!useSections && first)
        {
          ol.startItemList();
          first=FALSE;
        }

        // member name
1517 1518 1519
        if (!firstItem) ol.endItemListItem();
        ol.startItemListItem();
        firstItem=FALSE;
1520 1521 1522 1523 1524 1525 1526
        ol.docify(name);
        if (isFunc) ol.docify("()");
        ol.writeString("\n");

        // link to class
        prevDefName="";
        sep = ": ";
1527
        prevName = name.data()+startIndex;
1528 1529 1530 1531 1532 1533
      }
      else // same entry
      {
        sep = ", ";
        // link to class for other members with the same name
      }
1534
      // write the link for the specific list type
1535 1536 1537
      writeLinkForMemberMap[(int)type](ol,md,sep,prevDefName);
    }
  }
1538
  if (!firstItem) ol.endItemListItem();
1539
  ol.endItemList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1540 1541 1542 1543
}

//----------------------------------------------------------------------------

1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560
void initClassMemberIndices()
{
  int i=0;
  int j=0;
  for (j=0;j<CMHL_Total;j++)
  {
    documentedClassMembers[j]=0;
    for (i=0;i<MEMBER_INDEX_ENTRIES;i++) 
    {
      g_memberIndexLetterUsed[j][i].clear();
    }
  }
}

void addClassMemberNameToIndex(MemberDef *md)
{
  static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
1561
  static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
1562 1563
  ClassDef *cd=0;

1564 1565 1566 1567 1568
  if (vhdlOpt && (VhdlDocGen::isRecord(md) || VhdlDocGen::isUnit(md)))
  {
    VhdlDocGen::adjustRecordMember(md);
  }
  
1569
  if (md->isLinkableInProject() && 
1570
      (cd=md->getClassDef())    && 
1571 1572 1573 1574
      cd->isLinkableInProject() &&
      cd->templateMaster()==0)
  {
    QCString n = md->name();
1575 1576
    int index = getPrefixIndex(n);
    int letter = tolower(n.at(index)) & 0x7f;
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622
    if (!n.isEmpty()) 
    {
      bool isFriendToHide = hideFriendCompounds &&
        (QCString(md->typeString())=="friend class" || 
         QCString(md->typeString())=="friend struct" ||
         QCString(md->typeString())=="friend union");
      if (!(md->isFriend() && isFriendToHide))
      {
        g_memberIndexLetterUsed[CMHL_All][letter].append(md);
        documentedClassMembers[CMHL_All]++;
      }
      if (md->isFunction()  || md->isSlot() || md->isSignal())
      {
        g_memberIndexLetterUsed[CMHL_Functions][letter].append(md);
        documentedClassMembers[CMHL_Functions]++;
      } 
      else if (md->isVariable())
      {
        g_memberIndexLetterUsed[CMHL_Variables][letter].append(md);
        documentedClassMembers[CMHL_Variables]++;
      }
      else if (md->isTypedef())
      {
        g_memberIndexLetterUsed[CMHL_Typedefs][letter].append(md);
        documentedClassMembers[CMHL_Typedefs]++;
      }
      else if (md->isEnumerate())
      {
        g_memberIndexLetterUsed[CMHL_Enums][letter].append(md);
        documentedClassMembers[CMHL_Enums]++;
      }
      else if (md->isEnumValue())
      {
        g_memberIndexLetterUsed[CMHL_EnumValues][letter].append(md);
        documentedClassMembers[CMHL_EnumValues]++;
      }
      else if (md->isProperty())
      {
        g_memberIndexLetterUsed[CMHL_Properties][letter].append(md);
        documentedClassMembers[CMHL_Properties]++;
      }
      else if (md->isEvent())
      {
        g_memberIndexLetterUsed[CMHL_Events][letter].append(md);
        documentedClassMembers[CMHL_Events]++;
      }
1623 1624
      else if (md->isRelated() || md->isForeign() ||
               (md->isFriend() && !isFriendToHide))
1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654
      {
        g_memberIndexLetterUsed[CMHL_Related][letter].append(md);
        documentedClassMembers[CMHL_Related]++;
      }
    }
  }
}

//----------------------------------------------------------------------------

void initNamespaceMemberIndices()
{
  int i=0;
  int j=0;
  for (j=0;j<NMHL_Total;j++)
  {
    documentedNamespaceMembers[j]=0;
    for (i=0;i<MEMBER_INDEX_ENTRIES;i++) 
    {
      g_namespaceIndexLetterUsed[j][i].clear();
    }
  }
}

void addNamespaceMemberNameToIndex(MemberDef *md)
{
  NamespaceDef *nd=md->getNamespaceDef();
  if (nd && nd->isLinkableInProject() && md->isLinkableInProject())
  {
    QCString n = md->name();
1655 1656
    int index = getPrefixIndex(n);
    int letter = tolower(n.at(index));
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690
    if (!n.isEmpty()) 
    {
      g_namespaceIndexLetterUsed[NMHL_All][letter].append(md);
      documentedNamespaceMembers[NMHL_All]++;

      if (md->isFunction()) 
      {
        g_namespaceIndexLetterUsed[NMHL_Functions][letter].append(md);
        documentedNamespaceMembers[NMHL_Functions]++;
      }
      else if (md->isVariable()) 
      {
        g_namespaceIndexLetterUsed[NMHL_Variables][letter].append(md);
        documentedNamespaceMembers[NMHL_Variables]++;
      }
      else if (md->isTypedef())
      {
        g_namespaceIndexLetterUsed[NMHL_Typedefs][letter].append(md);
        documentedNamespaceMembers[NMHL_Typedefs]++;
      }
      else if (md->isEnumerate())
      {
        g_namespaceIndexLetterUsed[NMHL_Enums][letter].append(md);
        documentedNamespaceMembers[NMHL_Enums]++;
      }
      else if (md->isEnumValue())
      {
        g_namespaceIndexLetterUsed[NMHL_EnumValues][letter].append(md);
        documentedNamespaceMembers[NMHL_EnumValues]++;
      }
    }
  }
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1691 1692
//----------------------------------------------------------------------------

1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712
void initFileMemberIndices()
{
  int i=0;
  int j=0;
  for (j=0;j<NMHL_Total;j++)
  {
    documentedFileMembers[j]=0;
    for (i=0;i<MEMBER_INDEX_ENTRIES;i++) 
    {
      g_fileIndexLetterUsed[j][i].clear();
    }
  }
}

void addFileMemberNameToIndex(MemberDef *md)
{
  FileDef *fd=md->getFileDef();
  if (fd && fd->isLinkableInProject() && md->isLinkableInProject())
  {
    QCString n = md->name();
1713 1714
    int index = getPrefixIndex(n);
    int letter = tolower(n.at(index));
1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757
    if (!n.isEmpty()) 
    {
      g_fileIndexLetterUsed[FMHL_All][letter].append(md);
      documentedFileMembers[FMHL_All]++;

      if (md->isFunction()) 
      {
        g_fileIndexLetterUsed[FMHL_Functions][letter].append(md);
        documentedFileMembers[FMHL_Functions]++;
      }
      else if (md->isVariable()) 
      {
        g_fileIndexLetterUsed[FMHL_Variables][letter].append(md);
        documentedFileMembers[FMHL_Variables]++;
      }
      else if (md->isTypedef())
      {
        g_fileIndexLetterUsed[FMHL_Typedefs][letter].append(md);
        documentedFileMembers[FMHL_Typedefs]++;
      }
      else if (md->isEnumerate())
      {
        g_fileIndexLetterUsed[FMHL_Enums][letter].append(md);
        documentedFileMembers[FMHL_Enums]++;
      }
      else if (md->isEnumValue())
      {
        g_fileIndexLetterUsed[FMHL_EnumValues][letter].append(md);
        documentedFileMembers[FMHL_EnumValues]++;
      }
      else if (md->isDefine())
      {
        g_fileIndexLetterUsed[FMHL_Defines][letter].append(md);
        documentedFileMembers[FMHL_Defines]++;
      }
    }
  }
}

//----------------------------------------------------------------------------

void writeQuickMemberIndex(OutputList &ol,
    MemberIndexList charUsed[MEMBER_INDEX_ENTRIES],int page,
1758
    QCString fullName,bool multiPage)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1759 1760 1761
{
  bool first=TRUE;
  int i;
1762
  startQuickIndexList(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1763 1764 1765
  for (i=33;i<127;i++)
  {
    char is[2];is[0]=(char)i;is[1]='\0';
1766
    if (charUsed[i].count()>0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1767
    {
1768 1769 1770 1771 1772 1773 1774 1775 1776
      QCString anchor;
      QCString extension=Doxygen::htmlFileExtension;
      if (!multiPage)
        anchor="#index_";
      else if (first) 
        anchor=fullName+extension+"#index_";
      else 
        anchor=fullName+QCString().sprintf("_0x%02x",i)+extension+"#index_";
      startQuickIndexItem(ol,anchor+is,i==page,TRUE,first);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1777
      ol.writeString(is);
1778
      endQuickIndexItem(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1779 1780 1781
      first=FALSE;
    }
  }
1782
  endQuickIndexList(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1783 1784 1785 1786
}

//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1787
static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight hl)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1788
{
1789
  if (documentedClassMembers[hl]==0) return;
1790 1791 1792
  
  static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  static bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
1793 1794 1795 1796 1797 1798 1799 1800 1801

  bool multiPageIndex=FALSE;
  int numPages=1;
  if (documentedClassMembers[hl]>MAX_ITEMS_BEFORE_MULTIPAGE_INDEX)
  {
    multiPageIndex=TRUE;
    numPages=127;
  }

1802
  struct CmhlInfo
1803
  {
1804
    CmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {}
1805 1806 1807 1808
    const char *fname;
    QCString title;
  } cmhlInfo[] = 
  {
1809
    CmhlInfo("functions",     theTranslator->trAll()),
1810 1811 1812 1813
    CmhlInfo("functions_func",
        fortranOpt ? theTranslator->trSubprograms() : 
        vhdlOpt    ? VhdlDocGen::trFunctionAndProc() :
                     theTranslator->trFunctions()),
1814 1815 1816 1817 1818 1819 1820
    CmhlInfo("functions_vars",theTranslator->trVariables()),
    CmhlInfo("functions_type",theTranslator->trTypedefs()),
    CmhlInfo("functions_enum",theTranslator->trEnumerations()),
    CmhlInfo("functions_eval",theTranslator->trEnumerationValues()),
    CmhlInfo("functions_prop",theTranslator->trProperties()),
    CmhlInfo("functions_evnt",theTranslator->trEvents()),
    CmhlInfo("functions_rela",theTranslator->trRelatedFunctions())
1821 1822
  };

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1823 1824
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);
1825

1826
  QCString extension=Doxygen::htmlFileExtension;
1827 1828 1829
  QCString title = fortranOpt ? theTranslator->trCompoundMembersFortran() : 
                   vhdlOpt    ? VhdlDocGen::trDesignUnitMembers()             : 
                                theTranslator->trCompoundMembers()        ;
1830 1831 1832
  if (hl!=CMHL_All) title+=(QCString)" - "+cmhlInfo[hl].title;

  int page;
1833
  bool first=TRUE;
1834
  for (page=0;page<numPages;page++)
1835
  {
1836
    if (!multiPageIndex || g_memberIndexLetterUsed[hl][page].count()>0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1837
    {
1838 1839 1840 1841 1842 1843
      QCString fileName = cmhlInfo[hl].fname;
      if (multiPageIndex && !first)
      { 
        fileName+=QCString().sprintf("_0x%02x",page);
      }
      
1844
      startFile(ol,fileName+extension,0,title,HLI_Functions,TRUE);
1845

1846
      startQuickIndexList(ol);
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867

      // index item for global member list
      startQuickIndexItem(ol,
          cmhlInfo[0].fname+Doxygen::htmlFileExtension,hl==CMHL_All,TRUE,first);
      ol.writeString(fixSpaces(cmhlInfo[0].title));
      endQuickIndexItem(ol);

      // index items per category member lists
      int i;
      for (i=1;i<CMHL_Total;i++)
      {
        if (documentedClassMembers[i]>0)
        {
          startQuickIndexItem(ol,cmhlInfo[i].fname+Doxygen::htmlFileExtension,hl==i,TRUE,first);
          ol.writeString(fixSpaces(cmhlInfo[i].title));
          //printf("multiPageIndex=%d first=%d fileName=%s file=%s title=%s\n",
          //    multiPageIndex,first,fileName.data(),cmhlInfo[i].fname,cmhlInfo[i].title.data());
          endQuickIndexItem(ol);
        }
      }

1868
      endQuickIndexList(ol);
1869 1870 1871 1872 1873 1874 1875 1876

      // quick alphabetical index
      bool quickIndex = documentedClassMembers[hl]>maxItemsBeforeQuickIndex;
      if (quickIndex)
      {
        writeQuickMemberIndex(ol,g_memberIndexLetterUsed[hl],page,
                              cmhlInfo[hl].fname,multiPageIndex);
      }
1877 1878 1879 1880

      ol.endQuickIndices();
      ol.startContents();

1881 1882
      if (hl==CMHL_All)
      {
1883 1884 1885
        static bool extractAll = Config_getBool("EXTRACT_ALL");
        ol.parseText(fortranOpt ?  theTranslator->trCompoundMembersDescriptionFortran(extractAll) : 
                                   theTranslator->trCompoundMembersDescription(extractAll));
1886
      }
1887 1888 1889 1890 1891 1892
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        ol.writeString("&nbsp;");
      }
1893
      //ol.newParagraph();  // FIXME:PARA
1894 1895 1896 1897
      writeMemberList(ol,quickIndex,
                      multiPageIndex?page:-1,
                      g_memberIndexLetterUsed[hl],
                      Definition::TypeClass);
1898 1899
      endFile(ol);
      first=FALSE;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1900
    }
1901
  }
1902
  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1903
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1904 1905
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1906
void writeClassMemberIndex(OutputList &ol)
1907
{
1908
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920
  writeClassMemberIndexFiltered(ol,CMHL_All);
  writeClassMemberIndexFiltered(ol,CMHL_Functions);
  writeClassMemberIndexFiltered(ol,CMHL_Variables);
  writeClassMemberIndexFiltered(ol,CMHL_Typedefs);
  writeClassMemberIndexFiltered(ol,CMHL_Enums);
  writeClassMemberIndexFiltered(ol,CMHL_EnumValues);
  writeClassMemberIndexFiltered(ol,CMHL_Properties);
  writeClassMemberIndexFiltered(ol,CMHL_Events);
  writeClassMemberIndexFiltered(ol,CMHL_Related);

  if (documentedClassMembers[CMHL_All]>0)
  {
1921
    QCString title = fortranOpt?theTranslator->trCompoundMembersFortran():theTranslator->trCompoundMembers();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1922
    Doxygen::indexList.addContentsItem(FALSE,title,0,"functions",0); 
1923
  }
1924 1925
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1926 1927
//----------------------------------------------------------------------------

1928
static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1929
{
1930 1931
  if (documentedFileMembers[hl]==0) return;

1932 1933
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");  
1934 1935 1936
  bool multiPageIndex=FALSE;
  int numPages=1;
  if (documentedFileMembers[hl]>MAX_ITEMS_BEFORE_MULTIPAGE_INDEX)
1937
  {
1938 1939
    multiPageIndex=TRUE;
    numPages=127;
1940
  }
1941

1942
  struct FmhlInfo 
1943
  {
1944
    FmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {}
1945 1946 1947
    const char *fname;
    QCString title;
  } fmhlInfo[] = 
1948
  {
1949
    FmhlInfo("globals",     theTranslator->trAll()),
1950 1951 1952 1953
    FmhlInfo("globals_func",
         fortranOpt ? theTranslator->trSubprograms()  : 
         vhdlOpt    ? VhdlDocGen::trFunctionAndProc() : 
                      theTranslator->trFunctions()),
1954 1955 1956 1957 1958
    FmhlInfo("globals_vars",theTranslator->trVariables()),
    FmhlInfo("globals_type",theTranslator->trTypedefs()),
    FmhlInfo("globals_enum",theTranslator->trEnumerations()),
    FmhlInfo("globals_eval",theTranslator->trEnumerationValues()),
    FmhlInfo("globals_defs",theTranslator->trDefines())
1959
  };
1960

1961 1962 1963 1964
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);

  QCString extension=Doxygen::htmlFileExtension;
1965
  QCString title = fortranOpt?theTranslator->trCompoundMembersFortran():theTranslator->trCompoundMembers();
1966 1967 1968 1969

  int page;
  bool first=TRUE;
  for (page=0;page<numPages;page++)
1970
  {
1971
    if (!multiPageIndex || g_fileIndexLetterUsed[hl][page].count()>0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1972
    {
1973 1974 1975 1976 1977 1978
      QCString fileName = fmhlInfo[hl].fname;
      if (multiPageIndex && !first)
      {
        fileName+=QCString().sprintf("_0x%02x",page);
      }
      
1979
      startFile(ol,fileName+extension,0,title.data(),HLI_Globals,TRUE);
1980

1981
      startQuickIndexList(ol);
1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001

      // index item for all member lists
      startQuickIndexItem(ol,
          fmhlInfo[0].fname+Doxygen::htmlFileExtension,hl==FMHL_All,TRUE,first);
      ol.writeString(fixSpaces(fmhlInfo[0].title));
      endQuickIndexItem(ol);

      int i;
      // index items for per category member lists
      for (i=1;i<FMHL_Total;i++)
      {
        if (documentedFileMembers[i]>0)
        {
          startQuickIndexItem(ol,
              fmhlInfo[i].fname+Doxygen::htmlFileExtension,hl==i,TRUE,first);
          ol.writeString(fixSpaces(fmhlInfo[i].title));
          endQuickIndexItem(ol);
        }
      }

2002
      endQuickIndexList(ol);
2003 2004 2005 2006 2007 2008 2009 2010

      bool quickIndex = documentedFileMembers[hl]>maxItemsBeforeQuickIndex;
      if (quickIndex)
      {
        writeQuickMemberIndex(ol,g_fileIndexLetterUsed[hl],page,
                  fmhlInfo[hl].fname,multiPageIndex);
      }

2011 2012 2013
      ol.endQuickIndices();
      ol.startContents();

2014 2015 2016 2017
      if (hl==FMHL_All)
      {
        ol.parseText(theTranslator->trFileMembersDescription(Config_getBool("EXTRACT_ALL")));
      }
2018 2019 2020 2021 2022 2023
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        ol.writeString("&nbsp;");
      }
2024
      //ol.newParagraph();  // FIXME:PARA
2025 2026 2027 2028 2029
      //writeFileMemberList(ol,quickIndex,hl,page);
      writeMemberList(ol,quickIndex,
                      multiPageIndex?page:-1,
                      g_fileIndexLetterUsed[hl],
                      Definition::TypeFile);
2030 2031
      endFile(ol);
      first=FALSE;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2032
    }
2033
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2034
  ol.popGeneratorState();
2035 2036
}

2037 2038
void writeFileMemberIndex(OutputList &ol)
{
2039 2040 2041 2042 2043 2044 2045 2046
  writeFileMemberIndexFiltered(ol,FMHL_All);
  writeFileMemberIndexFiltered(ol,FMHL_Functions);
  writeFileMemberIndexFiltered(ol,FMHL_Variables);
  writeFileMemberIndexFiltered(ol,FMHL_Typedefs);
  writeFileMemberIndexFiltered(ol,FMHL_Enums);
  writeFileMemberIndexFiltered(ol,FMHL_EnumValues);
  writeFileMemberIndexFiltered(ol,FMHL_Defines);

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2047
  if (documentedFileMembers[FMHL_All]>0)
2048
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2049
    QCString title = theTranslator->trFileMembers();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2050
    Doxygen::indexList.addContentsItem(FALSE,title,0,"globals",0); 
2051
  }
2052 2053 2054
}


2055 2056
//----------------------------------------------------------------------------

2057
static void writeNamespaceMemberIndexFiltered(OutputList &ol,
2058
                                        NamespaceMemberHighlight hl)
2059
{
2060 2061
  if (documentedNamespaceMembers[hl]==0) return;

2062 2063 2064
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");  

2065 2066 2067
  bool multiPageIndex=FALSE;
  int numPages=1;
  if (documentedNamespaceMembers[hl]>MAX_ITEMS_BEFORE_MULTIPAGE_INDEX)
2068
  {
2069 2070
    multiPageIndex=TRUE;
    numPages=127;
2071
  }
2072

2073
  struct NmhlInfo
2074
  {
2075
    NmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {}
2076 2077 2078
    const char *fname;
    QCString title;
  } nmhlInfo[] = 
2079
  {
2080
    NmhlInfo("namespacemembers",     theTranslator->trAll()),
2081 2082 2083 2084
    NmhlInfo("namespacemembers_func",
        fortranOpt ? theTranslator->trSubprograms()  :
        vhdlOpt    ? VhdlDocGen::trFunctionAndProc() :
                     theTranslator->trFunctions()),
2085 2086 2087 2088
    NmhlInfo("namespacemembers_vars",theTranslator->trVariables()),
    NmhlInfo("namespacemembers_type",theTranslator->trTypedefs()),
    NmhlInfo("namespacemembers_enum",theTranslator->trEnumerations()),
    NmhlInfo("namespacemembers_eval",theTranslator->trEnumerationValues())
2089 2090 2091 2092 2093 2094
  };

  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);

  QCString extension=Doxygen::htmlFileExtension;
2095
  QCString title = fortranOpt?theTranslator->trCompoundMembersFortran():theTranslator->trCompoundMembers();
2096 2097 2098 2099

  int page;
  bool first=TRUE;
  for (page=0;page<numPages;page++)
2100
  {
2101
    if (!multiPageIndex || g_namespaceIndexLetterUsed[hl][page].count()>0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2102
    {
2103 2104 2105 2106 2107 2108
      QCString fileName = nmhlInfo[hl].fname;
      if (multiPageIndex && !first)
      {
        fileName+=QCString().sprintf("_0x%02x",page);
      }
      
2109
      startFile(ol,fileName+extension,0,title,HLI_NamespaceMembers,TRUE);
2110

2111
      startQuickIndexList(ol);
2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129

      startQuickIndexItem(ol,
          nmhlInfo[0].fname+Doxygen::htmlFileExtension,hl==NMHL_All,TRUE,first);
      ol.writeString(fixSpaces(nmhlInfo[0].title));
      endQuickIndexItem(ol);

      int i;
      for (i=1;i<NMHL_Total;i++)
      {
        if (documentedNamespaceMembers[i]>0)
        {
          startQuickIndexItem(ol,
              nmhlInfo[i].fname+Doxygen::htmlFileExtension,hl==i,TRUE,first);
          ol.writeString(fixSpaces(nmhlInfo[i].title));
          endQuickIndexItem(ol);
        }
      }

2130
      endQuickIndexList(ol);
2131 2132 2133 2134 2135 2136 2137

      bool quickIndex = documentedNamespaceMembers[hl]>maxItemsBeforeQuickIndex;
      if (quickIndex)
      {
        writeQuickMemberIndex(ol,g_namespaceIndexLetterUsed[hl],page,
              nmhlInfo[hl].fname,multiPageIndex);
      }
2138 2139 2140 2141

      ol.endQuickIndices();
      ol.startContents();

2142 2143
      if (hl==NMHL_All)
      {
2144
        ol.parseText(fortranOpt?theTranslator->trModulesMemberDescription(Config_getBool("EXTRACT_ALL")):theTranslator->trNamespaceMemberDescription(Config_getBool("EXTRACT_ALL")));
2145
      }
2146 2147 2148 2149 2150 2151
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        ol.writeString("&nbsp;");
      }
2152
      //ol.newParagraph(); // FIXME:PARA
2153

2154 2155 2156 2157 2158
      //writeNamespaceMemberList(ol,quickIndex,hl,page);
      writeMemberList(ol,quickIndex,
                      multiPageIndex?page:-1,
                      g_namespaceIndexLetterUsed[hl],
                      Definition::TypeNamespace);
2159
      endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2160
    }
2161
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2162
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2163 2164
}

2165 2166
void writeNamespaceMemberIndex(OutputList &ol)
{
2167
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
2168 2169 2170 2171 2172 2173 2174
  writeNamespaceMemberIndexFiltered(ol,NMHL_All);
  writeNamespaceMemberIndexFiltered(ol,NMHL_Functions);
  writeNamespaceMemberIndexFiltered(ol,NMHL_Variables);
  writeNamespaceMemberIndexFiltered(ol,NMHL_Typedefs);
  writeNamespaceMemberIndexFiltered(ol,NMHL_Enums);
  writeNamespaceMemberIndexFiltered(ol,NMHL_EnumValues);

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2175
  if (documentedNamespaceMembers[NMHL_All]>0)
2176
  {
2177
    QCString title = fortranOpt?theTranslator->trModulesMembers():theTranslator->trNamespaceMembers();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2178
    Doxygen::indexList.addContentsItem(FALSE,title,0,"namespacemembers",0); 
2179
  }
2180 2181
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2182 2183
//----------------------------------------------------------------------------

2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782
#define NUM_SEARCH_INDICES      13
#define SEARCH_INDEX_ALL         0
#define SEARCH_INDEX_CLASSES     1
#define SEARCH_INDEX_NAMESPACES  2
#define SEARCH_INDEX_FILES       3
#define SEARCH_INDEX_FUNCTIONS   4
#define SEARCH_INDEX_VARIABLES   5
#define SEARCH_INDEX_TYPEDEFS    6
#define SEARCH_INDEX_ENUMS       7
#define SEARCH_INDEX_ENUMVALUES  8
#define SEARCH_INDEX_PROPERTIES  9
#define SEARCH_INDEX_EVENTS     10
#define SEARCH_INDEX_RELATED    11
#define SEARCH_INDEX_DEFINES    12

class SearchIndexList : public SDict< QList<Definition> >
{
  public:
    SearchIndexList(int size=17) : SDict< QList<Definition> >(size,FALSE) {}
   ~SearchIndexList() {}
    void append(Definition *d)
    {
      QList<Definition> *l = find(d->name());
      if (l==0)
      {
        l=new QList<Definition>;
        SDict< QList<Definition> >::append(d->name(),l);
      }
      l->append(d);
    }
    int compareItems(GCI item1, GCI item2)
    {
      QList<Definition> *md1=(QList<Definition> *)item1;
      QList<Definition> *md2=(QList<Definition> *)item2;
      QCString n1 = md1->first()->localName();
      QCString n2 = md2->first()->localName();
      return stricmp(n1.data(),n2.data());
    }
};

static void addMemberToSearchIndex(
         SearchIndexList symbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES],
         int symbolCount[NUM_SEARCH_INDICES],
         MemberDef *md)
{
  static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
  bool isLinkable = md->isLinkable();
  ClassDef *cd=0;
  NamespaceDef *nd=0;
  FileDef *fd=0;
  if (isLinkable             && 
      (cd=md->getClassDef()) && 
      cd->isLinkable()       &&
      cd->templateMaster()==0)
  {
    QCString n = md->name();
    int letter = tolower(n.at(0)) & 0x7f;
    if (!n.isEmpty()) 
    {
      bool isFriendToHide = hideFriendCompounds &&
        (QCString(md->typeString())=="friend class" || 
         QCString(md->typeString())=="friend struct" ||
         QCString(md->typeString())=="friend union");
      if (!(md->isFriend() && isFriendToHide))
      {
        symbols[SEARCH_INDEX_ALL][letter].append(md);
        symbolCount[SEARCH_INDEX_ALL]++;
      }
      if (md->isFunction() || md->isSlot() || md->isSignal())
      {
        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
      } 
      else if (md->isVariable())
      {
        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
        symbolCount[SEARCH_INDEX_VARIABLES]++;
      }
      else if (md->isTypedef())
      {
        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
      }
      else if (md->isEnumerate())
      {
        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
        symbolCount[SEARCH_INDEX_ENUMS]++;
      }
      else if (md->isEnumValue())
      {
        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
      }
      else if (md->isProperty())
      {
        symbols[SEARCH_INDEX_PROPERTIES][letter].append(md);
        symbolCount[SEARCH_INDEX_PROPERTIES]++;
      }
      else if (md->isEvent())
      {
        symbols[SEARCH_INDEX_EVENTS][letter].append(md);
        symbolCount[SEARCH_INDEX_EVENTS]++;
      }
      else if (md->isRelated() || md->isForeign() ||
               (md->isFriend() && !isFriendToHide))
      {
        symbols[SEARCH_INDEX_RELATED][letter].append(md);
        symbolCount[SEARCH_INDEX_RELATED]++;
      }
    }
  }
  else if (isLinkable && 
      ((nd=md->getNamespaceDef()) && nd->isLinkable()) || 
      ((fd=md->getFileDef())      && fd->isLinkable())
     )
  {
    QCString n = md->name();
    int letter = tolower(n.at(0)) & 0x7f;
    if (!n.isEmpty()) 
    {
      symbols[SEARCH_INDEX_ALL][letter].append(md);
      symbolCount[SEARCH_INDEX_ALL]++;

      if (md->isFunction()) 
      {
        symbols[SEARCH_INDEX_FUNCTIONS][letter].append(md);
        symbolCount[SEARCH_INDEX_FUNCTIONS]++;
      }
      else if (md->isVariable()) 
      {
        symbols[SEARCH_INDEX_VARIABLES][letter].append(md);
        symbolCount[SEARCH_INDEX_VARIABLES]++;
      }
      else if (md->isTypedef())
      {
        symbols[SEARCH_INDEX_TYPEDEFS][letter].append(md);
        symbolCount[SEARCH_INDEX_TYPEDEFS]++;
      }
      else if (md->isEnumerate())
      {
        symbols[SEARCH_INDEX_ENUMS][letter].append(md);
        symbolCount[SEARCH_INDEX_ENUMS]++;
      }
      else if (md->isEnumValue())
      {
        symbols[SEARCH_INDEX_ENUMVALUES][letter].append(md);
        symbolCount[SEARCH_INDEX_ENUMVALUES]++;
      }
      else if (md->isDefine())
      {
        symbols[SEARCH_INDEX_DEFINES][letter].append(md);
        symbolCount[SEARCH_INDEX_DEFINES]++;
      }
    }
  }
}

static QCString searchId(const QCString &s)
{
  int c;
  uint i;
  QCString result;
  for (i=0;i<s.length();i++)
  {
    c=s.at(i);
    if ((c>='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z'))
    {
      result+=(char)tolower(c);
    }
    else
    {
      char val[4];
      sprintf(val,"_%02x",c);
      result+=val;
    }
  }
  return result;
}

static  int g_searchIndexCount[NUM_SEARCH_INDICES];
static  SearchIndexList g_searchIndexSymbols[NUM_SEARCH_INDICES][MEMBER_INDEX_ENTRIES];
static const char *g_searchIndexName[NUM_SEARCH_INDICES] = 
{ 
    "all",
    "classes",
    "namespaces",
    "files",
    "functions",
    "variables",
    "typedefs", 
    "enums", 
    "enumvalues",
    "properties", 
    "events", 
    "related",
    "defines"
};


class SearchIndexCategoryMapping
{
  public:
    SearchIndexCategoryMapping()
    {
      categoryLabel[SEARCH_INDEX_ALL]        = theTranslator->trAll();
      categoryLabel[SEARCH_INDEX_CLASSES]    = theTranslator->trClasses();
      categoryLabel[SEARCH_INDEX_NAMESPACES] = theTranslator->trNamespace(TRUE,FALSE);
      categoryLabel[SEARCH_INDEX_FILES]      = theTranslator->trFile(TRUE,FALSE);
      categoryLabel[SEARCH_INDEX_FUNCTIONS]  = theTranslator->trFunctions();
      categoryLabel[SEARCH_INDEX_VARIABLES]  = theTranslator->trVariables();
      categoryLabel[SEARCH_INDEX_TYPEDEFS]   = theTranslator->trTypedefs();
      categoryLabel[SEARCH_INDEX_ENUMS]      = theTranslator->trEnumerations();
      categoryLabel[SEARCH_INDEX_ENUMVALUES] = theTranslator->trEnumerationValues();
      categoryLabel[SEARCH_INDEX_PROPERTIES] = theTranslator->trProperties();
      categoryLabel[SEARCH_INDEX_EVENTS]     = theTranslator->trEvents();
      categoryLabel[SEARCH_INDEX_RELATED]    = theTranslator->trFriends();
      categoryLabel[SEARCH_INDEX_DEFINES]    = theTranslator->trDefines();
    }
    QString categoryLabel[NUM_SEARCH_INDICES];
};

void writeSearchIndex()
{
  if (!Config_getBool("GENERATE_HTML")) return;
  static bool treeView = Config_getBool("GENERATE_TREEVIEW");

  ClassSDict::Iterator cli(*Doxygen::classSDict);
  ClassDef *cd;
  for (;(cd=cli.current());++cli)
  {
    int letter = tolower(cd->localName().at(0));
    if (cd->isLinkable() && isId(letter))
    {
      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(cd);
      g_searchIndexSymbols[SEARCH_INDEX_CLASSES][letter].append(cd);
      g_searchIndexCount[SEARCH_INDEX_ALL]++;
      g_searchIndexCount[SEARCH_INDEX_CLASSES]++;
    }
  }
  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
  NamespaceDef *nd;
  for (;(nd=nli.current());++nli)
  {
    int letter = tolower(nd->name().at(0));
    if (nd->isLinkable() && isId(letter))
    {
      g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(nd);
      g_searchIndexSymbols[SEARCH_INDEX_NAMESPACES][letter].append(nd);
      g_searchIndexCount[SEARCH_INDEX_ALL]++;
      g_searchIndexCount[SEARCH_INDEX_NAMESPACES]++;
    }
  }
  FileNameListIterator fnli(*Doxygen::inputNameList);
  FileName *fn;
  for (;(fn=fnli.current());++fnli)
  {
    FileNameIterator fni(*fn);
    FileDef *fd;
    for (;(fd=fni.current());++fni)
    {
      int letter = tolower(fd->name().at(0));
      if (fd->isLinkable() && isId(letter))
      {
        g_searchIndexSymbols[SEARCH_INDEX_ALL][letter].append(fd);
        g_searchIndexSymbols[SEARCH_INDEX_FILES][letter].append(fd);
        g_searchIndexCount[SEARCH_INDEX_ALL]++;
        g_searchIndexCount[SEARCH_INDEX_FILES]++;
      }
    }
  }
  {
    MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict);
    MemberName *mn;
    // for each member name
    for (mnli.toFirst();(mn=mnli.current());++mnli)
    {
      MemberDef *md;
      MemberNameIterator mni(*mn);
      // for each member definition
      for (mni.toFirst();(md=mni.current());++mni)
      {
        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
      }
    }
  }
  {
    MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict);
    MemberName *mn;
    // for each member name
    for (fnli.toFirst();(mn=fnli.current());++fnli)
    {
      MemberDef *md;
      MemberNameIterator mni(*mn);
      // for each member definition
      for (mni.toFirst();(md=mni.current());++mni)
      {
        addMemberToSearchIndex(g_searchIndexSymbols,g_searchIndexCount,md);
      }
    }
  }
  
  int i,p;
  for (i=0;i<NUM_SEARCH_INDICES;i++)
  {
    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
    {
      if (g_searchIndexSymbols[i][p].count()>0)
      {
        g_searchIndexSymbols[i][p].sort();
      }
    }
  }

  //ol.pushGeneratorState();
  //ol.disableAllBut(OutputGenerator::Html);
  QCString htmlDirName = Config_getString("HTML_OUTPUT")+"/search";
  QDir htmlDir(htmlDirName);
  if (!htmlDir.exists() && !htmlDir.mkdir(htmlDirName))
  {
    err("Could not create search results directory '%s/search'\n",htmlDirName.data());
    return;
  }

  HtmlGenerator::writeSearchData(htmlDirName);

  for (i=0;i<NUM_SEARCH_INDICES;i++)
  {
    for (p=0;p<MEMBER_INDEX_ENTRIES;p++)
    {
      if (g_searchIndexSymbols[i][p].count()>0)
      {
        QCString fileName;
        fileName.sprintf("/%s_%02x.html",g_searchIndexName[i],p);
        fileName.prepend(htmlDirName);
        QFile outFile(fileName);
        if (outFile.open(IO_WriteOnly))
        {
          QTextStream t(&outFile);
          t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
               " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
          t << "<html><head><title></title>" << endl;
          t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
          t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
          t << "</head>" << endl;
          t << "<body class=\"SRPage\">" << endl;
          t << "<div id=\"SRIndex\">" << endl;
          // TODO: translate "Loading"
          t << "<div class=\"SRStatus\" id=\"Loading\">Loading...</div>" << endl;

          SDict<QList<Definition> >::Iterator li(g_searchIndexSymbols[i][p]);
          QList<Definition> *dl;
          for (li.toFirst();(dl=li.current());++li)
          {
            Definition *d = dl->first();
            QCString id = d->localName();
            t << "<div class=\"SRResult\" id=\"SR_"
              << searchId(d->localName()) << "\">" << endl;
            t << " <div class=\"SREntry\">\n";
            if (dl->count()==1) // item with a unique name
            {
              MemberDef  *md   = 0;
              bool isMemberDef = d->definitionType()==Definition::TypeMember;
              if (isMemberDef) md = (MemberDef*)d;
              t << "  <a class=\"SRSymbol\" href=\"../" << 
                d->getOutputFileBase() << Doxygen::htmlFileExtension;
              if (isMemberDef)
              {
                t << "#" << ((MemberDef *)d)->anchor();
              }
              t << "\" target=\""; 
              if (treeView) t << "basefrm"; else t << "_parent"; 
              t << "\">" 
                << convertToXML(d->localName())
                << "</a>" << endl;
              if (d->getOuterScope()!=Doxygen::globalScope)
              {
                t << "  <span class=\"SRScope\">" 
                  << convertToXML(d->getOuterScope()->name()) 
                  << "</span>" << endl;
              }
              else if (isMemberDef)
              {
                FileDef *fd = ((MemberDef *)d)->getBodyDef();
                if (fd==0) fd = ((MemberDef *)d)->getFileDef();
                if (fd)
                {
                  t << "  <span class=\"SRScope\">" 
                    << convertToXML(fd->localName())
                    << "</span>" << endl;
                }
              }
            }
            else // multiple items with the same name
            {
              t << "  <a class=\"SRSymbol\" href=\"javascript:searchResults.Toggle('SR_"
                << searchId(d->localName()) << "')\">" 
                << convertToXML(d->localName()) << "</a>" << endl;
              t << "  <div class=\"SRChildren\">" << endl;

              QListIterator<Definition> di(*dl);
              bool overloadedFunction = FALSE;
              Definition *prevScope = 0;
              for (di.toFirst();(d=di.current());)
              {
                ++di;
                Definition *scope     = d->getOuterScope();
                Definition *next      = di.current();
                Definition *nextScope = 0;
                MemberDef  *md        = 0;
                bool isMemberDef = d->definitionType()==Definition::TypeMember;
                if (isMemberDef) md = (MemberDef*)d;
                if (next) nextScope = next->getOuterScope();

                t << "    <a class=\"SRScope\" href=\"../" << 
                  d->getOutputFileBase() << Doxygen::htmlFileExtension;
                if (isMemberDef)
                {
                  t << "#" << ((MemberDef *)d)->anchor();
                }
                t << "\" target=\"";
                if (treeView) t << "basefrm"; else t << "_parent"; 
                t << "\">";
                bool found=FALSE;
                overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
                                      (scope && scope==nextScope)
                                     ) && md && 
                                     (md->isFunction() || md->isSlot());
                QCString prefix;
                if (md) prefix=convertToXML(md->localName());
                if (overloadedFunction) // overloaded member function
                {
                  prefix+=convertToXML(md->argsString()); 
                          // show argument list to disambiguate overloaded functions
                }
                else if (md) // unique member function
                {
                  prefix+="()"; // only to show it is a function
                }
                if (d->definitionType()==Definition::TypeClass)
                {
                  t << convertToXML(((ClassDef*)d)->displayName());
                  found = TRUE;
                }
                else if (d->definitionType()==Definition::TypeNamespace)
                {
                  t << convertToXML(((NamespaceDef*)d)->displayName());
                  found = TRUE;
                }
                else if (scope==0 || scope==Doxygen::globalScope) // in global scope
                {
                  if (md)
                  {
                    FileDef *fd = md->getBodyDef();
                    if (fd==0) fd = md->getFileDef();
                    if (fd)
                    {
                      if (!prefix.isEmpty()) prefix+=":&nbsp;";
                      t << prefix << convertToXML(fd->localName());
                      found = TRUE;
                    }
                  }
                }
                else if (md && (md->getClassDef() || md->getNamespaceDef())) 
                  // member in class or namespace scope
                {
                  static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
                  t << convertToXML(d->getOuterScope()->qualifiedName()) << (optimizeOutputJava ? "." : "::");
                  t << prefix;
                  found = TRUE;
                }
                else if (scope) // some thing else? -> show scope
                {
                  t << prefix << convertToXML(scope->name());
                  found = TRUE;
                }
                if (!found) // fallback
                {
                  // TODO: translate "global namespace"
                  t << prefix << "(global namespace)";
                }
                t << "</a>" << endl;
                prevScope = scope;
              }
              t << "  </div>" << endl; // SRChildren
            }
            t << " </div>" << endl; // SREntry
            t << "</div>" << endl; // SRResult
          }
          // TODO: translate "Searching"
          t << "<div class=\"SRStatus\" id=\"Searching\">Searching...</div>" << endl;
          // TODO: translate "No Matches"
          t << "<div class=\"SRStatus\" id=\"NoMatches\">No Matches</div>" << endl;

          t << "<script type=\"text/javascript\"><!--" << endl;
          t << "document.getElementById(\"Loading\").style.display=\"none\";" << endl;
          t << "document.getElementById(\"NoMatches\").style.display=\"none\";" << endl;
          t << "var searchResults = new SearchResults(\"searchResults\");" << endl;
          t << "searchResults.Search();" << endl;
          t << "--></script>" << endl;

          t << "</div>" << endl; // SRIndex

          t << "</body>" << endl;
          t << "</html>" << endl;

        }
        else
        {
          err("Failed to open file '%s' for writing...\n",fileName.data());
        }
      }
    }
  }
  //ol.popGeneratorState();

  {
    QFile f(htmlDirName+"/search.js");
    if (f.open(IO_WriteOnly))
    {
      QTextStream t(&f);
      t << "// Search script generated by doxygen" << endl;
      t << "// Copyright (C) 2009 by Dimitri van Heesch." << endl << endl;
      t << "// The code in this file is loosly based on main.js, part of Natural Docs," << endl;
      t << "// which is Copyright (C) 2003-2008 Greg Valure" << endl;
      t << "// Natural Docs is licensed under the GPL." << endl << endl;
      t << "var indexSectionsWithContent =" << endl;
      t << "{" << endl;
      bool first=TRUE;
      for (i=0;i<NUM_SEARCH_INDICES;i++)
      {
        if (g_searchIndexCount[i]>0)
        {
          if (!first) t << "," << endl;
          t << "  \"" << g_searchIndexName[i] << "\": \"";
          for (p=32;p<MEMBER_INDEX_ENTRIES;p++)
          {
            t << (g_searchIndexSymbols[i][p].count()>0 ? "1" : "0");
          }
          t << "\"";
          first=FALSE;
        }
      }
      if (!first) t << "\n";
      t << "};" << endl << endl;

      t << search_script;
    }
  }
  {
    QFile f(htmlDirName+"/search.css");
    if (f.open(IO_WriteOnly))
    {
      QTextStream t(&f);
      t << search_styleSheet;
    }
  }
  {
    QFile f(htmlDirName+"/nomatches.html");
    if (f.open(IO_WriteOnly))
    {
      QTextStream t(&f);
      t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
           "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
      t << "<html><head><title></title>" << endl;
      t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
      t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl;
      t << "</head>" << endl;
      t << "<body class=\"SRPage\">" << endl;
      t << "<div id=\"SRIndex\">" << endl;
      // TODO: translate "No Matches"
      t << "<div class=\"SRStatus\" id=\"NoMatches\">No Matches</div>" << endl;
      t << "</div>" << endl;
      t << "</body>" << endl;
      t << "</html>" << endl;
    }
  }
}

void writeSearchCategories(QTextStream &t)
{
  static SearchIndexCategoryMapping map;
  int i,j=0;
  for (i=0;i<NUM_SEARCH_INDICES;i++)
  {
    if (g_searchIndexCount[i]>0)
    {
      t << "<a class=\"SelectItem\" href=\"javascript:void(0)\" "
        << "onclick=\"searchBox.OnSelectItem(" << j << ",'" 
        << g_searchIndexName[i] << "')\">"
        << "<span class=\"SelectionMark\">&nbsp;</span>"
        << convertToXML(map.categoryLabel[i])
        << "</a>";
      j++;
    }
  }
}

//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2783 2784
void writeExampleIndex(OutputList &ol)
{
2785
  if (Doxygen::exampleSDict->count()==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2786
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2787
  ol.disable(OutputGenerator::Man);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2788
  QCString title = theTranslator->trExamples();
2789 2790
  startFile(ol,"examples",0,title.data(),HLI_Examples);
  startTitle(ol,0);
2791 2792 2793 2794
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
2795
  ol.parseText(title);
2796
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2797
  ol.startTextBlock();
2798
  Doxygen::indexList.addContentsItem(TRUE,theTranslator->trExamples(),0,"examples",0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2799
  Doxygen::indexList.incContentsDepth();
2800
  ol.parseText(theTranslator->trExamplesDescription());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2801 2802
  //ol.newParagraph();
  ol.endTextBlock();
2803
  ol.startItemList();
2804
  PageSDict::Iterator pdi(*Doxygen::exampleSDict);
2805 2806
  PageDef *pd=0;
  for (pdi.toFirst();(pd=pdi.current());++pdi)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2807
  {
2808
    ol.startItemListItem();
2809 2810
    QCString n=pd->getOutputFileBase();
    if (!pd->title().isEmpty())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2811
    {
2812
      ol.writeObjectLink(0,n,0,pd->title());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2813
      Doxygen::indexList.addContentsItem(FALSE,pd->title(),pd->getReference(),n,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2814 2815 2816
    }
    else
    {
2817
      ol.writeObjectLink(0,n,0,pd->name());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2818
      Doxygen::indexList.addContentsItem(FALSE,pd->name(),pd->getReference(),n,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2819
    }
2820
    ol.endItemListItem();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2821 2822
    ol.writeString("\n");
  }
2823
  ol.endItemList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2824
  Doxygen::indexList.decContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2825
  endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2826
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2827 2828 2829 2830
}

//----------------------------------------------------------------------------

2831
void countRelatedPages(int &docPages,int &indexPages)
2832
{
2833
  docPages=indexPages=0;
2834
  PageSDict::Iterator pdi(*Doxygen::pageSDict);
2835 2836
  PageDef *pd=0;
  for (pdi.toFirst();(pd=pdi.current());++pdi)
2837
  {
2838
    if ( pd->visibleInIndex())
2839
    {
2840
      indexPages++; 
2841 2842 2843 2844
    }
    if ( pd->documentedPage())
    {
      docPages++;
2845
    }
2846 2847 2848 2849 2850
  }
}

//----------------------------------------------------------------------------

2851 2852 2853
static void writeSubPages(PageDef *pd)
{
  //printf("Write subpages(%s #=%d)\n",pd->name().data(),pd->getSubPages() ? pd->getSubPages()->count() : 0 );
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2854
  Doxygen::indexList.incContentsDepth();
2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871

  PageSDict *subPages = pd->getSubPages();
  if (subPages)
  {
    PageSDict::Iterator pi(*subPages);
    PageDef *subPage;
    for (pi.toFirst();(subPage=pi.current());++pi)
    {
      QCString pageTitle;

      if (subPage->title().isEmpty())
        pageTitle=subPage->name();
      else
        pageTitle=subPage->title();

      bool hasSubPages = subPage->hasSubPages();

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2872
      Doxygen::indexList.addContentsItem(hasSubPages,pageTitle,subPage->getReference(),subPage->getOutputFileBase(),0);
2873 2874 2875
      writeSubPages(subPage);
    }
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2876 2877
  Doxygen::indexList.decContentsDepth();

2878
}
2879

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2880 2881
void writePageIndex(OutputList &ol)
{
2882
  if (indexedPages==0) return;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2883
  ol.pushGeneratorState();
2884
  ol.disableAllBut(OutputGenerator::Html);
2885
  startFile(ol,"pages",0,theTranslator->trPageIndex().data(),HLI_Pages);
2886
  startTitle(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2887
  QCString title = theTranslator->trRelatedPages();
2888 2889 2890 2891
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
2892
  ol.parseText(title);
2893
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2894
  ol.startTextBlock();
2895 2896
  //Doxygen::indexList.addContentsItem(TRUE,theTranslator->trRelatedPages(),0,"pages",0); 
  //Doxygen::indexList.incContentsDepth();
2897
  ol.parseText(theTranslator->trRelatedPagesDescription());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2898
  ol.endTextBlock();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2899
  startIndexHierarchy(ol,0);
2900
  PageSDict::Iterator pdi(*Doxygen::pageSDict);
2901 2902
  PageDef *pd=0;
  for (pdi.toFirst();(pd=pdi.current());++pdi)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2903
  {
2904
    if ( pd->visibleInIndex())
2905
    {
2906
      QCString pageTitle;
2907

2908 2909
      if (pd->title().isEmpty())
        pageTitle=pd->name();
2910
      else
2911
        pageTitle=pd->title();
2912

2913 2914
      bool hasSubPages = pd->hasSubPages();

2915
      ol.startIndexListItem();
2916 2917 2918
      ol.startIndexItem(pd->getReference(),pd->getOutputFileBase());
      ol.parseText(pageTitle);
      ol.endIndexItem(pd->getReference(),pd->getOutputFileBase());
2919
      if (pd->isReference()) 
2920 2921 2922 2923 2924
      { 
        ol.startTypewriter(); 
        ol.docify(" [external]");
        ol.endTypewriter();
      }
2925
      ol.writeString("\n");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2926
      Doxygen::indexList.addContentsItem(hasSubPages,pageTitle,pd->getReference(),pd->getOutputFileBase(),0);
2927
      writeSubPages(pd);
2928
      ol.endIndexListItem();
2929
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2930
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2931
  endIndexHierarchy(ol,0);
2932
  //Doxygen::indexList.decContentsDepth();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2933
  endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2934
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2935 2936 2937 2938
}

//----------------------------------------------------------------------------

2939
int countGroups()
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2940 2941
{
  int count=0;
2942
  GroupSDict::Iterator gli(*Doxygen::groupSDict);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2943
  GroupDef *gd;
2944
  for (gli.toFirst();(gd=gli.current());++gli)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2945
  {
2946 2947 2948 2949 2950
    if (!gd->isReference())
    {
      gd->visited=FALSE;
      count++;
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2951 2952 2953 2954
  }
  return count;
}

2955 2956 2957 2958 2959
//----------------------------------------------------------------------------

int countDirs()
{
  int count=0;
2960
  SDict<DirDef>::Iterator dli(*Doxygen::directories);
2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972
  DirDef *dd;
  for (dli.toFirst();(dd=dli.current());++dli)
  {
    if (dd->isLinkableInProject())
    {
      dd->visited=FALSE;
      count++;
    }
  }
  return count;
}

2973 2974 2975 2976 2977

//----------------------------------------------------------------------------

void writeGraphInfo(OutputList &ol)
{
2978
  if (!Config_getBool("HAVE_DOT") || !Config_getBool("GENERATE_HTML")) return;
2979 2980
  ol.pushGeneratorState();
  ol.disableAllBut(OutputGenerator::Html);
2981
  generateGraphLegend(Config_getString("HTML_OUTPUT"));
2982
  startFile(ol,"graph_legend",0,theTranslator->trLegendTitle().data());
2983
  startTitle(ol,0);
2984
  ol.parseText(theTranslator->trLegendTitle());
2985
  endTitle(ol,0,0);
2986
  bool oldStripCommentsState = Config_getBool("STRIP_CODE_COMMENTS");
2987
  // temporarily disable the stripping of comments for our own code example!
2988
  Config_getBool("STRIP_CODE_COMMENTS") = FALSE;
2989
  ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE,FALSE);
2990
  Config_getBool("STRIP_CODE_COMMENTS") = oldStripCommentsState;
2991 2992 2993 2994
  endFile(ol);
  ol.popGeneratorState();
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2995
void writeGroupIndexItem(GroupDef *gd,MemberList *ml,const QCString &title)
2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007
{
  if (ml && ml->count()>0)
  {
    bool first=TRUE;
    MemberDef *md=ml->first();
    while (md)
    {
      if (md->isDetailedSectionVisible(TRUE,FALSE))
      {
        if (first)
        {
          first=FALSE;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3008 3009
          Doxygen::indexList.addContentsItem(TRUE, convertToHtml(title,TRUE), gd->getReference(), gd->getOutputFileBase(), 0);
          Doxygen::indexList.incContentsDepth();
3010
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3011
        Doxygen::indexList.addContentsItem(FALSE,md->name(),md->getReference(),md->getOutputFileBase(),md->anchor()); 
3012 3013 3014 3015
      }
      md=ml->next();
    }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3016 3017 3018 3019
    if (!first)
    {
      Doxygen::indexList.decContentsDepth();
    }
3020 3021 3022
  }
}

3023 3024
//----------------------------------------------------------------------------
/*!
3025
 * write groups as hierarchical trees
3026
 */
3027
void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* ftv)
3028
{
3029 3030
  bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");  
3031 3032 3033 3034 3035 3036 3037
  if (level>20)
  {
    warn(gd->getDefFileName(),gd->getDefLine(),
        "Warning: maximum nesting level exceeded for group %s: check for possible recursive group relation!\n",gd->name().data()
        );
    return;
  }
3038

3039 3040 3041
  /* Some groups should appear twice under different parent-groups.
   * That is why we should not check if it was visited 
   */
3042 3043 3044
  if (/*!gd->visited &&*/ (!gd->isASubGroup() || level>0) &&
      (!gd->isReference() || Config_getBool("EXTERNAL_GROUPS")) // hide external groups by default
     )
3045 3046 3047 3048 3049
  {
    //printf("gd->name()=%s #members=%d\n",gd->name().data(),gd->countMembers());
    // write group info
    bool hasSubGroups = gd->groupList->count()>0;
    bool hasSubPages = gd->pageDict->count()>0;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3050
    int numSubItems = 0;
3051
    if ( Config_getBool("TOC_EXPAND"))
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3052
    {
3053 3054 3055 3056 3057 3058 3059 3060 3061
      QListIterator<MemberList> mli(gd->getMemberLists());
      MemberList *ml;
      for (mli.toFirst();(ml=mli.current());++mli)
      {
        if (ml->listType()&MemberList::documentationLists)
        {
          numSubItems += ml->count();
        }
      }
3062
      numSubItems += gd->namespaceSDict->count();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3063 3064 3065 3066 3067 3068
      numSubItems += gd->classSDict->count();
      numSubItems += gd->fileList->count();
      numSubItems += gd->exampleDict->count();
    }

    bool isDir = hasSubGroups || hasSubPages || numSubItems>0;
3069
    //printf("gd=`%s': pageDict=%d\n",gd->name().data(),gd->pageDict->count());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3070 3071
    Doxygen::indexList.addContentsItem(isDir,gd->groupTitle(),gd->getReference(),gd->getOutputFileBase(),0); 
    Doxygen::indexList.incContentsDepth();
3072 3073 3074 3075 3076 3077
    if (ftv)
    {
      ftv->addContentsItem(isDir,gd->groupTitle(),gd->getReference(),gd->getOutputFileBase(),0); 
      ftv->incContentsDepth();
    }
    
3078 3079 3080 3081
    //ol.writeListItem();
    //ol.startTextLink(gd->getOutputFileBase(),0);
    //parseText(ol,gd->groupTitle());
    //ol.endTextLink();
3082

3083
    ol.startIndexListItem();
3084 3085 3086
    ol.startIndexItem(gd->getReference(),gd->getOutputFileBase());
    ol.parseText(gd->groupTitle());
    ol.endIndexItem(gd->getReference(),gd->getOutputFileBase());
3087 3088 3089 3090 3091 3092
    if (gd->isReference()) 
    { 
      ol.startTypewriter(); 
      ol.docify(" [external]");
      ol.endTypewriter();
    }
3093 3094 3095 3096 3097 3098
    
    //ol.writeStartAnnoItem(0,gd->getOutputFileBase(),0,gd-);
    //parseText(ol,gd->groupTitle());
    //ol.writeEndAnnoItem(gd->getOutputFileBase());

    // write pages
3099
    PageSDict::Iterator pli(*gd->pageDict);
3100 3101
    PageDef *pd = 0;
    for (pli.toFirst();(pd=pli.current());++pli)
3102 3103
    {
      SectionInfo *si=0;
3104
      if (!pd->name().isEmpty()) si=Doxygen::sectionDict[pd->name()];
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3105
      Doxygen::indexList.addContentsItem(FALSE,
3106 3107 3108 3109
                                         convertToHtml(pd->title(),TRUE),
                                         gd->getReference(),
                                         gd->getOutputFileBase(),
                                         si ? si->label.data() : 0);
3110 3111 3112 3113 3114
    }

    // write subgroups
    if (hasSubGroups)
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3115
      startIndexHierarchy(ol,level+1);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3116 3117
      if (Config_getBool("SORT_GROUP_NAMES"))
        gd->groupList->sort();
3118 3119
      QListIterator<GroupDef> gli(*gd->groupList);
      GroupDef *subgd = 0;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3120
      for (gli.toFirst();(subgd=gli.current());++gli)
3121
      {
3122
        writeGroupTreeNode(ol,subgd,level+1,ftv);
3123
      }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3124
      endIndexHierarchy(ol,level+1); 
3125 3126
    }

3127

3128
    if (Config_getBool("TOC_EXPAND"))
3129
    {
3130
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docDefineMembers),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3131
                         theTranslator->trDefines());
3132
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docTypedefMembers),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3133
                         theTranslator->trTypedefs());
3134
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docEnumMembers),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3135
                         theTranslator->trEnumerations());
3136
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docFuncMembers),
3137 3138 3139 3140
                           fortranOpt ? theTranslator->trSubprograms() :
                           vhdlOpt    ? VhdlDocGen::trFunctionAndProc() :
                                        theTranslator->trFunctions()
                          );
3141
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docVarMembers),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3142
                         theTranslator->trVariables());
3143
       writeGroupIndexItem(gd,gd->getMemberList(MemberList::docProtoMembers),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3144
                         theTranslator->trFuncProtos());
3145

3146
      // write namespaces
3147 3148
      NamespaceSDict *namespaceSDict=gd->namespaceSDict;
      if (namespaceSDict->count()>0)
3149
      {
3150
        Doxygen::indexList.addContentsItem(TRUE,convertToHtml(fortranOpt?theTranslator->trModules():theTranslator->trNamespaces(),TRUE),gd->getReference(), gd->getOutputFileBase(), 0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3151
        Doxygen::indexList.incContentsDepth();
3152

3153 3154 3155
        NamespaceSDict::Iterator ni(*namespaceSDict);
        NamespaceDef *nsd;
        for (ni.toFirst();(nsd=ni.current());++ni)
3156
        {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3157
          Doxygen::indexList.addContentsItem(FALSE, convertToHtml(nsd->name(),TRUE), nsd->getReference(), nsd->getOutputFileBase(), 0);
3158
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3159
        Doxygen::indexList.decContentsDepth();
3160 3161 3162
      }

      // write classes
3163
      if (gd->classSDict->count()>0)
3164
      {
3165
        Doxygen::indexList.addContentsItem(TRUE,convertToHtml(fortranOpt?theTranslator->trDataTypes():theTranslator->trClasses(),TRUE), gd->getReference(), gd->getOutputFileBase(), 0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3166
        Doxygen::indexList.incContentsDepth();
3167

3168 3169 3170 3171 3172 3173 3174
        ClassDef *cd;
        ClassSDict::Iterator cdi(*gd->classSDict);
        for (cdi.toFirst();(cd=cdi.current());++cdi)
        {
          if (cd->isLinkable())
          {
            //printf("node: Has children %s\n",cd->name().data());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3175
            Doxygen::indexList.addContentsItem(FALSE,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
3176 3177 3178 3179
          }
        }

        //writeClassTree(gd->classSDict,1);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3180
        Doxygen::indexList.decContentsDepth();
3181 3182 3183 3184 3185 3186
      }

      // write file list
      FileList *fileList=gd->fileList;
      if (fileList->count()>0)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3187 3188 3189
        Doxygen::indexList.addContentsItem(TRUE, 
              theTranslator->trFile(TRUE,FALSE),
              gd->getReference(), 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3190
              gd->getOutputFileBase(), 0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3191
        Doxygen::indexList.incContentsDepth();
3192

3193 3194 3195
        FileDef *fd=fileList->first();
        while (fd)
        {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3196
          Doxygen::indexList.addContentsItem(FALSE, convertToHtml(fd->name(),TRUE),fd->getReference(), fd->getOutputFileBase(), 0);
3197
          fd=fileList->next();
3198
        }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3199
        Doxygen::indexList.decContentsDepth();
3200 3201 3202 3203 3204
      }

      // write examples
      if (gd->exampleDict->count()>0)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3205 3206
        Doxygen::indexList.addContentsItem(TRUE, convertToHtml(theTranslator->trExamples(),TRUE),gd->getReference(), gd->getOutputFileBase(), 0);
        Doxygen::indexList.incContentsDepth();
3207

3208
        PageSDict::Iterator eli(*(gd->exampleDict));
3209 3210
        PageDef *pd=eli.toFirst();
        while (pd)
3211
        {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3212
          Doxygen::indexList.addContentsItem(FALSE,pd->name(),pd->getReference(),pd->getOutputFileBase(),0); 
3213
          pd=++eli;
3214 3215
        }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3216
        Doxygen::indexList.decContentsDepth();
3217 3218
      }
    }
3219
    ol.endIndexListItem();
3220
    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3221
    Doxygen::indexList.decContentsDepth();
3222 3223
    if (ftv)
      ftv->decContentsDepth();
3224
    //gd->visited=TRUE;
3225 3226 3227
  }
}

3228
void writeGroupHierarchy(OutputList &ol, FTVHelp* ftv)
3229
{
3230 3231 3232 3233 3234
  if (ftv)
  {
    ol.pushGeneratorState(); 
    ol.disable(OutputGenerator::Html);
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3235
  startIndexHierarchy(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3236 3237
  if (Config_getBool("SORT_GROUP_NAMES"))
    Doxygen::groupSDict->sort();
3238
  GroupSDict::Iterator gli(*Doxygen::groupSDict);
3239
  GroupDef *gd;
3240
  for (gli.toFirst();(gd=gli.current());++gli)
3241
  {
3242
    writeGroupTreeNode(ol,gd,0,ftv);
3243
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3244
  endIndexHierarchy(ol,0); 
3245 3246
  if (ftv)
    ol.popGeneratorState(); 
3247 3248
}

3249
//----------------------------------------------------------------------------
3250
void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv)
3251 3252 3253 3254 3255 3256 3257 3258 3259 3260
{
  if (level>20)
  {
    warn(dd->getDefFileName(),dd->getDefLine(),
        "Warning: maximum nesting level exceeded for directory %s: "
        "check for possible recursive directory relation!\n",dd->name().data()
        );
    return;
  }

3261 3262 3263 3264 3265
  static bool tocExpand = Config_getBool("TOC_EXPAND");
  bool isDir = dd->subDirs().count()>0 || // there are subdirs
               (tocExpand &&              // or toc expand and
                dd->getFiles() && dd->getFiles()->count()>0 // there are files
               );
3266
  //printf("gd=`%s': pageDict=%d\n",gd->name().data(),gd->pageDict->count());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3267 3268
  Doxygen::indexList.addContentsItem(isDir,dd->shortName(),dd->getReference(),dd->getOutputFileBase(),0); 
  Doxygen::indexList.incContentsDepth();
3269 3270 3271 3272 3273
  if (ftv)
  {
    ftv->addContentsItem(isDir,dd->shortName(),dd->getReference(),dd->getOutputFileBase(),0); 
    ftv->incContentsDepth();
  }
3274

3275
  ol.startIndexListItem();
3276 3277 3278
  ol.startIndexItem(dd->getReference(),dd->getOutputFileBase());
  ol.parseText(dd->shortName());
  ol.endIndexItem(dd->getReference(),dd->getOutputFileBase());
3279 3280 3281 3282 3283 3284 3285
  if (dd->isReference()) 
  { 
    ol.startTypewriter(); 
    ol.docify(" [external]");
    ol.endTypewriter();
  }

3286
  // write sub directories
3287 3288 3289 3290 3291 3292 3293
  if (dd->subDirs().count()>0)
  {
    startIndexHierarchy(ol,level+1);
    QListIterator<DirDef> dli(dd->subDirs());
    DirDef *subdd = 0;
    for (dli.toFirst();(subdd=dli.current());++dli)
    {
3294
      writeDirTreeNode(ol,subdd,level+1,ftv);
3295 3296 3297 3298
    }
    endIndexHierarchy(ol,level+1); 
  }

3299
  if (tocExpand)
3300
  {
3301
    // write files of this directory
3302 3303 3304 3305 3306 3307
    FileList *fileList=dd->getFiles();
    if (fileList && fileList->count()>0)
    {
      FileDef *fd=fileList->first();
      while (fd)
      {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3308
        Doxygen::indexList.addContentsItem(FALSE, convertToHtml(fd->name(),TRUE),fd->getReference(), fd->getOutputFileBase(), 0);
3309 3310 3311 3312
        fd=fileList->next();
      }
    }
  }
3313
  ol.endIndexListItem();
3314

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3315
  Doxygen::indexList.decContentsDepth();
3316 3317
  if (ftv)
    ftv->decContentsDepth();
3318 3319
}

3320
void writeDirHierarchy(OutputList &ol, FTVHelp* ftv)
3321
{
3322 3323 3324 3325 3326
  if (ftv)
  {
    ol.pushGeneratorState(); 
    ol.disable(OutputGenerator::Html);
  }
3327
  startIndexHierarchy(ol,0);
3328
  SDict<DirDef>::Iterator dli(*Doxygen::directories);
3329 3330 3331
  DirDef *dd;
  for (dli.toFirst();(dd=dli.current());++dli)
  {
3332
    if (dd->getOuterScope()==Doxygen::globalScope) writeDirTreeNode(ol,dd,0,ftv);
3333 3334
  }
  endIndexHierarchy(ol,0); 
3335 3336
  if (ftv)
    ol.popGeneratorState(); 
3337 3338
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3339 3340 3341 3342 3343
//----------------------------------------------------------------------------

void writeGroupIndex(OutputList &ol)
{
  if (documentedGroups==0) return; 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3344
  ol.pushGeneratorState(); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3345
  ol.disable(OutputGenerator::Man);
3346
  startFile(ol,"modules",0,theTranslator->trModuleIndex().data(),HLI_Modules);
3347
  startTitle(ol,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3348
  QCString title = theTranslator->trModules();
3349 3350 3351 3352
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
3353
  ol.parseText(title);
3354
  endTitle(ol,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3355
  ol.startTextBlock();
3356
  Doxygen::indexList.addContentsItem(TRUE,theTranslator->trModules(),0,"modules",0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3357
  Doxygen::indexList.incContentsDepth();
3358
  ol.parseText(theTranslator->trModulesDescription());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3359
  ol.endTextBlock();
3360

3361 3362 3363
  FTVHelp* ftv = 0;
  bool treeView=Config_getBool("USE_INLINE_TREES");
  if (treeView)
3364 3365 3366 3367
    ftv = new FTVHelp(false);

  writeGroupHierarchy(ol,ftv);

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3368
  Doxygen::indexList.decContentsDepth();
3369 3370 3371 3372 3373 3374 3375 3376 3377 3378
  if (ftv)
  {
    QString OutStr;
    ftv->generateTreeView(&OutStr);
    ol.pushGeneratorState(); 
    ol.disableAllBut(OutputGenerator::Html);
    ol.writeString(OutStr);
    ol.popGeneratorState();
    delete ftv;
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3379
  endFile(ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3380
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3381 3382
}

3383 3384
//----------------------------------------------------------------------------

3385 3386 3387 3388 3389 3390 3391 3392
void writeDirIndex(OutputList &ol)
{
  if (documentedDirs==0) return; 
  ol.pushGeneratorState(); 
  ol.disable(OutputGenerator::Man);
  startFile(ol,"dirs",0,theTranslator->trDirIndex().data(),HLI_Directories);
  startTitle(ol,0);
  QCString title = theTranslator->trDirectories();
3393 3394 3395 3396
  //if (!Config_getString("PROJECT_NAME").isEmpty()) 
  //{
  //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  //}
3397 3398 3399
  ol.parseText(title);
  endTitle(ol,0,0);
  ol.startTextBlock();
3400
  Doxygen::indexList.addContentsItem(TRUE,theTranslator->trDirIndex(),0,"dirs",0); 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3401
  Doxygen::indexList.incContentsDepth();
3402 3403 3404
  ol.parseText(theTranslator->trDirDescription());
  ol.endTextBlock();

3405 3406 3407
  FTVHelp* ftv = 0;
  bool treeView=Config_getBool("USE_INLINE_TREES");
  if (treeView)
3408
    ftv = new FTVHelp(false);
3409

3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421
  writeDirHierarchy(ol,ftv);

  if (ftv)
  {
    QString OutStr;
    ftv->generateTreeView(&OutStr);
    ol.pushGeneratorState(); 
    ol.disableAllBut(OutputGenerator::Html);
    ol.writeString(OutStr);
    ol.popGeneratorState();
    delete ftv;
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3422
  Doxygen::indexList.decContentsDepth();
3423 3424 3425 3426 3427 3428
  endFile(ol);
  ol.popGeneratorState();
}

//----------------------------------------------------------------------------

3429 3430 3431 3432 3433 3434 3435 3436 3437 3438
static bool mainPageHasTitle()
{
  if (Doxygen::mainPage==0) return FALSE;
  if (Doxygen::mainPage->title().isEmpty()) return FALSE;
  if (Doxygen::mainPage->title().lower()=="notitle") return FALSE;
  return TRUE;
}

//----------------------------------------------------------------------------

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3439 3440
void writeIndex(OutputList &ol)
{
3441 3442
  static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  static bool vhdlOpt    = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3443
  // save old generator state
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3444
  ol.pushGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3445

3446
  QCString projPrefix;
3447
  if (!Config_getString("PROJECT_NAME").isEmpty())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3448
  {
3449
    projPrefix=Config_getString("PROJECT_NAME")+" ";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3450
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3451 3452

  //--------------------------------------------------------------------
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3453
  // write HTML index
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3454
  //--------------------------------------------------------------------
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3455
  ol.disableAllBut(OutputGenerator::Html);
3456

3457
  QCString defFileName = 
3458
    Doxygen::mainPage ? Doxygen::mainPage->getDefFileName().data() : "[generated]";
3459
  int defLine =
3460
    Doxygen::mainPage ? Doxygen::mainPage->getDefLine() : -1;
3461

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3462
  QCString title;
3463
  if (!mainPageHasTitle())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3464
  {
3465
    title = theTranslator->trMainPage();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3466
  }
3467
  else 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3468
  {
3469
    title = substitute(Doxygen::mainPage->title(),"%","");
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3470 3471
  }

3472
  QCString indexName=Config_getBool("GENERATE_TREEVIEW")?"main":"index";
3473
  ol.startFile(indexName,0,title);
3474
  
3475
  if (Doxygen::mainPage)
3476
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3477
    Doxygen::indexList.addContentsItem(Doxygen::mainPage->hasSubPages(),title,0,indexName,0); 
3478 3479 3480 3481 3482

    if (Doxygen::mainPage->hasSubPages())
    {
      writeSubPages(Doxygen::mainPage);
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3483
  }
3484

3485 3486 3487 3488 3489 3490 3491
  if (!Config_getBool("DISABLE_INDEX")) 
  {
    ol.startQuickIndices();
    ol.writeQuickLinks(TRUE,HLI_Main);
    ol.endQuickIndices();
  }
  ol.startContents();
3492
  ol.startTitleHead(0);
3493
  if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty())
3494
  {
3495 3496
    if (Doxygen::mainPage->title().lower()!="notitle")
    {
3497
      ol.docify(Doxygen::mainPage->title());
3498
    }
3499 3500 3501
  }
  else
  {
3502 3503 3504 3505
    if (!Config_getString("PROJECT_NAME").isEmpty())
    {
      ol.parseText(projPrefix+theTranslator->trDocumentation());
    }
3506 3507
  }
  ol.endTitleHead(0,0);
3508
  // ol.newParagraph(); // FIXME:PARA
3509
  if (!Config_getString("PROJECT_NUMBER").isEmpty())
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3510 3511
  {
    ol.startProjectNumber();
3512 3513 3514 3515 3516
    ol.parseDoc(defFileName,defLine,
                Doxygen::mainPage,0,
                Config_getString("PROJECT_NUMBER"),
                TRUE,FALSE,0,
                TRUE,FALSE);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3517 3518
    ol.endProjectNumber();
  }
3519 3520 3521 3522
  if (Config_getBool("DISABLE_INDEX") && Doxygen::mainPage==0) 
  {
    ol.writeQuickLinks(FALSE,HLI_Main);
  }
3523

3524
  if (Doxygen::mainPage)
3525
  {
3526
    Doxygen::insideMainPage=TRUE;
3527 3528
    ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,
                Doxygen::mainPage->documentation(),TRUE,FALSE
3529
                /*,Doxygen::mainPage->sectionDict*/);
3530 3531 3532 3533 3534

    if (!Config_getString("GENERATE_TAGFILE").isEmpty())
    {
       Doxygen::tagFile << "  <compound kind=\"page\">" << endl
                        << "    <name>"
3535
                        << convertToXML(Doxygen::mainPage->name())
3536 3537 3538 3539 3540 3541 3542
                        << "</name>" << endl
                        << "    <title>"
                        << convertToXML(Doxygen::mainPage->title())
                        << "</title>" << endl
                        << "    <filename>"
                        << convertToXML(Doxygen::mainPage->getOutputFileBase())
                        << "</filename>" << endl;
3543 3544 3545 3546

       Doxygen::mainPage->writeDocAnchorsToTagFile();
       Doxygen::tagFile << "  </compound>" << endl;
    }
3547
    Doxygen::insideMainPage=FALSE;
3548 3549
  }
  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3550 3551 3552
  endFile(ol);
  ol.disable(OutputGenerator::Html);
  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3553
  //--------------------------------------------------------------------
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3554
  // write LaTeX/RTF index
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3555
  //--------------------------------------------------------------------
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3556
  ol.enable(OutputGenerator::Latex);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3557 3558
  ol.enable(OutputGenerator::RTF);

3559
  ol.startFile("refman",0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3560
  ol.startIndexSection(isTitlePageStart);
3561
  if (!Config_getString("LATEX_HEADER").isEmpty()) 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3562 3563 3564 3565
  {
    ol.disable(OutputGenerator::Latex);
  }

3566 3567 3568 3569 3570 3571 3572 3573 3574
  if (projPrefix.isEmpty())
  {
    ol.parseText(theTranslator->trReferenceManual());
  }
  else
  {
    ol.parseText(projPrefix);
  }

3575
  if (!Config_getString("PROJECT_NUMBER").isEmpty())
3576
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3577
    ol.startProjectNumber(); 
3578
    ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Config_getString("PROJECT_NUMBER"),FALSE,FALSE);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3579 3580 3581 3582
    ol.endProjectNumber();
  }
  ol.endIndexSection(isTitlePageStart);
  ol.startIndexSection(isTitlePageAuthor);
3583
  ol.parseText(theTranslator->trGeneratedBy());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3584
  ol.endIndexSection(isTitlePageAuthor);
3585 3586
  ol.enable(OutputGenerator::Latex);

3587
  ol.lastIndexPage();
3588
  if (Doxygen::mainPage)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3589 3590
  {
    ol.startIndexSection(isMainPage);
3591
    if (mainPageHasTitle())
3592
    {
3593
      ol.parseText(Doxygen::mainPage->title());
3594
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3595
    else
3596
    {
3597
      ol.parseText(/*projPrefix+*/theTranslator->trMainPage());
3598
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3599
    ol.endIndexSection(isMainPage);
3600
  }
3601 3602 3603 3604 3605 3606 3607 3608 3609
  if (documentedPages>0)
  {
    //ol.parseText(projPrefix+theTranslator->trPageDocumentation());
    //ol.endIndexSection(isPageDocumentation);
    PageSDict::Iterator pdi(*Doxygen::pageSDict);
    PageDef *pd=pdi.toFirst();
    bool first=Doxygen::mainPage==0;
    for (pdi.toFirst();(pd=pdi.current());++pdi)
    {
3610
      if (!pd->getGroupDef() && !pd->isReference() && 
3611 3612
          (!pd->hasParentPage() ||                    // not inside other page
           (Doxygen::mainPage==pd->getOuterScope()))  // or inside main page
3613
         )
3614 3615 3616 3617 3618 3619
      {
        QCString title = pd->title();
        if (title.isEmpty()) title=pd->name();
        ol.startIndexSection(isPageDocumentation);
        ol.parseText(title);
        ol.endIndexSection(isPageDocumentation);
3620 3621 3622 3623 3624 3625 3626
        ol.pushGeneratorState(); // write TOC title (RTF only)
          ol.disableAllBut(OutputGenerator::RTF);
          ol.startIndexSection(isPageDocumentation2);
          ol.parseText(title);
          ol.endIndexSection(isPageDocumentation2);
          ol.popGeneratorState();
        ol.writeAnchor(0,pd->name());
3627 3628 3629 3630 3631 3632

        ol.writePageLink(pd->getOutputFileBase(),first);
        first=FALSE;
      }
    }
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3633

3634
  if (!Config_getBool("LATEX_HIDE_INDICES"))
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3635
  {
3636 3637 3638 3639 3640 3641
    //if (indexedPages>0)
    //{
    //  ol.startIndexSection(isPageIndex);
    //  ol.parseText(/*projPrefix+*/ theTranslator->trPageIndex());
    //  ol.endIndexSection(isPageIndex);
    //}
3642 3643 3644
    if (documentedGroups>0)
    {
      ol.startIndexSection(isModuleIndex);
3645
      ol.parseText(/*projPrefix+*/ theTranslator->trModuleIndex());
3646 3647
      ol.endIndexSection(isModuleIndex);
    }
3648 3649 3650
    if (Config_getBool("SHOW_DIRECTORIES") && documentedDirs>0)
    {
      ol.startIndexSection(isDirIndex);
3651
      ol.parseText(/*projPrefix+*/ theTranslator->trDirIndex());
3652 3653
      ol.endIndexSection(isDirIndex);
    }
3654 3655 3656
    if (documentedNamespaces>0)
    {
      ol.startIndexSection(isNamespaceIndex);
3657
      ol.parseText(/*projPrefix+*/(fortranOpt?theTranslator->trModulesIndex():theTranslator->trNamespaceIndex()));
3658 3659 3660 3661 3662
      ol.endIndexSection(isNamespaceIndex);
    }
    if (hierarchyClasses>0)
    {
      ol.startIndexSection(isClassHierarchyIndex);
3663 3664 3665 3666 3667
      ol.parseText(/*projPrefix+*/
          (fortranOpt ? theTranslator->trCompoundIndexFortran() : 
           vhdlOpt    ? VhdlDocGen::trDesignUnitIndex()             :
                        theTranslator->trCompoundIndex()
          ));
3668 3669 3670 3671 3672
      ol.endIndexSection(isClassHierarchyIndex);
    }
    if (annotatedClasses>0)
    {
      ol.startIndexSection(isCompoundIndex);
3673
      ol.parseText(/*projPrefix+*/
3674 3675
          (fortranOpt ? theTranslator->trCompoundIndexFortran() :
           vhdlOpt ? VhdlDocGen::trDesignUnitIndex() : 
3676 3677
                     theTranslator->trCompoundIndex()
          ));
3678 3679 3680 3681 3682
      ol.endIndexSection(isCompoundIndex);
    }
    if (documentedFiles>0)
    {
      ol.startIndexSection(isFileIndex);
3683
      ol.parseText(/*projPrefix+*/theTranslator->trFileIndex());
3684 3685
      ol.endIndexSection(isFileIndex);
    }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3686
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3687 3688 3689
  if (documentedGroups>0)
  {
    ol.startIndexSection(isModuleDocumentation);
3690
    ol.parseText(/*projPrefix+*/theTranslator->trModuleDocumentation());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3691 3692
    ol.endIndexSection(isModuleDocumentation);
  }
3693 3694 3695
  if (Config_getBool("SHOW_DIRECTORIES") && documentedDirs>0)
  {
    ol.startIndexSection(isDirDocumentation);
3696
    ol.parseText(/*projPrefix+*/theTranslator->trDirDocumentation());
3697 3698
    ol.endIndexSection(isDirDocumentation);
  }
3699 3700 3701
  if (documentedNamespaces>0)
  {
    ol.startIndexSection(isNamespaceDocumentation);
3702
    ol.parseText(/*projPrefix+*/(fortranOpt?theTranslator->trModuleDocumentation():theTranslator->trNamespaceDocumentation()));
3703 3704
    ol.endIndexSection(isNamespaceDocumentation);
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3705 3706 3707
  if (annotatedClasses>0)
  {
    ol.startIndexSection(isClassDocumentation);
3708
    ol.parseText(/*projPrefix+*/(fortranOpt?theTranslator->trTypeDocumentation():theTranslator->trClassDocumentation()));
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3709 3710 3711 3712 3713
    ol.endIndexSection(isClassDocumentation);
  }
  if (documentedFiles>0)
  {
    ol.startIndexSection(isFileDocumentation);
3714
    ol.parseText(/*projPrefix+*/theTranslator->trFileDocumentation());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3715 3716
    ol.endIndexSection(isFileDocumentation);
  }
3717
  if (Doxygen::exampleSDict->count()>0)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3718 3719
  {
    ol.startIndexSection(isExampleDocumentation);
3720
    ol.parseText(/*projPrefix+*/theTranslator->trExampleDocumentation());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3721 3722 3723 3724 3725
    ol.endIndexSection(isExampleDocumentation);
  }
  ol.endIndexSection(isEndIndex);
  endFile(ol);

3726
  if (Doxygen::mainPage)
3727
  {
3728
    Doxygen::insideMainPage=TRUE;
3729
    ol.disable(OutputGenerator::Man);
3730
    startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3731
    ol.startTextBlock();
3732 3733
    ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,
                Doxygen::mainPage->documentation(),FALSE,FALSE
3734
               );
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3735
    ol.endTextBlock();
3736 3737
    endFile(ol);
    ol.enable(OutputGenerator::Man);
3738
    Doxygen::insideMainPage=FALSE;
3739 3740
  }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
3741
  ol.popGeneratorState();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
3742
}
3743

3744 3745