My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
namespacedef.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 
18 #include "namespacedef.h"
19 #include "outputlist.h"
20 #include "util.h"
21 #include "language.h"
22 #include "classdef.h"
23 #include "classlist.h"
24 #include "memberlist.h"
25 #include "doxygen.h"
26 #include "message.h"
27 #include "docparser.h"
28 #include "searchindex.h"
29 #include "vhdldocgen.h"
30 #include "layout.h"
31 #include "membergroup.h"
32 #include "config.h"
33 
34 //------------------------------------------------------------------
35 
36 NamespaceDef::NamespaceDef(const char *df,int dl,int dc,
37  const char *name,const char *lref,
38  const char *fName, const char*type,
39  bool isPublished) :
40  Definition(df,dl,dc,name)
41  ,m_isPublished(isPublished)
42 {
43  if (fName)
44  {
45  if (lref)
46  {
47  fileName = stripExtension(fName);
48  }
49  else
50  {
52  }
53  }
54  else
55  {
56  setFileName(name);
57  }
58  classSDict = new ClassSDict(17);
61  usingDirList = 0;
62  usingDeclList = 0;
63  m_allMembersDict = 0;
64  setReference(lref);
67  visited=FALSE;
68  m_subGrouping=Config_getBool(SUBGROUPING);
69  if (type && !strcmp("module", type))
70  {
71  m_type = MODULE;
72  }
73  else if (type && !strcmp("constants", type))
74  {
76  }
77  else if (type && !strcmp("library", type))
78  {
79  m_type = LIBRARY;
80  }
81  else
82  {
83  m_type = NAMESPACE;
84  }
85 }
86 
88 {
89  delete classSDict;
90  delete namespaceSDict;
91  delete m_innerCompounds;
92  delete usingDirList;
93  delete usingDeclList;
94  delete memberGroupSDict;
95  delete m_allMembersDict;
96 }
97 
98 void NamespaceDef::setFileName(const QCString &fn)
99 {
100  if (isReference())
101  {
102  fileName = "namespace"+fn;
103  }
104  else
105  {
106  fileName = convertNameToFile("namespace"+fn);
107  }
108 }
109 
111 {
113  MemberGroup *mg;
114  for (;(mg=mgli.current());++mgli)
115  {
117  }
118 }
119 
121 {
124  MemberGroup *mg;
125  for (;(mg=mgli.current());++mgli)
126  {
128  }
129  QListIterator<MemberList> mli(m_memberLists);
130  MemberList *ml;
131  for (mli.toFirst();(ml=mli.current());++mli)
132  {
134  {
136  }
137  }
138 }
139 
141 {
142  if (fd==0) return;
143  if (files.find(fd)==-1)
144  {
145  if (Config_getBool(SORT_MEMBER_DOCS))
146  files.inSort(fd);
147  else
148  files.append(fd);
149  }
150 }
151 
153 {
156  {
158  }
159  else if (d->definitionType()==Definition::TypeClass)
160  {
161  insertClass((ClassDef *)d);
162  }
163 }
164 
166 {
167  if (classSDict->find(cd->name())==0)
168  {
169  if (Config_getBool(SORT_BRIEF_DOCS))
170  classSDict->inSort(cd->name(),cd);
171  else
172  classSDict->append(cd->name(),cd);
173  }
174 }
175 
177 {
178  if (namespaceSDict->find(nd->name())==0)
179  {
180  if (Config_getBool(SORT_MEMBER_DOCS))
181  namespaceSDict->inSort(nd->name(),nd);
182  else
183  namespaceSDict->append(nd->name(),nd);
184  }
185 }
186 
187 
189 {
190  QListIterator<MemberList> mli(m_memberLists);
191  MemberList *ml;
192  for (mli.toFirst();(ml=mli.current());++mli)
193  {
195  {
197  }
198  }
199 
200  // add members inside sections to their groups
201  if (memberGroupSDict)
202  {
204  MemberGroup *mg;
205  for (;(mg=mgli.current());++mgli)
206  {
208  {
209  //printf("----> addToDeclarationSection(%s)\n",mg->header().data());
211  }
212  }
213  }
214 }
215 
217 {
218  if (md->isHidden()) return;
220  if (allMemberList==0)
221  {
222  allMemberList = new MemberList(MemberListType_allMembersList);
223  m_memberLists.append(allMemberList);
224  }
225  allMemberList->append(md);
226  if (m_allMembersDict==0)
227  {
229  }
230  //printf("%s::m_allMembersDict->append(%s)\n",name().data(),md->localName().data());
231  m_allMembersDict->append(md->localName(),md);
232  //::addNamespaceMemberNameToIndex(md);
233  //static bool sortBriefDocs=Config_getBool(SORT_BRIEF_DOCS);
234  switch(md->memberType())
235  {
236  case MemberType_Variable:
239  break;
240  case MemberType_Function:
243  break;
244  case MemberType_Typedef:
247  break;
251  break;
252  case MemberType_EnumValue:
253  break;
254  case MemberType_Define:
257  break;
258  default:
259  err("NamespaceDef::insertMembers(): "
260  "member `%s' with class scope `%s' inserted in namespace scope `%s'!\n",
261  md->name().data(),
262  md->getClassDef() ? md->getClassDef()->name().data() : "",
263  name().data());
264  }
265 }
266 
268 {
270  if (allMemberList) setAnchors(allMemberList);
271 }
272 
274 {
275  static bool repeatBrief = Config_getBool(REPEAT_BRIEF);
276  return ((!briefDescription().isEmpty() && repeatBrief) ||
277  !documentation().isEmpty());
278 }
279 
281 {
282  tagFile << " <compound kind=\"namespace\">" << endl;
283  tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
284  tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
285  QCString idStr = id();
286  if (!idStr.isEmpty())
287  {
288  tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>" << endl;
289  }
290  QListIterator<LayoutDocEntry> eli(
292  LayoutDocEntry *lde;
293  for (eli.toFirst();(lde=eli.current());++eli)
294  {
295  switch (lde->kind())
296  {
298  {
299  if (namespaceSDict)
300  {
302  NamespaceDef *nd;
303  for (ni.toFirst();(nd=ni.current());++ni)
304  {
305  if (nd->isLinkableInProject())
306  {
307  tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
308  }
309  }
310  }
311  }
312  break;
314  {
315  if (classSDict)
316  {
318  ClassDef *cd;
319  for (ci.toFirst();(cd=ci.current());++ci)
320  {
321  if (cd->isLinkableInProject())
322  {
323  tagFile << " <class kind=\"" << cd->compoundTypeString()
324  << "\">" << convertToXML(cd->name()) << "</class>" << endl;
325  }
326  }
327  }
328  }
330  {
332  MemberList * ml = getMemberList(lmd->type);
333  if (ml)
334  {
335  ml->writeTagFile(tagFile);
336  }
337  }
338  break;
340  {
341  if (memberGroupSDict)
342  {
344  MemberGroup *mg;
345  for (;(mg=mgli.current());++mgli)
346  {
347  mg->writeTagFile(tagFile);
348  }
349  }
350  }
351  break;
352  default:
353  break;
354  }
355  }
356  writeDocAnchorsToTagFile(tagFile);
357  tagFile << " </compound>" << endl;
358 }
359 
360 void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title)
361 {
363  {
364  ol.pushGeneratorState();
366  ol.writeRuler();
367  ol.popGeneratorState();
368  ol.pushGeneratorState();
370  ol.writeAnchor(0,"details");
371  ol.popGeneratorState();
372  ol.startGroupHeader();
373  ol.parseText(title);
374  ol.endGroupHeader();
375 
376  ol.startTextBlock();
377  if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF))
378  {
379  ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE);
380  }
381  if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) &&
382  !documentation().isEmpty())
383  {
384  ol.pushGeneratorState();
387  //ol.newParagraph(); // FIXME:PARA
388  ol.enableAll();
391  ol.writeString("\n\n");
392  ol.popGeneratorState();
393  }
394  if (!documentation().isEmpty())
395  {
396  ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE);
397  }
398  ol.endTextBlock();
399  }
400 }
401 
403 {
404  if (hasBriefDescription())
405  {
406  DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0,
407  briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
408  if (rootNode && !rootNode->isEmpty())
409  {
410  ol.startParagraph();
411  ol.writeDoc(rootNode,this,0);
412  ol.pushGeneratorState();
414  ol.writeString(" \n");
416 
418  {
420  ol.startTextLink(0,"details");
422  ol.endTextLink();
423  }
424  ol.popGeneratorState();
425  ol.endParagraph();
426  }
427  delete rootNode;
428 
429  // FIXME:PARA
430  //ol.pushGeneratorState();
431  //ol.disable(OutputGenerator::RTF);
432  //ol.newParagraph();
433  //ol.popGeneratorState();
434  }
435  ol.writeSynopsis();
436 }
437 
439 {
440  ol.startMemberSections();
441 }
442 
444 {
445  ol.endMemberSections();
446 }
447 
449 {
450  if (Config_getBool(SEPARATE_MEMBER_PAGES))
451  {
454  }
455 }
456 
458 {
459  if (Config_getBool(SEPARATE_MEMBER_PAGES))
460  {
463  }
464 }
465 
466 void NamespaceDef::writeClassDeclarations(OutputList &ol,const QCString &title)
467 {
468  if (classSDict) classSDict->writeDeclaration(ol,0,title,TRUE);
469 }
470 
472 {
474 }
475 
477  bool const isConstantGroup)
478 {
479  if (namespaceSDict) namespaceSDict->writeDeclaration(ol,title,isConstantGroup,TRUE);
480 }
481 
483 {
484  /* write user defined member groups */
485  if (memberGroupSDict)
486  {
489  MemberGroup *mg;
490  for (;(mg=mgli.current());++mgli)
491  {
492  if ((!mg->allMembersInSameSection() || !m_subGrouping)
493  && mg->header()!="[NOHEADER]")
494  {
495  mg->writeDeclarations(ol,0,this,0,0);
496  }
497  }
498  }
499 }
500 
502 {
503  // write Author section (Man only)
504  ol.pushGeneratorState();
506  ol.startGroupHeader();
507  ol.parseText(theTranslator->trAuthor(TRUE,TRUE));
508  ol.endGroupHeader();
510  ol.popGeneratorState();
511 }
512 
514 {
515  ol.pushGeneratorState();
517  QListIterator<LayoutDocEntry> eli(
519  LayoutDocEntry *lde;
520  bool first=TRUE;
521  SrcLangExt lang = getLanguage();
522  for (eli.toFirst();(lde=eli.current());++eli)
523  {
526  )
527  {
529  QCString label = lde->kind()==LayoutDocEntry::NamespaceClasses ? "nested-classes" : "namespaces";
530  ol.writeSummaryLink(0,label,ls->title(lang),first);
531  first=FALSE;
532  }
533  else if (lde->kind()== LayoutDocEntry::MemberDecl)
534  {
536  MemberList * ml = getMemberList(lmd->type);
537  if (ml && ml->declVisible())
538  {
539  ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
540  first=FALSE;
541  }
542  }
543  }
544  if (!first)
545  {
546  ol.writeString(" </div>\n");
547  }
548  ol.popGeneratorState();
549 }
550 
552 {
553  // UNO IDL constant groups may be published
555  {
556  ol.pushGeneratorState();
558  ol.startLabels();
559  ol.writeLabel("published",false);
560  ol.endLabels();
561  ol.popGeneratorState();
562  }
563 }
564 
566 {
567  static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
568  //static bool outputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
569  //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
570 
571  QCString pageTitle = title();
572  startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_NamespaceVisible,!generateTreeView);
573 
574  if (!generateTreeView)
575  {
577  {
579  }
580  ol.endQuickIndices();
581  }
582 
583  startTitle(ol,getOutputFileBase(),this);
584  ol.parseText(pageTitle);
585  addGroupListToTitle(ol,this);
588  ol.startContents();
589 
591  {
594  }
595 
597 
598  //---------------------------------------- start flexible part -------------------------------
599 
600  SrcLangExt lang = getLanguage();
601  QListIterator<LayoutDocEntry> eli(
603  LayoutDocEntry *lde;
604  for (eli.toFirst();(lde=eli.current());++eli)
605  {
606  switch (lde->kind())
607  {
610  break;
613  break;
615  {
617  writeClassDeclarations(ol,ls->title(lang));
618  }
619  break;
621  {
623  writeNamespaceDeclarations(ol,ls->title(lang),false);
624  }
625  break;
627  {
629  writeNamespaceDeclarations(ol,ls->title(lang),true);
630  }
631  break;
633  writeMemberGroups(ol);
634  break;
636  {
638  writeMemberDeclarations(ol,lmd->type,lmd->title(lang));
639  }
640  break;
643  break;
645  {
647  writeDetailedDescription(ol,ls->title(lang));
648  }
649  break;
652  break;
654  writeInlineClasses(ol);
655  break;
657  {
659  writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
660  }
661  break;
664  break;
666  writeAuthorSection(ol);
667  break;
694  err("Internal inconsistency: member %d should not be part of "
695  "LayoutDocManager::Namespace entry list\n",lde->kind());
696  break;
697  }
698  }
699 
700  //---------------------------------------- end flexible part -------------------------------
701 
702  ol.endContents();
703 
704  endFileWithNavPath(this,ol);
705 
706  if (Config_getBool(SEPARATE_MEMBER_PAGES))
707  {
709  if (allMemberList) allMemberList->sort();
710  writeMemberPages(ol);
711  }
712 }
713 
715 {
716  ol.pushGeneratorState();
718 
719  QListIterator<MemberList> mli(m_memberLists);
720  MemberList *ml;
721  for (mli.toFirst();(ml=mli.current());++mli)
722  {
724  {
725  ml->writeDocumentationPage(ol,displayName(),this);
726  }
727  }
728  ol.popGeneratorState();
729 }
730 
732 {
733  static bool createSubDirs=Config_getBool(CREATE_SUBDIRS);
734 
735  ol.writeString(" <div class=\"navtab\">\n");
736  ol.writeString(" <table>\n");
737 
739  if (allMemberList)
740  {
741  MemberListIterator mli(*allMemberList);
742  MemberDef *md;
743  for (mli.toFirst();(md=mli.current());++mli)
744  {
745  if (md->getNamespaceDef()==this && md->isLinkable() && !md->isEnumValue())
746  {
747  ol.writeString(" <tr><td class=\"navtab\">");
748  if (md->isLinkableInProject())
749  {
750  if (md==currentMd) // selected item => highlight
751  {
752  ol.writeString("<a class=\"qindexHL\" ");
753  }
754  else
755  {
756  ol.writeString("<a class=\"qindex\" ");
757  }
758  ol.writeString("href=\"");
759  if (createSubDirs) ol.writeString("../../");
761  ol.writeString("\">");
763  ol.writeString("</a>");
764  }
765  ol.writeString("</td></tr>\n");
766  }
767  }
768  }
769 
770  ol.writeString(" </table>\n");
771  ol.writeString(" </div>\n");
772 }
773 
775 {
777  if (allMemberList) allMemberList->countDocMembers();
778  return (allMemberList ? allMemberList->numDocMembers() : 0)+classSDict->count();
779 }
780 
782 {
783  if (usingDirList==0)
784  {
786  }
787  if (usingDirList->find(nd->qualifiedName())==0)
788  {
789  usingDirList->append(nd->qualifiedName(),nd);
790  }
791  //printf("%p: NamespaceDef::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count());
792 }
793 
795 {
796  //printf("%p: NamespaceDef::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0);
797  return usingDirList;
798 }
799 
801 {
802  if (usingDeclList==0)
803  {
805  }
806  if (usingDeclList->find(d->qualifiedName())==0)
807  {
809  }
810 }
811 
813 {
814  return fileName;
815 }
816 
818 {
819  if (n==0) return 0;
821  if (d==0)
822  {
823  if (usingDirList)
824  {
825  d = usingDirList->find(n);
826  }
827  if (d==0 && usingDeclList)
828  {
829  d = usingDeclList->find(n);
830  }
831  }
832  return d;
833 }
834 
836 {
837  //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
838  {
839  QList<ListItemInfo> *xrefItems = xrefListItems();
840  addRefItem(xrefItems,
841  qualifiedName(),
843  theTranslator->trModule(TRUE,TRUE) :
844  theTranslator->trNamespace(TRUE,TRUE),
846  0,
847  this
848  );
849  }
851  MemberGroup *mg;
852  for (;(mg=mgli.current());++mgli)
853  {
854  mg->addListReferences(this);
855  }
856  QListIterator<MemberList> mli(m_memberLists);
857  MemberList *ml;
858  for (mli.toFirst();(ml=mli.current());++mli)
859  {
861  {
862  ml->addListReferences(this);
863  }
864  }
865 }
866 
867 QCString NamespaceDef::displayName(bool includeScope) const
868 {
869  QCString result=includeScope ? name() : localName();
870  SrcLangExt lang = getLanguage();
871  QCString sep = getLanguageSpecificSeparator(lang);
872  if (sep!="::")
873  {
874  result = substitute(result,"::",sep);
875  }
876  //printf("NamespaceDef::displayName() %s->%s lang=%d\n",name().data(),result.data(),lang);
877  return result;
878 }
879 
880 QCString NamespaceDef::localName() const
881 {
882  QCString result=name();
883  int i=result.findRev("::");
884  if (i!=-1)
885  {
886  result=result.mid(i+2);
887  }
888  return result;
889 }
890 
892 {
893  if (visited) return; // already done
894  visited=TRUE;
895  if (usingDirList)
896  {
898  NamespaceDef *nd;
899  for (nli.toFirst();(nd=nli.current());++nli)
900  {
901  nd->combineUsingRelations();
902  }
903  for (nli.toFirst();(nd=nli.current());++nli)
904  {
905  // add used namespaces of namespace nd to this namespace
906  if (nd->getUsedNamespaces())
907  {
909  NamespaceDef *und;
910  for (unli.toFirst();(und=unli.current());++unli)
911  {
912  //printf("Adding namespace %s to the using list of %s\n",und->qualifiedName().data(),qualifiedName().data());
913  addUsingDirective(und);
914  }
915  }
916  // add used classes of namespace nd to this namespace
917  if (nd->getUsedClasses())
918  {
920  Definition *ucd;
921  for (cli.toFirst();(ucd=cli.current());++cli)
922  {
923  //printf("Adding class %s to the using list of %s\n",cd->qualifiedName().data(),qualifiedName().data());
924  addUsingDeclaration(ucd);
925  }
926  }
927  }
928  }
929 }
930 
932 {
934  NamespaceDef *nd;
935  for (ni.toFirst();(nd=ni.current());++ni)
936  {
937  if (nd->isLinkable())
938  {
939  return TRUE;
940  }
941  }
942  return FALSE;
943 }
944 
945 void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
946  bool const isConstantGroup,bool localName)
947 {
948 
949 
950  if (count()==0) return; // no namespaces in the list
951 
952  if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) return;
953 
954 
956  NamespaceDef *nd;
957  bool found=FALSE;
958  for (ni.toFirst();(nd=ni.current()) && !found;++ni)
959  {
960  if (nd->isLinkable())
961  {
962  SrcLangExt lang = nd->getLanguage();
963  if (SrcLangExt_IDL==lang)
964  {
965  if (isConstantGroup == nd->isConstantGroup())
966  {
967  found=TRUE;
968  break;
969  }
970  }
971  else if (!isConstantGroup) // ensure we only get extra section in IDL
972  {
973  if (nd->isConstantGroup())
974  {
975  err("Internal inconsistency: constant group but not IDL?\n");
976  }
977  found=TRUE;
978  break;
979  }
980  }
981  }
982  if (!found) return; // no linkable namespaces in the list
983 
984  // write list of namespaces
985  ol.startMemberHeader("namespaces");
986  //bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
987  //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
988  ol.parseText(title);
989  ol.endMemberHeader();
990  ol.startMemberList();
991  for (ni.toFirst();(nd=ni.current());++ni)
992  {
993  if (nd->isLinkable() && nd->hasDocumentation())
994  {
995  SrcLangExt lang = nd->getLanguage();
996  if (lang==SrcLangExt_IDL && (isConstantGroup != nd->isConstantGroup()))
997  continue; // will be output in another pass, see layout_default.xml
1000  QCString ct = nd->compoundTypeString();
1001  ol.docify(ct);
1002  ol.docify(" ");
1003  ol.insertMemberAlign();
1004  QCString name;
1005  if (localName)
1006  {
1007  name = nd->localName();
1008  }
1009  else
1010  {
1011  name = nd->displayName();
1012  }
1013  ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name);
1014  ol.endMemberItem();
1015  if (!nd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
1016  {
1018  ol.generateDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE,0,TRUE);
1019  ol.endMemberDescription();
1020  }
1021  ol.endMemberDeclaration(0,0);
1022  }
1023  }
1024  ol.endMemberList();
1025 }
1026 
1028 {
1029  m_memberLists.setAutoDelete(TRUE);
1030  QListIterator<MemberList> mli(m_memberLists);
1031  MemberList *ml;
1032  for (mli.toFirst();(ml=mli.current());++mli)
1033  {
1034  if (ml->listType()==lt)
1035  {
1036  return ml;
1037  }
1038  }
1039  // not found, create a new member list
1040  ml = new MemberList(lt);
1041  m_memberLists.append(ml);
1042  return ml;
1043 }
1044 
1046 {
1047  static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
1048  static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
1049  MemberList *ml = createMemberList(lt);
1050  ml->setNeedsSorting(
1051  ((ml->listType()&MemberListType_declarationLists) && sortBriefDocs) ||
1052  ((ml->listType()&MemberListType_documentationLists) && sortMemberDocs));
1053  ml->append(md);
1054 
1055 #if 0
1056  if (ml->needsSorting())
1057  ml->inSort(md);
1058  else
1059  ml->append(md);
1060 #endif
1061 
1063 }
1064 
1066 {
1067  QListIterator<MemberList> mli(m_memberLists);
1068  MemberList *ml;
1069  for (mli.toFirst();(ml=mli.current());++mli)
1070  {
1071  if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); }
1072  }
1073  if (classSDict)
1074  {
1075  classSDict->sort();
1076  }
1077  if (namespaceSDict)
1078  {
1079  namespaceSDict->sort();
1080  }
1081 }
1082 
1083 
1084 
1086 {
1087  QListIterator<MemberList> mli(m_memberLists);
1088  MemberList *ml;
1089  for (mli.toFirst();(ml=mli.current());++mli)
1090  {
1091  if (ml->listType()==lt)
1092  {
1093  return ml;
1094  }
1095  }
1096  return 0;
1097 }
1098 
1100 {
1101  MemberList * ml = getMemberList(lt);
1102  if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0);
1103 }
1104 
1106 {
1107  MemberList * ml = getMemberList(lt);
1108  if (ml) ml->writeDocumentation(ol,displayName(),this,title);
1109 }
1110 
1111 
1113 {
1114  int i = name().findRev("::");
1115  if (i==-1) i=0; else i+=2;
1116  static bool extractAnonNs = Config_getBool(EXTRACT_ANON_NSPACES);
1117  if (extractAnonNs && // extract anonymous ns
1118  name().mid(i,20)=="anonymous_namespace{" // correct prefix
1119  ) // not disabled by config
1120  {
1121  return TRUE;
1122  }
1123  return !name().isEmpty() && name().at(i)!='@' && // not anonymous
1124  (hasDocumentation() || getLanguage()==SrcLangExt_CSharp) && // documented
1125  !isReference() && // not an external reference
1126  !isHidden() && // not hidden
1127  !isArtificial(); // or artificial
1128 }
1129 
1131 {
1132  return isLinkableInProject() || isReference();
1133 }
1134 
1135 MemberDef * NamespaceDef::getMemberByName(const QCString &n) const
1136 {
1137  MemberDef *md = 0;
1138  if (m_allMembersDict && !n.isEmpty())
1139  {
1140  md = m_allMembersDict->find(n);
1141  //printf("%s::m_allMembersDict->find(%s)=%p\n",name().data(),n.data(),md);
1142  }
1143  return md;
1144 }
1145 
1146 QCString NamespaceDef::title() const
1147 {
1148  SrcLangExt lang = getLanguage();
1149  QCString pageTitle;
1150  if (lang==SrcLangExt_Java)
1151  {
1152  pageTitle = theTranslator->trPackage(displayName());
1153  }
1154  else if (lang==SrcLangExt_Fortran)
1155  {
1157  }
1158  else if (lang==SrcLangExt_IDL)
1159  {
1160  pageTitle = isConstantGroup()
1163  }
1164  else
1165  {
1167  }
1168  return pageTitle;
1169 }
1170 
1172 {
1173  SrcLangExt lang = getLanguage();
1174  if (lang==SrcLangExt_Java)
1175  {
1176  return "package";
1177  }
1178  else if(lang==SrcLangExt_CSharp)
1179  {
1180  return "namespace";
1181  }
1182  else if (lang==SrcLangExt_Fortran)
1183  {
1184  return "module";
1185  }
1186  else if (lang==SrcLangExt_IDL)
1187  {
1188  if (isModule())
1189  {
1190  return "module";
1191  }
1192  else if (isConstantGroup())
1193  {
1194  return "constants";
1195  }
1196  else if (isLibrary())
1197  {
1198  return "library";
1199  }
1200  else
1201  {
1202  err_full(getDefFileName(),getDefLine(),"Internal inconsistency: namespace in IDL not module, library or constant group");
1203  }
1204  }
1205  return "";
1206 }
1207