1 /******************************************************************************
5 * Copyright (C) 1997-2014 by Dimitri van Heesch.
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.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
22 #include "classlist.h"
25 #include "membername.h"
33 #include "outputlist.h"
37 #include "docparser.h"
38 #include "searchindex.h"
39 #include "vhdldocgen.h"
41 #include "arguments.h"
42 #include "memberlist.h"
45 #include "namespacedef.h"
46 #include "membergroup.h"
48 //-----------------------------------------------------------------------------
50 /** Private data associated with a ClassDef object. */
56 void init(const char *defFileName, const char *name,
57 const QCString &ctStr, const char *fName);
59 /*! file name that forms the base for the output file containing the
60 * class documentation. For compatibility with Qt (e.g. links via tag
61 * files) this name cannot be derived from the class name directly.
65 /*! Include information about the header file should be included
66 * in the documentation. 0 by default, set by setIncludeFile().
70 /*! List of base class (or super-classes) from which this class derives
73 BaseClassList *inherits;
75 /*! List of sub-classes that directly derive from this class
77 BaseClassList *inheritedBy;
79 /*! Namespace this class is part of
80 * (this is the inner most namespace in case of nested namespaces)
84 /*! File this class is defined in */
87 /*! List of all members (including inherited members) */
88 MemberNameInfoSDict *allMemberNameInfoSDict;
90 /*! Template arguments of this class */
91 ArgumentList *tempArgs;
93 /*! Type constraints for template parameters */
94 ArgumentList *typeConstraints;
96 /*! Files that were used for generating the class documentation. */
99 /*! Examples that use this class */
100 ExampleSDict *exampleSDict;
102 /*! Holds the kind of "class" this is. */
103 ClassDef::CompoundType compType;
105 /*! The protection level in which this class was found.
106 * Typically Public, but for nested classes this can also be Protected
111 /*! The inner classes contained in this class. Will be 0 if there are
114 ClassSDict *innerClasses;
116 /* classes for the collaboration diagram */
117 UsesClassDict *usesImplClassDict;
118 UsesClassDict *usedByImplClassDict;
119 UsesClassDict *usesIntfClassDict;
121 /*! Template instances that exists of this class, the key in the
122 * dictionary is the template argument list.
124 QDict<ClassDef> *templateInstances;
126 /*! Template instances that exists of this class, as defined by variables.
127 * We do NOT want to document these individually. The key in the
128 * dictionary is the template argument list.
130 QDict<ClassDef> *variableInstances;
132 QDict<int> *templBaseClassNames;
134 /*! The class this class is an instance of. */
135 ClassDef *templateMaster;
137 /*! local class name which could be a typedef'ed alias name. */
140 /*! If this class is a Objective-C category, then this points to the
141 * class which is extended.
143 ClassDef *categoryOf;
145 QList<MemberList> memberLists;
147 /* user defined member groups */
148 MemberGroupSDict *memberGroupSDict;
150 /*! Is this an abstact class? */
153 /*! Is the class part of an unnamed namespace? */
156 /*! TRUE if classes members are merged with those of the base classes. */
159 /*! TRUE if the class is defined in a source file rather than a header file. */
164 /*! Does this class group its user-grouped members
165 * as a sub-section of the normal (public/protected/..)
170 /** Reason of existence is a "use" relation */
173 /** List of titles to use for the summary */
174 SDict<QCString> vhdlSummaryTitles;
176 /** Is this a simple (non-nested) C structure? */
179 /** Does this class overloaded the -> operator? */
180 MemberDef *arrowOperator;
182 ClassList *taggedInnerClasses;
183 ClassDef *tagLessRef;
185 /** Does this class represent a Java style enum? */
193 void ClassDefImpl::init(const char *defFileName, const char *name,
194 const QCString &ctStr, const char *fName)
198 fileName=stripExtension(fName);
207 allMemberNameInfoSDict = 0;
215 usedByImplClassDict=0;
217 memberGroupSDict = 0;
219 subGrouping=Config_getBool("SUBGROUPING");
220 templateInstances = 0;
221 variableInstances = 0;
223 templBaseClassNames = 0;
227 membersMerged = FALSE;
230 isSimple = Config_getBool("INLINE_SIMPLE_STRUCTS");
232 taggedInnerClasses = 0;
236 //extractNamespaceName(name,className,ns);
237 //printf("m_name=%s m_className=%s ns=%s\n",m_name.data(),m_className.data(),ns.data());
239 // we cannot use getLanguage at this point, as setLanguage has not been called.
240 SrcLangExt lang = getLanguageFromFileName(defFileName);
241 if ((lang==SrcLangExt_Cpp || lang==SrcLangExt_ObjC) &&
242 guessSection(defFileName)==Entry::SOURCE_SEC)
250 isGeneric = lang==SrcLangExt_CSharp && QCString(name).find('<')!=-1;
253 ClassDefImpl::ClassDefImpl() : vhdlSummaryTitles(17)
255 vhdlSummaryTitles.setAutoDelete(TRUE);
258 ClassDefImpl::~ClassDefImpl()
262 delete allMemberNameInfoSDict;
264 delete usesImplClassDict;
265 delete usedByImplClassDict;
266 delete usesIntfClassDict;
268 delete memberGroupSDict;
270 delete templateInstances;
271 delete variableInstances;
272 delete templBaseClassNames;
274 delete typeConstraints;
275 delete taggedInnerClasses;
278 // constructs a new class definition
280 const char *defFileName,int defLine,int defColumn,
281 const char *nm,CompoundType ct,
282 const char *lref,const char *fName,
283 bool isSymbol,bool isJavaEnum)
284 : Definition(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol)
288 m_impl = new ClassDefImpl;
289 m_impl->compType = ct;
290 m_impl->isJavaEnum = isJavaEnum;
291 m_impl->init(defFileName,name(),compoundTypeString(),fName);
294 // destroy the class definition
295 ClassDef::~ClassDef()
300 QCString ClassDef::getMemberListFileName() const
302 return convertNameToFile(compoundTypeString()+name()+"-members");
305 QCString ClassDef::displayName(bool includeScope) const
307 //static bool optimizeOutputForJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
308 SrcLangExt lang = getLanguage();
309 //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
311 if (lang==SrcLangExt_VHDL)
313 n = VhdlDocGen::getClassName(this);
319 n=qualifiedNameWithTemplateParameters();
326 QCString sep=getLanguageSpecificSeparator(lang);
329 n=substitute(n,"::",sep);
331 if (m_impl->compType==ClassDef::Protocol && n.right(2)=="-p")
333 n="<"+n.left(n.length()-2)+">";
335 //else if (n.right(2)=="-g")
337 // n = n.left(n.length()-2);
339 //printf("ClassDef::displayName()=%s\n",n.data());
342 return removeAnonymousScopes(n);
350 // inserts a base/super class in the inheritance list
351 void ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p,
352 Specifier s,const char *t)
354 //printf("*** insert base class %s into %s\n",cd->name().data(),name().data());
355 //inherits->inSort(new BaseClassDef(cd,p,s,t));
356 if (m_impl->inherits==0)
358 m_impl->inherits = new BaseClassList;
359 m_impl->inherits->setAutoDelete(TRUE);
361 m_impl->inherits->append(new BaseClassDef(cd,n,p,s,t));
362 m_impl->isSimple = FALSE;
365 // inserts a derived/sub class in the inherited-by list
366 void ClassDef::insertSubClass(ClassDef *cd,Protection p,
367 Specifier s,const char *t)
369 //printf("*** insert sub class %s into %s\n",cd->name().data(),name().data());
370 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
371 if (!extractPrivate && cd->protection()==Private) return;
372 if (m_impl->inheritedBy==0)
374 m_impl->inheritedBy = new BaseClassList;
375 m_impl->inheritedBy->setAutoDelete(TRUE);
377 m_impl->inheritedBy->inSort(new BaseClassDef(cd,0,p,s,t));
378 m_impl->isSimple = FALSE;
381 void ClassDef::addMembersToMemberGroup()
383 QListIterator<MemberList> mli(m_impl->memberLists);
385 for (mli.toFirst();(ml=mli.current());++mli)
387 if ((ml->listType()&MemberListType_detailedLists)==0)
389 ::addMembersToMemberGroup(ml,&m_impl->memberGroupSDict,this);
393 // add members inside sections to their groups
394 if (m_impl->memberGroupSDict)
396 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
398 for (;(mg=mgli.current());++mgli)
400 if (mg->allMembersInSameSection() && m_impl->subGrouping)
402 //printf("addToDeclarationSection(%s)\n",mg->header().data());
403 mg->addToDeclarationSection();
409 // adds new member definition to the class
410 void ClassDef::internalInsertMember(MemberDef *md,
415 //printf("insertInternalMember(%s) isHidden()=%d\n",md->name().data(),md->isHidden());
416 if (md->isHidden()) return;
418 if (getLanguage()==SrcLangExt_VHDL)
420 QCString title=VhdlDocGen::trVhdlType(md->getMemberSpecifiers(),FALSE);
421 if (!m_impl->vhdlSummaryTitles.find(title))
423 m_impl->vhdlSummaryTitles.append(title,new QCString(title));
427 if (1 /*!isReference()*/) // changed to 1 for showing members of external
428 // classes when HAVE_DOT and UML_LOOK are enabled.
432 /********************************************/
433 /* insert member in the declaration section */
434 /********************************************/
435 if (md->isRelated() && protectionLevelVisible(prot))
437 addMemberToList(MemberListType_related,md,TRUE);
439 else if (md->isFriend())
441 addMemberToList(MemberListType_friends,md,TRUE);
445 switch (md->memberType())
447 case MemberType_Service: // UNO IDL
448 addMemberToList(MemberListType_services,md,TRUE);
450 case MemberType_Interface: // UNO IDL
451 addMemberToList(MemberListType_interfaces,md,TRUE);
453 case MemberType_Signal: // Qt specific
454 addMemberToList(MemberListType_signals,md,TRUE);
456 case MemberType_DCOP: // KDE2 specific
457 addMemberToList(MemberListType_dcopMethods,md,TRUE);
459 case MemberType_Property:
460 addMemberToList(MemberListType_properties,md,TRUE);
462 case MemberType_Event:
463 addMemberToList(MemberListType_events,md,TRUE);
465 case MemberType_Slot: // Qt specific
469 case Package: // slots in packages are not possible!
470 addMemberToList(MemberListType_proSlots,md,TRUE);
473 addMemberToList(MemberListType_pubSlots,md,TRUE);
476 addMemberToList(MemberListType_priSlots,md,TRUE);
480 default: // any of the other members
483 if (md->isVariable())
488 addMemberToList(MemberListType_proStaticAttribs,md,TRUE);
491 addMemberToList(MemberListType_pacStaticAttribs,md,TRUE);
494 addMemberToList(MemberListType_pubStaticAttribs,md,TRUE);
497 addMemberToList(MemberListType_priStaticAttribs,md,TRUE);
506 addMemberToList(MemberListType_proStaticMethods,md,TRUE);
509 addMemberToList(MemberListType_pacStaticMethods,md,TRUE);
512 addMemberToList(MemberListType_pubStaticMethods,md,TRUE);
515 addMemberToList(MemberListType_priStaticMethods,md,TRUE);
522 if (md->isVariable())
527 addMemberToList(MemberListType_proAttribs,md,TRUE);
530 addMemberToList(MemberListType_pacAttribs,md,TRUE);
533 addMemberToList(MemberListType_pubAttribs,md,TRUE);
534 isSimple=!md->isFunctionPtr();
537 addMemberToList(MemberListType_priAttribs,md,TRUE);
541 else if (md->isTypedef() || md->isEnumerate() || md->isEnumValue())
546 addMemberToList(MemberListType_proTypes,md,TRUE);
549 addMemberToList(MemberListType_pacTypes,md,TRUE);
552 addMemberToList(MemberListType_pubTypes,md,TRUE);
553 isSimple=QCString(md->typeString()).find(")(")==-1;
556 addMemberToList(MemberListType_priTypes,md,TRUE);
560 else // member function
565 addMemberToList(MemberListType_proMethods,md,TRUE);
568 addMemberToList(MemberListType_pacMethods,md,TRUE);
571 addMemberToList(MemberListType_pubMethods,md,TRUE);
574 addMemberToList(MemberListType_priMethods,md,TRUE);
582 if (!isSimple) // not a simple field -> not a simple struct
584 m_impl->isSimple = FALSE;
586 //printf("adding %s simple=%d total_simple=%d\n",name().data(),isSimple,m_impl->isSimple);
588 /*******************************************************/
589 /* insert member in the detailed documentation section */
590 /*******************************************************/
591 if ((md->isRelated() && protectionLevelVisible(prot)) || md->isFriend())
593 addMemberToList(MemberListType_relatedMembers,md,FALSE);
597 switch (md->memberType())
599 case MemberType_Service: // UNO IDL
600 addMemberToList(MemberListType_serviceMembers,md,FALSE);
602 case MemberType_Interface: // UNO IDL
603 addMemberToList(MemberListType_interfaceMembers,md,FALSE);
605 case MemberType_Property:
606 addMemberToList(MemberListType_propertyMembers,md,FALSE);
608 case MemberType_Event:
609 addMemberToList(MemberListType_eventMembers,md,FALSE);
611 case MemberType_Signal: // fall through
612 case MemberType_DCOP:
613 addMemberToList(MemberListType_functionMembers,md,FALSE);
615 case MemberType_Slot:
616 if (protectionLevelVisible(prot))
618 addMemberToList(MemberListType_functionMembers,md,FALSE);
621 default: // any of the other members
622 if (protectionLevelVisible(prot))
624 switch (md->memberType())
626 case MemberType_Typedef:
627 addMemberToList(MemberListType_typedefMembers,md,FALSE);
629 case MemberType_Enumeration:
630 addMemberToList(MemberListType_enumMembers,md,FALSE);
632 case MemberType_EnumValue:
633 addMemberToList(MemberListType_enumValMembers,md,FALSE);
635 case MemberType_Function:
636 if (md->isConstructor() || md->isDestructor())
638 MemberList *ml = createMemberList(MemberListType_constructors);
643 addMemberToList(MemberListType_functionMembers,md,FALSE);
646 case MemberType_Variable:
647 addMemberToList(MemberListType_variableMembers,md,FALSE);
650 err("Unexpected member type %d found!\n",md->memberType());
657 /*************************************************/
658 /* insert member in the appropriate member group */
659 /*************************************************/
660 // Note: this must be done AFTER inserting the member in the
662 //addMemberToGroup(md,groupId);
666 if (md->virtualness()==Pure)
668 m_impl->isAbstract=TRUE;
671 if (md->name()=="operator->")
673 m_impl->arrowOperator=md;
676 //::addClassMemberNameToIndex(md);
678 !(Config_getBool("HIDE_FRIEND_COMPOUNDS") &&
680 (QCString(md->typeString())=="friend class" ||
681 QCString(md->typeString())=="friend struct" ||
682 QCString(md->typeString())=="friend union")))
684 //printf("=======> adding member %s to class %s\n",md->name().data(),name().data());
685 MemberInfo *mi = new MemberInfo((MemberDef *)md,
686 prot,md->virtualness(),FALSE);
687 MemberNameInfo *mni=0;
688 if (m_impl->allMemberNameInfoSDict==0)
690 m_impl->allMemberNameInfoSDict = new MemberNameInfoSDict(17);
691 m_impl->allMemberNameInfoSDict->setAutoDelete(TRUE);
693 if ((mni=m_impl->allMemberNameInfoSDict->find(md->name())))
699 mni = new MemberNameInfo(md->name());
701 m_impl->allMemberNameInfoSDict->append(mni->memberName(),mni);
706 void ClassDef::insertMember(MemberDef *md)
708 internalInsertMember(md,md->protection(),TRUE);
711 // compute the anchors for all members
712 void ClassDef::computeAnchors()
714 //ClassDef *context = Config_getBool("INLINE_INHERITED_MEMB") ? this : 0;
715 //const char *letters = "abcdefghijklmnopqrstuvwxyz0123456789";
716 QListIterator<MemberList> mli(m_impl->memberLists);
719 for (mli.toFirst();(ml=mli.current());++mli)
721 if ((ml->listType()&MemberListType_detailedLists)==0)
727 if (m_impl->memberGroupSDict)
729 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
731 for (;(mg=mgli.current());++mgli)
738 void ClassDef::distributeMemberGroupDocumentation()
740 if (m_impl->memberGroupSDict)
742 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
744 for (;(mg=mgli.current());++mgli)
746 mg->distributeMemberGroupDocumentation();
751 void ClassDef::findSectionsInDocumentation()
753 docFindSections(documentation(),this,0,docFile());
754 if (m_impl->memberGroupSDict)
756 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
758 for (;(mg=mgli.current());++mgli)
760 mg->findSectionsInDocumentation();
763 QListIterator<MemberList> mli(m_impl->memberLists);
765 for (mli.toFirst();(ml=mli.current());++mli)
767 if ((ml->listType()&MemberListType_detailedLists)==0)
769 ml->findSectionsInDocumentation();
775 // add a file name to the used files set
776 void ClassDef::insertUsedFile(FileDef *fd)
779 if (m_impl->files.find(fd)==-1) m_impl->files.append(fd);
780 if (m_impl->templateInstances)
782 QDictIterator<ClassDef> qdi(*m_impl->templateInstances);
784 for (qdi.toFirst();(cd=qdi.current());++qdi)
786 cd->insertUsedFile(fd);
791 static void writeInheritanceSpecifier(OutputList &ol,BaseClassDef *bcd)
793 if (bcd->prot!=Public || bcd->virt!=Normal)
795 ol.startTypewriter();
798 if (bcd->prot==Protected) sl.append("protected");
799 else if (bcd->prot==Private) sl.append("private");
800 if (bcd->virt==Virtual) sl.append("virtual");
801 const char *s=sl.first();
806 if (s) ol.docify(", ");
813 void ClassDef::setIncludeFile(FileDef *fd,
814 const char *includeName,bool local, bool force)
816 //printf("ClassDef::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force);
817 if (!m_impl->incInfo) m_impl->incInfo=new IncludeInfo;
818 if ((includeName && m_impl->incInfo->includeName.isEmpty()) ||
819 (fd!=0 && m_impl->incInfo->fileDef==0)
822 //printf("Setting file info\n");
823 m_impl->incInfo->fileDef = fd;
824 m_impl->incInfo->includeName = includeName;
825 m_impl->incInfo->local = local;
827 if (force && includeName)
829 m_impl->incInfo->includeName = includeName;
830 m_impl->incInfo->local = local;
834 // TODO: fix this: a nested template class can have multiple outer templates
835 //ArgumentList *ClassDef::outerTemplateArguments() const
840 // if (m_impl->tempArgs) return m_impl->tempArgs;
841 // // find the outer most class scope
842 // while ((ti=name().find("::",pi))!=-1 &&
843 // (pcd=getClass(name().left(ti)))==0
847 // return pcd->templateArguments();
852 static void searchTemplateSpecs(/*in*/ Definition *d,
853 /*out*/ QList<ArgumentList> &result,
854 /*out*/ QCString &name)
856 if (d->definitionType()==Definition::TypeClass)
858 if (d->getOuterScope())
860 searchTemplateSpecs(d->getOuterScope(),result,name);
862 ClassDef *cd=(ClassDef *)d;
863 if (!name.isEmpty()) name+="::";
864 QCString clName = d->localName();
865 if (/*clName.right(2)=="-g" ||*/ clName.right(2)=="-p")
867 clName = clName.left(clName.length()-2);
870 bool isSpecialization = d->localName().find('<')!=-1;
871 if (cd->templateArguments())
873 result.append(cd->templateArguments());
874 if (!isSpecialization)
876 name+=tempArgListToString(cd->templateArguments());
882 name+=d->qualifiedName();
886 static void writeTemplateSpec(OutputList &ol,Definition *d,
887 const QCString &type)
889 QList<ArgumentList> specs;
891 searchTemplateSpecs(d,specs,name);
892 if (specs.count()>0) // class has template scope specifiers
894 ol.startSubsubsection();
895 QListIterator<ArgumentList> spi(specs);
897 for (spi.toFirst();(al=spi.current());++spi)
899 ol.docify("template<");
900 QListIterator<Argument> ali(*al);
902 while ((a=ali.current()))
905 if (!a->name.isEmpty())
910 if (a->defval.length()!=0)
913 ol.docify(a->defval);
917 if (a) ol.docify(", ");
920 ol.pushGeneratorState();
921 ol.disableAllBut(OutputGenerator::Html);
923 ol.popGeneratorState();
925 ol.docify(type.lower()+" "+name);
926 ol.endSubsubsection();
927 ol.writeString("\n");
931 void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag)
933 if (hasBriefDescription())
936 ol.generateDoc(briefFile(),briefLine(),this,0,
937 briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
938 ol.pushGeneratorState();
939 ol.disable(OutputGenerator::RTF);
940 ol.writeString(" \n");
941 ol.enable(OutputGenerator::RTF);
942 ol.popGeneratorState();
944 if (hasDetailedDescription() || exampleFlag)
946 writeMoreLink(ol,anchor());
954 void ClassDef::writeDetailedDocumentationBody(OutputList &ol)
956 static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
960 if (getLanguage()==SrcLangExt_Cpp)
962 writeTemplateSpec(ol,this,compoundTypeString());
965 // repeat brief description
966 if (!briefDescription().isEmpty() && repeatBrief)
968 ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE);
970 if (!briefDescription().isEmpty() && repeatBrief &&
971 !documentation().isEmpty())
973 ol.pushGeneratorState();
974 ol.disable(OutputGenerator::Html);
975 ol.writeString("\n\n");
976 ol.popGeneratorState();
978 // write documentation
979 if (!documentation().isEmpty())
981 ol.generateDoc(docFile(),docLine(),this,0,documentation(),TRUE,FALSE);
983 // write type constraints
984 writeTypeConstraints(ol,this,m_impl->typeConstraints);
987 if (hasExamples() && m_impl->exampleSDict)
989 ol.startSimpleSect(BaseOutputDocInterface::Examples,0,0,theTranslator->trExamples()+": ");
990 ol.startDescForItem();
991 //ol.startParagraph();
992 writeExample(ol,m_impl->exampleSDict);
998 writeSourceDef(ol,name());
1002 bool ClassDef::hasDetailedDescription() const
1004 static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
1005 static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
1006 return ((!briefDescription().isEmpty() && repeatBrief) ||
1007 !documentation().isEmpty() ||
1008 (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()));
1011 // write the detailed description for this class
1012 void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag,
1013 const QCString &title,const QCString &anchor)
1015 if (hasDetailedDescription() || exampleFlag)
1017 ol.pushGeneratorState();
1018 ol.disable(OutputGenerator::Html);
1020 ol.popGeneratorState();
1022 ol.pushGeneratorState();
1023 ol.disableAllBut(OutputGenerator::Html);
1024 ol.writeAnchor(0,anchor.isEmpty() ? QCString("details") : anchor);
1025 ol.popGeneratorState();
1027 if (!anchor.isEmpty())
1029 ol.pushGeneratorState();
1030 ol.disable(OutputGenerator::Html);
1031 ol.disable(OutputGenerator::Man);
1032 ol.writeAnchor(getOutputFileBase(),anchor);
1033 ol.popGeneratorState();
1036 ol.startGroupHeader();
1037 ol.parseText(title);
1038 ol.endGroupHeader();
1040 writeDetailedDocumentationBody(ol);
1044 //writeTemplateSpec(ol,this,pageType);
1048 QCString ClassDef::generatedFromFiles() const
1051 SrcLangExt lang = getLanguage();
1052 if (lang==SrcLangExt_Fortran)
1054 result = theTranslator->trGeneratedFromFilesFortran(
1055 getLanguage()==SrcLangExt_ObjC && m_impl->compType==Interface ? Class : m_impl->compType,
1056 m_impl->files.count()==1);
1058 else if (isJavaEnum())
1060 result = theTranslator->trEnumGeneratedFromFiles(m_impl->files.count()==1);
1062 else if (m_impl->compType==Service)
1064 result = theTranslator->trServiceGeneratedFromFiles(m_impl->files.count()==1);
1066 else if (m_impl->compType==Singleton)
1068 result = theTranslator->trSingletonGeneratedFromFiles(m_impl->files.count()==1);
1072 result = theTranslator->trGeneratedFromFiles(
1073 getLanguage()==SrcLangExt_ObjC && m_impl->compType==Interface ? Class : m_impl->compType,
1074 m_impl->files.count()==1);
1079 void ClassDef::showUsedFiles(OutputList &ol)
1081 ol.pushGeneratorState();
1082 ol.disable(OutputGenerator::Man);
1086 ol.parseText(generatedFromFiles());
1089 QListIterator<FileDef> li(m_impl->files);
1091 for (;(fd=li.current());++li)
1099 ol.startItemListItem();
1100 QCString path=fd->getPath();
1101 if (Config_getBool("FULL_PATH_NAMES"))
1103 ol.docify(stripFromPath(path));
1106 QCString fname = fd->name();
1107 if (!fd->getVersion().isEmpty()) // append version if available
1109 fname += " (" + fd->getVersion() + ")";
1113 ol.pushGeneratorState();
1114 ol.disableAllBut(OutputGenerator::Html);
1115 if (fd->generateSourceFile())
1117 ol.writeObjectLink(0,fd->getSourceFileBase(),0,fname);
1119 else if (fd->isLinkable())
1121 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,
1128 ol.popGeneratorState();
1130 // for other output formats
1131 ol.pushGeneratorState();
1132 ol.disable(OutputGenerator::Html);
1133 if (fd->isLinkable())
1135 ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,
1142 ol.popGeneratorState();
1144 ol.endItemListItem();
1146 if (!first) ol.endItemList();
1148 ol.popGeneratorState();
1151 int ClassDef::countInheritanceNodes()
1155 if (m_impl->inheritedBy)
1157 BaseClassListIterator it(*m_impl->inheritedBy);
1158 for (;(ibcd=it.current());++it)
1160 ClassDef *icd=ibcd->classDef;
1161 if ( icd->isVisibleInHierarchy()) count++;
1164 if (m_impl->inherits)
1166 BaseClassListIterator it(*m_impl->inherits);
1167 for (;(ibcd=it.current());++it)
1169 ClassDef *icd=ibcd->classDef;
1170 if ( icd->isVisibleInHierarchy()) count++;
1176 void ClassDef::writeInheritanceGraph(OutputList &ol)
1178 // count direct inheritance relations
1179 int count=countInheritanceNodes();
1181 bool renderDiagram = FALSE;
1182 if (Config_getBool("HAVE_DOT") &&
1183 (Config_getBool("CLASS_DIAGRAMS") || Config_getBool("CLASS_GRAPH")))
1184 // write class diagram using dot
1186 DotClassGraph inheritanceGraph(this,DotNode::Inheritance);
1187 if (!inheritanceGraph.isTrivial() && !inheritanceGraph.isTooBig())
1189 ol.pushGeneratorState();
1190 ol.disable(OutputGenerator::Man);
1192 ol.parseText(theTranslator->trClassDiagram(displayName()));
1193 ol.endDotGraph(inheritanceGraph);
1194 ol.popGeneratorState();
1195 renderDiagram = TRUE;
1198 else if (Config_getBool("CLASS_DIAGRAMS") && count>0)
1199 // write class diagram using build-in generator
1201 ClassDiagram diagram(this); // create a diagram of this class.
1202 ol.startClassDiagram();
1203 ol.disable(OutputGenerator::Man);
1204 ol.parseText(theTranslator->trClassDiagram(displayName()));
1205 ol.enable(OutputGenerator::Man);
1206 ol.endClassDiagram(diagram,getOutputFileBase(),displayName());
1207 renderDiagram = TRUE;
1210 if (renderDiagram) // if we already show the inheritance relations graphically,
1211 // then hide the text version
1213 ol.disableAllBut(OutputGenerator::Man);
1216 if (m_impl->inherits && (count=m_impl->inherits->count())>0)
1218 ol.startParagraph();
1219 //parseText(ol,theTranslator->trInherits()+" ");
1221 QCString inheritLine = theTranslator->trInheritsList(m_impl->inherits->count());
1222 QRegExp marker("@[0-9]+");
1223 int index=0,newIndex,matchLen;
1224 // now replace all markers in inheritLine with links to the classes
1225 while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1)
1227 ol.parseText(inheritLine.mid(index,newIndex-index));
1229 uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
1230 BaseClassDef *bcd=m_impl->inherits->at(entryIndex);
1233 ClassDef *cd=bcd->classDef;
1235 // use the class name but with the template arguments as given
1236 // in the inheritance relation
1237 QCString displayName = insertTemplateSpecifierInScope(
1238 cd->displayName(),bcd->templSpecifiers);
1240 if (cd->isLinkable())
1242 if (!Config_getString("GENERATE_TAGFILE").isEmpty())
1244 Doxygen::tagFile << " <base";
1245 if (bcd->prot==Protected)
1247 Doxygen::tagFile << " protection=\"protected\"";
1249 else if (bcd->prot==Private)
1251 Doxygen::tagFile << " protection=\"private\"";
1253 if (bcd->virt==Virtual)
1255 Doxygen::tagFile << " virtualness=\"virtual\"";
1257 Doxygen::tagFile << ">" << convertToXML(cd->name())
1258 << "</base>" << endl;
1260 ol.writeObjectLink(cd->getReference(),
1261 cd->getOutputFileBase(),
1267 ol.docify(displayName);
1272 err("invalid marker %d in inherits list!\n",entryIndex);
1274 index=newIndex+matchLen;
1276 ol.parseText(inheritLine.right(inheritLine.length()-index));
1281 if (m_impl->inheritedBy && (count=m_impl->inheritedBy->count())>0)
1283 ol.startParagraph();
1284 QCString inheritLine = theTranslator->trInheritedByList(m_impl->inheritedBy->count());
1285 QRegExp marker("@[0-9]+");
1286 int index=0,newIndex,matchLen;
1287 // now replace all markers in inheritLine with links to the classes
1288 while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1)
1290 ol.parseText(inheritLine.mid(index,newIndex-index));
1292 uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
1293 BaseClassDef *bcd=m_impl->inheritedBy->at(entryIndex);
1296 ClassDef *cd=bcd->classDef;
1297 if (cd->isLinkable())
1299 ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),cd->anchor(),cd->displayName());
1303 ol.docify(cd->displayName());
1305 writeInheritanceSpecifier(ol,bcd);
1307 index=newIndex+matchLen;
1309 ol.parseText(inheritLine.right(inheritLine.length()-index));
1319 void ClassDef::writeCollaborationGraph(OutputList &ol)
1321 if (Config_getBool("HAVE_DOT") /*&& Config_getBool("COLLABORATION_GRAPH")*/)
1323 DotClassGraph usageImplGraph(this,DotNode::Collaboration);
1324 if (!usageImplGraph.isTrivial())
1326 ol.pushGeneratorState();
1327 ol.disable(OutputGenerator::Man);
1329 ol.parseText(theTranslator->trCollaborationDiagram(displayName()));
1330 ol.endDotGraph(usageImplGraph);
1331 ol.popGeneratorState();
1336 QCString ClassDef::includeStatement() const
1338 SrcLangExt lang = getLanguage();
1339 bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java;
1344 else if (isObjectiveC())
1354 void ClassDef::writeIncludeFiles(OutputList &ol)
1356 if (m_impl->incInfo /*&& Config_getBool("SHOW_INCLUDE_FILES")*/)
1358 QCString nm=m_impl->incInfo->includeName.isEmpty() ?
1359 (m_impl->incInfo->fileDef ?
1360 m_impl->incInfo->fileDef->docName().data() : ""
1362 m_impl->incInfo->includeName.data();
1365 ol.startParagraph();
1366 ol.startTypewriter();
1367 ol.docify(includeStatement());
1368 SrcLangExt lang = getLanguage();
1369 bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java;
1370 if (m_impl->incInfo->local || isIDLorJava)
1374 ol.pushGeneratorState();
1375 ol.disable(OutputGenerator::Html);
1377 ol.disableAllBut(OutputGenerator::Html);
1378 ol.enable(OutputGenerator::Html);
1379 if (m_impl->incInfo->fileDef)
1381 ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm);
1387 ol.popGeneratorState();
1388 if (m_impl->incInfo->local || isIDLorJava)
1401 void ClassDef::writeAllMembersLink(OutputList &ol)
1403 // write link to list of all members (HTML only)
1404 if (m_impl->allMemberNameInfoSDict &&
1405 !Config_getBool("OPTIMIZE_OUTPUT_FOR_C")
1408 ol.pushGeneratorState();
1409 ol.disableAllBut(OutputGenerator::Html);
1410 ol.startParagraph();
1411 ol.startTextLink(getMemberListFileName(),0);
1412 ol.parseText(theTranslator->trListOfAllMembers());
1416 ol.popGeneratorState();
1421 void ClassDef::writeMemberGroups(OutputList &ol,bool showInline)
1423 // write user defined member groups
1424 if (m_impl->memberGroupSDict)
1426 m_impl->memberGroupSDict->sort();
1427 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
1429 for (;(mg=mgli.current());++mgli)
1431 if (!mg->allMembersInSameSection() || !m_impl->subGrouping) // group is in its own section
1433 mg->writeDeclarations(ol,this,0,0,0,showInline);
1435 else // add this group to the corresponding member section
1437 //printf("addToDeclarationSection(%s)\n",mg->header().data());
1438 //mg->addToDeclarationSection();
1444 void ClassDef::writeNestedClasses(OutputList &ol,const QCString &title)
1447 if (m_impl->innerClasses)
1449 m_impl->innerClasses->writeDeclaration(ol,0,title,TRUE);
1453 void ClassDef::writeInlineClasses(OutputList &ol)
1455 if (m_impl->innerClasses)
1457 m_impl->innerClasses->writeDocumentation(ol,this);
1461 void ClassDef::startMemberDocumentation(OutputList &ol)
1463 //printf("%s: ClassDef::startMemberDocumentation()\n",name().data());
1464 if (Config_getBool("SEPARATE_MEMBER_PAGES"))
1466 ol.disable(OutputGenerator::Html);
1467 Doxygen::suppressDocWarnings = TRUE;
1471 void ClassDef::endMemberDocumentation(OutputList &ol)
1473 //printf("%s: ClassDef::endMemberDocumentation()\n",name().data());
1474 if (Config_getBool("SEPARATE_MEMBER_PAGES"))
1476 ol.enable(OutputGenerator::Html);
1477 Doxygen::suppressDocWarnings = FALSE;
1481 void ClassDef::startMemberDeclarations(OutputList &ol)
1483 //printf("%s: ClassDef::startMemberDeclarations()\n",name().data());
1484 ol.startMemberSections();
1487 void ClassDef::endMemberDeclarations(OutputList &ol)
1489 //printf("%s: ClassDef::endMemberDeclarations()\n",name().data());
1490 static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB");
1491 if (!inlineInheritedMembers && countAdditionalInheritedMembers()>0)
1493 ol.startMemberHeader("inherited");
1494 ol.parseText(theTranslator->trAdditionalInheritedMembers());
1495 ol.endMemberHeader();
1496 writeAdditionalInheritedMembers(ol);
1498 ol.endMemberSections();
1501 void ClassDef::writeAuthorSection(OutputList &ol)
1503 ol.pushGeneratorState();
1504 ol.disableAllBut(OutputGenerator::Man);
1505 ol.writeString("\n");
1506 ol.startGroupHeader();
1507 ol.parseText(theTranslator->trAuthor(TRUE,TRUE));
1508 ol.endGroupHeader();
1509 ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME")));
1510 ol.popGeneratorState();
1514 void ClassDef::writeSummaryLinks(OutputList &ol)
1516 ol.pushGeneratorState();
1517 ol.disableAllBut(OutputGenerator::Html);
1518 QListIterator<LayoutDocEntry> eli(
1519 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
1520 LayoutDocEntry *lde;
1522 SrcLangExt lang = getLanguage();
1524 if (lang!=SrcLangExt_VHDL)
1526 for (eli.toFirst();(lde=eli.current());++eli)
1528 if (lde->kind()==LayoutDocEntry::ClassNestedClasses &&
1529 m_impl->innerClasses &&
1530 m_impl->innerClasses->declVisible()
1533 LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
1534 ol.writeSummaryLink(0,"nested-classes",ls->title(lang),first);
1537 else if (lde->kind()==LayoutDocEntry::ClassAllMembersLink &&
1538 m_impl->allMemberNameInfoSDict &&
1539 !Config_getBool("OPTIMIZE_OUTPUT_FOR_C")
1542 ol.writeSummaryLink(getMemberListFileName(),"all-members-list",theTranslator->trListOfAllMembers(),first);
1545 else if (lde->kind()== LayoutDocEntry::MemberDecl)
1547 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
1548 MemberList * ml = getMemberList(lmd->type);
1549 if (ml && ml->declVisible())
1551 ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
1559 SDict<QCString>::Iterator li(m_impl->vhdlSummaryTitles);
1560 for (li.toFirst();li.current();++li)
1562 ol.writeSummaryLink(0,li.current()->data(),li.current()->data(),first);
1568 ol.writeString(" </div>\n");
1570 ol.popGeneratorState();
1573 void ClassDef::writeTagFileMarker()
1575 // write section to the tag file
1576 if (!Config_getString("GENERATE_TAGFILE").isEmpty())
1578 Doxygen::tagFile << " <compound kind=\"" << compoundTypeString();
1579 Doxygen::tagFile << "\"";
1580 if (isObjectiveC()) { Doxygen::tagFile << " objc=\"yes\""; }
1581 Doxygen::tagFile << ">" << endl;
1582 Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
1583 Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
1584 if (!anchor().isEmpty())
1586 Doxygen::tagFile << " <anchor>" << convertToXML(anchor()) << "</anchor>" << endl;
1588 QCString idStr = id();
1589 if (!idStr.isEmpty())
1591 Doxygen::tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>" << endl;
1593 if (m_impl->tempArgs)
1595 ArgumentListIterator ali(*m_impl->tempArgs);
1597 for (;(a=ali.current());++ali)
1599 Doxygen::tagFile << " <templarg>" << convertToXML(a->name) << "</templarg>" << endl;
1605 /** Write class documentation inside another container (i.e. a group) */
1606 void ClassDef::writeInlineDocumentation(OutputList &ol)
1608 bool isSimple = m_impl->isSimple;
1610 ol.addIndexItem(name(),0);
1611 //printf("ClassDef::writeInlineDocumentation(%s)\n",name().data());
1612 QListIterator<LayoutDocEntry> eli(
1613 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
1614 LayoutDocEntry *lde;
1616 // part 1: anchor and title
1617 QCString s = compoundTypeString()+" "+name();
1620 ol.pushGeneratorState();
1621 ol.disableAllBut(OutputGenerator::Html);
1623 ol.writeAnchor(0,anchor());
1624 ol.startMemberDoc(0,0,0,0,FALSE);
1625 ol.startMemberDocName(FALSE);
1627 ol.endMemberDocName();
1628 ol.endMemberDoc(FALSE);
1629 ol.writeString("</div>");
1632 ol.popGeneratorState();
1635 ol.pushGeneratorState();
1636 ol.disable(OutputGenerator::Html);
1637 ol.disable(OutputGenerator::Man);
1638 { // for LaTeX/RTF only
1639 ol.writeAnchor(getOutputFileBase(),anchor());
1641 ol.popGeneratorState();
1644 ol.pushGeneratorState();
1645 ol.disable(OutputGenerator::Html);
1647 // for LaTeX/RTF/Man
1648 ol.startGroupHeader(1);
1650 ol.endGroupHeader(1);
1652 ol.popGeneratorState();
1654 SrcLangExt lang=getLanguage();
1656 // part 2: the header and detailed description
1657 for (eli.toFirst();(lde=eli.current());++eli)
1659 switch (lde->kind())
1661 case LayoutDocEntry::BriefDesc:
1663 // since we already shown the brief description in the
1664 // declaration part of the container, so we use this to
1665 // show the details on top.
1666 writeDetailedDocumentationBody(ol);
1669 case LayoutDocEntry::ClassInheritanceGraph:
1670 writeInheritanceGraph(ol);
1672 case LayoutDocEntry::ClassCollaborationGraph:
1673 writeCollaborationGraph(ol);
1675 case LayoutDocEntry::MemberDeclStart:
1676 if (!isSimple) startMemberDeclarations(ol);
1678 case LayoutDocEntry::MemberDecl:
1680 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
1681 if (!isSimple) writeMemberDeclarations(ol,lmd->type,lmd->title(lang),lmd->subtitle(lang),TRUE);
1684 case LayoutDocEntry::MemberGroups:
1685 if (!isSimple) writeMemberGroups(ol,TRUE);
1687 case LayoutDocEntry::MemberDeclEnd:
1688 if (!isSimple) endMemberDeclarations(ol);
1690 case LayoutDocEntry::MemberDefStart:
1691 if (!isSimple) startMemberDocumentation(ol);
1693 case LayoutDocEntry::MemberDef:
1695 LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde;
1698 writeSimpleMemberDocumentation(ol,lmd->type);
1702 writeMemberDocumentation(ol,lmd->type,lmd->title(lang),TRUE);
1706 case LayoutDocEntry::MemberDefEnd:
1707 if (!isSimple) endMemberDocumentation(ol);
1714 // part 3: close the block
1715 ol.pushGeneratorState();
1716 ol.disableAllBut(OutputGenerator::Html);
1720 ol.popGeneratorState();
1722 // part 4: write tag file information
1723 writeTagFileMarker();
1726 void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor)
1728 // TODO: clean up this mess by moving it to
1729 // the output generators...
1730 static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
1731 static bool rtfHyperlinks = Config_getBool("RTF_HYPERLINKS");
1732 static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
1735 ol.pushGeneratorState();
1736 ol.disableAllBut(OutputGenerator::Html);
1738 ol.startTextLink(getOutputFileBase(),
1739 anchor.isEmpty() ? QCString("details") : anchor);
1740 ol.parseText(theTranslator->trMore());
1742 ol.popGeneratorState();
1744 if (!anchor.isEmpty())
1746 ol.pushGeneratorState();
1748 ol.disable(OutputGenerator::Html);
1749 ol.disable(OutputGenerator::Man);
1750 if (!(usePDFLatex && pdfHyperlinks))
1752 ol.disable(OutputGenerator::Latex);
1756 ol.disable(OutputGenerator::RTF);
1759 ol.startTextLink(getOutputFileBase(), anchor);
1760 ol.parseText(theTranslator->trMore());
1763 ol.disable(OutputGenerator::Latex);
1764 ol.writeString("\\par");
1765 ol.popGeneratorState();
1769 bool ClassDef::visibleInParentsDeclList() const
1771 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
1772 static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
1773 static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
1774 bool linkable = isLinkable();
1775 return (name().find('@')==-1 && !isExtension() &&
1776 (protection()!=::Private || extractPrivate) &&
1777 (linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses)))
1781 void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames)
1783 //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
1784 //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
1785 SrcLangExt lang = getLanguage();
1786 if (visibleInParentsDeclList())
1788 if (!found) // first class
1790 ol.startMemberHeader("nested-classes");
1793 ol.parseText(header);
1795 else if (lang==SrcLangExt_VHDL)
1797 ol.parseText(VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE));
1801 ol.parseText(lang==SrcLangExt_Fortran ?
1802 theTranslator->trDataTypes() :
1803 theTranslator->trCompounds());
1805 ol.endMemberHeader();
1806 ol.startMemberList();
1809 if (!Config_getString("GENERATE_TAGFILE").isEmpty() &&
1810 !isReference()) // skip classes found in tag files
1812 Doxygen::tagFile << " <class kind=\"" << compoundTypeString()
1813 << "\">" << convertToXML(name()) << "</class>" << endl;
1815 ol.startMemberDeclaration();
1816 ol.startMemberItem(anchor(),FALSE);
1817 QCString ctype = compoundTypeString();
1818 QCString cname = displayName(!localNames);
1820 if (lang!=SrcLangExt_VHDL) // for VHDL we swap the name and the type
1822 ol.writeString(ctype);
1823 ol.writeString(" ");
1824 ol.insertMemberAlign();
1828 ol.writeObjectLink(getReference(),
1829 getOutputFileBase(),
1840 if (lang==SrcLangExt_VHDL) // now write the type
1842 ol.writeString(" ");
1843 ol.insertMemberAlign();
1844 ol.writeString(VhdlDocGen::getProtectionName((VhdlDocGen::VhdlClasses)protection()));
1848 // add the brief description if available
1849 if (!briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
1851 DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0,
1852 briefDescription(),FALSE,FALSE,0,TRUE,FALSE);
1853 if (rootNode && !rootNode->isEmpty())
1855 ol.startMemberDescription(anchor());
1856 ol.writeDoc(rootNode,this,0);
1857 if (isLinkableInProject())
1859 writeMoreLink(ol,anchor());
1861 ol.endMemberDescription();
1865 ol.endMemberDeclaration(anchor(),0);
1869 void ClassDef::addClassAttributes(OutputList &ol)
1872 if (isFinal()) sl.append("final");
1873 if (isSealed()) sl.append("sealed");
1874 if (isAbstract()) sl.append("abstract");
1875 if (getLanguage()==SrcLangExt_IDL && isPublished()) sl.append("published");
1877 ol.pushGeneratorState();
1878 ol.disableAllBut(OutputGenerator::Html);
1882 const char *s=sl.first();
1885 const char *ns = sl.next();
1886 ol.writeLabel(s,ns==0);
1891 ol.popGeneratorState();
1894 void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*pageTitle*/)
1898 QCString pageType = " ";
1899 pageType += compoundTypeString();
1900 toupper(pageType.at(1));
1902 writeTagFileMarker();
1904 Doxygen::indexList->addIndexItem(this,0);
1906 if (Doxygen::searchIndex)
1908 Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE);
1909 Doxygen::searchIndex->addWord(localName(),TRUE);
1911 bool exampleFlag=hasExamples();
1913 //---------------------------------------- start flexible part -------------------------------
1915 SrcLangExt lang = getLanguage();
1917 QListIterator<LayoutDocEntry> eli(
1918 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
1919 LayoutDocEntry *lde;
1920 for (eli.toFirst();(lde=eli.current());++eli)
1922 switch (lde->kind())
1924 case LayoutDocEntry::BriefDesc:
1925 writeBriefDescription(ol,exampleFlag);
1927 case LayoutDocEntry::ClassIncludes:
1928 writeIncludeFiles(ol);
1930 case LayoutDocEntry::ClassInheritanceGraph:
1931 writeInheritanceGraph(ol);
1933 case LayoutDocEntry::ClassCollaborationGraph:
1934 writeCollaborationGraph(ol);
1936 case LayoutDocEntry::ClassAllMembersLink:
1937 //writeAllMembersLink(ol); // this is now part of the summary links
1939 case LayoutDocEntry::MemberDeclStart:
1940 startMemberDeclarations(ol);
1942 case LayoutDocEntry::MemberGroups:
1943 writeMemberGroups(ol);
1945 case LayoutDocEntry::MemberDecl:
1947 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
1948 writeMemberDeclarations(ol,lmd->type,lmd->title(lang),lmd->subtitle(lang));
1951 case LayoutDocEntry::ClassNestedClasses:
1953 LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
1954 writeNestedClasses(ol,ls->title(lang));
1957 case LayoutDocEntry::MemberDeclEnd:
1958 endMemberDeclarations(ol);
1960 case LayoutDocEntry::DetailedDesc:
1962 LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
1963 writeDetailedDescription(ol,pageType,exampleFlag,ls->title(lang));
1966 case LayoutDocEntry::MemberDefStart:
1967 startMemberDocumentation(ol);
1969 case LayoutDocEntry::ClassInlineClasses:
1970 writeInlineClasses(ol);
1972 case LayoutDocEntry::MemberDef:
1974 LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde;
1975 writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
1978 case LayoutDocEntry::MemberDefEnd:
1979 endMemberDocumentation(ol);
1981 case LayoutDocEntry::ClassUsedFiles:
1984 case LayoutDocEntry::AuthorSection:
1985 writeAuthorSection(ol);
1987 case LayoutDocEntry::NamespaceNestedNamespaces:
1988 case LayoutDocEntry::NamespaceNestedConstantGroups:
1989 case LayoutDocEntry::NamespaceClasses:
1990 case LayoutDocEntry::NamespaceInlineClasses:
1991 case LayoutDocEntry::FileClasses:
1992 case LayoutDocEntry::FileNamespaces:
1993 case LayoutDocEntry::FileConstantGroups:
1994 case LayoutDocEntry::FileIncludes:
1995 case LayoutDocEntry::FileIncludeGraph:
1996 case LayoutDocEntry::FileIncludedByGraph:
1997 case LayoutDocEntry::FileSourceLink:
1998 case LayoutDocEntry::FileInlineClasses:
1999 case LayoutDocEntry::GroupClasses:
2000 case LayoutDocEntry::GroupInlineClasses:
2001 case LayoutDocEntry::GroupNamespaces:
2002 case LayoutDocEntry::GroupDirs:
2003 case LayoutDocEntry::GroupNestedGroups:
2004 case LayoutDocEntry::GroupFiles:
2005 case LayoutDocEntry::GroupGraph:
2006 case LayoutDocEntry::GroupPageDocs:
2007 case LayoutDocEntry::DirSubDirs:
2008 case LayoutDocEntry::DirFiles:
2009 case LayoutDocEntry::DirGraph:
2010 err("Internal inconsistency: member %d should not be part of "
2011 "LayoutDocManager::Class entry list\n",lde->kind());
2016 if (!Config_getString("GENERATE_TAGFILE").isEmpty())
2018 writeDocAnchorsToTagFile();
2019 Doxygen::tagFile << " </compound>" << endl;
2024 QCString ClassDef::title() const
2027 SrcLangExt lang = getLanguage();
2029 if (lang==SrcLangExt_Fortran)
2031 pageTitle = theTranslator->trCompoundReferenceFortran(displayName(),
2033 m_impl->tempArgs != 0);
2035 else if (lang==SrcLangExt_VHDL)
2037 pageTitle = VhdlDocGen::getClassTitle(this)+" Reference";
2039 else if (isJavaEnum())
2041 pageTitle = theTranslator->trEnumReference(displayName());
2043 else if (m_impl->compType==Service)
2045 pageTitle = theTranslator->trServiceReference(displayName());
2047 else if (m_impl->compType==Singleton)
2049 pageTitle = theTranslator->trSingletonReference(displayName());
2053 pageTitle = theTranslator->trCompoundReference(displayName(),
2054 m_impl->compType == Interface && getLanguage()==SrcLangExt_ObjC ? Class : m_impl->compType,
2055 m_impl->tempArgs != 0);
2060 // write all documentation for this class
2061 void ClassDef::writeDocumentation(OutputList &ol)
2063 static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
2064 //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
2065 //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
2066 QCString pageTitle = title();
2068 startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible,!generateTreeView);
2069 if (!generateTreeView)
2071 if (getOuterScope()!=Doxygen::globalScope)
2073 writeNavigationPath(ol);
2075 ol.endQuickIndices();
2078 startTitle(ol,getOutputFileBase(),this);
2079 ol.parseText(pageTitle);
2080 addClassAttributes(ol);
2081 addGroupListToTitle(ol,this);
2082 endTitle(ol,getOutputFileBase(),displayName());
2083 writeDocumentationContents(ol,pageTitle);
2085 endFileWithNavPath(this,ol);
2087 if (Config_getBool("SEPARATE_MEMBER_PAGES"))
2089 writeMemberPages(ol);
2093 void ClassDef::writeMemberPages(OutputList &ol)
2095 ///////////////////////////////////////////////////////////////////////////
2096 //// Member definitions on separate pages
2097 ///////////////////////////////////////////////////////////////////////////
2099 ol.pushGeneratorState();
2100 ol.disableAllBut(OutputGenerator::Html);
2102 QListIterator<MemberList> mli(m_impl->memberLists);
2104 for (mli.toFirst();(ml=mli.current());++mli)
2106 ml->countDocMembers();
2107 if (ml->numDocMembers()>0 && (ml->listType()&MemberListType_detailedLists))
2109 ml->writeDocumentationPage(ol,displayName(),this);
2113 ol.popGeneratorState();
2116 void ClassDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const
2118 static bool createSubDirs=Config_getBool("CREATE_SUBDIRS");
2120 ol.writeString(" <div class=\"navtab\">\n");
2121 ol.writeString(" <table>\n");
2123 if (m_impl->allMemberNameInfoSDict)
2125 MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict);
2126 MemberNameInfo *mni;
2127 for (;(mni=mnili.current());++mnili)
2129 MemberNameInfoIterator mnii(*mni);
2131 for (mnii.toFirst();(mi=mnii.current());++mnii)
2133 MemberDef *md=mi->memberDef;
2134 if (md->getClassDef()==this && md->isLinkable() && !md->isEnumValue())
2136 ol.writeString(" <tr><td class=\"navtab\">");
2137 if (md->isLinkableInProject())
2139 if (md==currentMd) // selected item => highlight
2141 ol.writeString("<a class=\"qindexHL\" ");
2145 ol.writeString("<a class=\"qindex\" ");
2147 ol.writeString("href=\"");
2148 if (createSubDirs) ol.writeString("../../");
2149 ol.writeString(md->getOutputFileBase()+Doxygen::htmlFileExtension+"#"+md->anchor());
2150 ol.writeString("\">");
2151 ol.writeString(convertToHtml(md->name()));
2152 ol.writeString("</a>");
2154 ol.writeString("</td></tr>\n");
2160 ol.writeString(" </table>\n");
2161 ol.writeString(" </div>\n");
2166 void ClassDef::writeDocumentationForInnerClasses(OutputList &ol)
2168 // write inner classes after the parent, so the tag files contain
2169 // the definition in proper order!
2170 if (m_impl->innerClasses)
2172 ClassSDict::Iterator cli(*m_impl->innerClasses);
2174 for (cli.toFirst();(innerCd=cli.current());++cli)
2176 if (innerCd->isLinkableInProject() && innerCd->templateMaster()==0 &&
2177 protectionLevelVisible(innerCd->protection()) &&
2178 !innerCd->isEmbeddedInOuterScope()
2181 msg("Generating docs for nested compound %s...\n",qPrint(innerCd->name()));
2182 innerCd->writeDocumentation(ol);
2183 innerCd->writeMemberList(ol);
2185 innerCd->writeDocumentationForInnerClasses(ol);
2190 // write the list of all (inherited) members for this class
2191 void ClassDef::writeMemberList(OutputList &ol)
2193 static bool cOpt = Config_getBool("OPTIMIZE_OUTPUT_FOR_C");
2194 //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
2195 static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
2196 if (m_impl->allMemberNameInfoSDict==0 || cOpt) return;
2198 ol.pushGeneratorState();
2199 ol.disableAllBut(OutputGenerator::Html);
2201 QCString memListFile = getMemberListFileName();
2202 startFile(ol,memListFile,memListFile,theTranslator->trMemberList(),
2203 HLI_ClassVisible,!generateTreeView,getOutputFileBase());
2204 if (!generateTreeView)
2206 if (getOuterScope()!=Doxygen::globalScope)
2208 writeNavigationPath(ol);
2210 ol.endQuickIndices();
2213 ol.parseText(displayName()+" "+theTranslator->trMemberList());
2216 ol.startParagraph();
2217 ol.parseText(theTranslator->trThisIsTheListOfAllMembers());
2218 ol.writeObjectLink(getReference(),getOutputFileBase(),anchor(),displayName());
2219 ol.parseText(theTranslator->trIncludingInheritedMembers());
2222 //ol.startItemList();
2223 ol.writeString("<table class=\"directory\">\n");
2226 //MemberNameInfo *mni=m_impl->allMemberNameInfoList->first();
2227 MemberNameInfoSDict::Iterator mnii(*m_impl->allMemberNameInfoSDict);
2228 MemberNameInfo *mni;
2229 for (mnii.toFirst();(mni=mnii.current());++mnii)
2231 MemberNameInfoIterator it(*mni);
2233 for (;(mi=it.current());++it)
2235 MemberDef *md=mi->memberDef;
2236 ClassDef *cd=md->getClassDef();
2237 Protection prot = mi->prot;
2238 Specifier virt=md->virtualness();
2240 //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n",
2241 // name().data(),md->name().data(),cd->name().data(),md->protection(),mi->prot,prot,mi->inherited);
2243 if (cd && !md->name().isEmpty() && md->name()[0]!='@')
2245 bool memberWritten=FALSE;
2246 if (cd->isLinkable() && md->isLinkable())
2247 // create a link to the documentation
2249 QCString name=mi->ambiguityResolutionScope+md->name();
2250 //ol.writeListItem();
2251 ol.writeString(" <tr");
2252 if ((idx&1)==0) ol.writeString(" class=\"even\"");
2254 ol.writeString("><td class=\"entry\">");
2255 if (cd->isObjectiveC())
2257 if (md->isObjCMethod())
2260 ol.writeString("+ </td><td>");
2262 ol.writeString("- </td><td>");
2265 ol.writeString("</td><td class=\"entry\">");
2267 if (md->isObjCMethod())
2269 ol.writeObjectLink(md->getReference(),
2270 md->getOutputFileBase(),
2271 md->anchor(),md->name());
2275 //Definition *bd = md->getGroupDef();
2277 ol.writeObjectLink(md->getReference(),
2278 md->getOutputFileBase(),
2281 if ( md->isFunction() || md->isSignal() || md->isSlot() ||
2282 (md->isFriend() && md->argsString()))
2283 ol.docify(md->argsString());
2284 else if (md->isEnumerate())
2285 ol.parseText(" "+theTranslator->trEnumName());
2286 else if (md->isEnumValue())
2287 ol.parseText(" "+theTranslator->trEnumValue());
2288 else if (md->isTypedef())
2289 ol.docify(" typedef");
2290 else if (md->isFriend() && !qstrcmp(md->typeString(),"friend class"))
2291 ol.docify(" class");
2292 //ol.writeString("\n");
2294 ol.writeString("</td>");
2297 else if (!cd->isArtificial() &&
2298 !Config_getBool("HIDE_UNDOC_MEMBERS") &&
2299 (protectionLevelVisible(md->protection()) || md->isFriend())
2300 ) // no documentation,
2301 // generate link to the class instead.
2303 //ol.writeListItem();
2304 ol.writeString(" <tr bgcolor=\"#f0f0f0\"");
2305 if ((idx&1)==0) ol.writeString(" class=\"even\"");
2307 ol.writeString("><td class=\"entry\">");
2308 if (cd->isObjectiveC())
2310 if (md->isObjCMethod())
2313 ol.writeString("+ </td><td class=\"entry\">");
2315 ol.writeString("- </td><td class=\"entry\">");
2318 ol.writeString("</td><td class=\"entry\">");
2321 ol.docify(md->name());
2323 if (!md->isObjCMethod())
2325 if ( md->isFunction() || md->isSignal() || md->isSlot() )
2326 ol.docify(md->argsString());
2327 else if (md->isEnumerate())
2328 ol.parseText(" "+theTranslator->trEnumName());
2329 else if (md->isEnumValue())
2330 ol.parseText(" "+theTranslator->trEnumValue());
2331 else if (md->isTypedef())
2332 ol.docify(" typedef");
2334 ol.writeString(" (");
2335 ol.parseText(theTranslator->trDefinedIn()+" ");
2336 if (cd->isLinkable())
2340 cd->getOutputFileBase(),
2347 ol.docify(cd->displayName());
2350 ol.writeString(")");
2351 ol.writeString("</td>");
2356 ol.writeString("<td class=\"entry\">");
2357 ol.writeObjectLink(cd->getReference(),
2358 cd->getOutputFileBase(),
2361 md->category()->displayName() :
2363 ol.writeString("</td>");
2364 ol.writeString("<td class=\"entry\">");
2366 SrcLangExt lang = md->getLanguage();
2368 (prot!=Public || (virt!=Normal && getLanguage()!=SrcLangExt_ObjC) ||
2369 md->isFriend() || md->isRelated() || md->isExplicit() ||
2370 md->isMutable() || (md->isInline() && Config_getBool("INLINE_INFO")) ||
2371 md->isSignal() || md->isSlot() ||
2372 (getLanguage()==SrcLangExt_IDL &&
2373 (md->isOptional() || md->isAttribute() || md->isUNOProperty())) ||
2374 md->isStatic() || lang==SrcLangExt_VHDL
2378 ol.writeString("<span class=\"mlabel\">");
2380 if (lang==SrcLangExt_VHDL)
2382 sl.append(VhdlDocGen::trVhdlType(md->getMemberSpecifiers())); //append vhdl type
2384 else if (md->isFriend()) sl.append("friend");
2385 else if (md->isRelated()) sl.append("related");
2388 if (Config_getBool("INLINE_INFO") && md->isInline())
2389 sl.append("inline");
2390 if (md->isExplicit()) sl.append("explicit");
2391 if (md->isMutable()) sl.append("mutable");
2392 if (prot==Protected) sl.append("protected");
2393 else if (prot==Private) sl.append("private");
2394 else if (prot==Package) sl.append("package");
2395 if (virt==Virtual && getLanguage()!=SrcLangExt_ObjC)
2396 sl.append("virtual");
2397 else if (virt==Pure) sl.append("pure virtual");
2398 if (md->isStatic()) sl.append("static");
2399 if (md->isSignal()) sl.append("signal");
2400 if (md->isSlot()) sl.append("slot");
2401 // this is the extra member page
2402 if (md->isOptional()) sl.append("optional");
2403 if (md->isAttribute()) sl.append("attribute");
2404 if (md->isUNOProperty()) sl.append("property");
2405 if (md->isReadonly()) sl.append("readonly");
2406 if (md->isBound()) sl.append("bound");
2407 if (md->isRemovable()) sl.append("removable");
2408 if (md->isConstrained()) sl.append("constrained");
2409 if (md->isTransient()) sl.append("transient");
2410 if (md->isMaybeVoid()) sl.append("maybevoid");
2411 if (md->isMaybeDefault()) sl.append("maybedefault");
2412 if (md->isMaybeAmbiguous())sl.append("maybeambiguous");
2414 const char *s=sl.first();
2419 if (s) ol.writeString("</span><span class=\"mlabel\">");
2421 ol.writeString("</span>");
2425 ol.writeString("</td>");
2426 ol.writeString("</tr>\n");
2433 ol.writeString("</table>");
2436 ol.popGeneratorState();
2440 // add a reference to an example
2441 bool ClassDef::addExample(const char *anchor,const char *nameStr,
2444 if (m_impl->exampleSDict==0)
2446 m_impl->exampleSDict = new ExampleSDict;
2447 m_impl->exampleSDict->setAutoDelete(TRUE);
2449 if (!m_impl->exampleSDict->find(nameStr))
2451 Example *e=new Example;
2455 m_impl->exampleSDict->inSort(nameStr,e);
2461 // returns TRUE if this class is used in an example
2462 bool ClassDef::hasExamples() const
2465 if (m_impl->exampleSDict)
2466 result = m_impl->exampleSDict->count()>0;
2471 void ClassDef::setTemplateArguments(ArgumentList *al)
2474 if (!m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed
2475 m_impl->tempArgs=new ArgumentList;
2476 ArgumentListIterator ali(*al);
2478 for (;(a=ali.current());++ali)
2480 m_impl->tempArgs->append(new Argument(*a));
2484 void ClassDef::setTypeConstraints(ArgumentList *al)
2487 if (!m_impl->typeConstraints) delete m_impl->typeConstraints;
2488 m_impl->typeConstraints = new ArgumentList;
2489 ArgumentListIterator ali(*al);
2491 for (;(a=ali.current());++ali)
2493 m_impl->typeConstraints->append(new Argument(*a));
2497 /*! Returns \c TRUE iff this class or a class inheriting from this class
2498 * is \e not defined in an external tag file.
2500 bool ClassDef::hasNonReferenceSuperClass()
2502 bool found=!isReference() && isLinkableInProject() && !isHidden();
2505 return TRUE; // we're done if this class is not a reference
2507 if (m_impl->inheritedBy)
2509 BaseClassListIterator bcli(*m_impl->inheritedBy);
2510 for ( ; bcli.current() && !found ; ++bcli ) // for each super class
2512 ClassDef *bcd=bcli.current()->classDef;
2513 // recurse into the super class branch
2514 found = found || bcd->hasNonReferenceSuperClass();
2517 // look for template instances that might have non-reference super classes
2518 QDict<ClassDef> *cil = bcd->getTemplateInstances();
2521 QDictIterator<ClassDef> tidi(*cil);
2522 for ( ; tidi.current() && !found ; ++tidi) // for each template instance
2524 // recurse into the template instance branch
2525 found = found || tidi.current()->hasNonReferenceSuperClass();
2534 /*! called from MemberDef::writeDeclaration() to (recusively) write the
2535 * definition of an anonymous struct, union or class.
2537 void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup,
2538 ClassDef *inheritedFrom,const char *inheritId)
2540 //printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup);
2542 ol.docify(compoundTypeString());
2543 QCString cn = displayName(FALSE);
2547 if (md && isLinkable())
2549 ol.writeObjectLink(0,0,md->anchor(),cn);
2561 // write user defined member groups
2562 if (m_impl->memberGroupSDict)
2564 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
2566 for (;(mg=mgli.current());++mgli)
2568 mg->setInGroup(inGroup);
2569 mg->writePlainDeclarations(ol,this,0,0,0,inheritedFrom,inheritId);
2573 QListIterator<LayoutDocEntry> eli(
2574 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
2575 LayoutDocEntry *lde;
2576 for (eli.toFirst();(lde=eli.current());++eli)
2578 if (lde->kind()==LayoutDocEntry::MemberDecl)
2580 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
2581 writePlainMemberDeclaration(ol,lmd->type,inGroup,inheritedFrom,inheritId);
2586 /*! a link to this class is possible within this project */
2587 bool ClassDef::isLinkableInProject() const
2589 static bool extractLocal = Config_getBool("EXTRACT_LOCAL_CLASSES");
2590 static bool extractStatic = Config_getBool("EXTRACT_STATIC");
2591 static bool hideUndoc = Config_getBool("HIDE_UNDOC_CLASSES");
2592 if (m_impl->templateMaster)
2594 return m_impl->templateMaster->isLinkableInProject();
2598 return !name().isEmpty() && /* has a name */
2599 !isArtificial() && !isHidden() && /* not hidden */
2600 name().find('@')==-1 && /* not anonymous */
2601 protectionLevelVisible(m_impl->prot) && /* private/internal */
2602 (!m_impl->isLocal || extractLocal) && /* local */
2603 (hasDocumentation() || !hideUndoc) && /* documented */
2604 (!m_impl->isStatic || extractStatic) && /* static */
2605 !isReference(); /* not an external reference */
2609 bool ClassDef::isLinkable() const
2611 if (m_impl->templateMaster)
2613 return m_impl->templateMaster->isLinkable();
2617 return isLinkableInProject() || isReference();
2622 /*! the class is visible in a class diagram, or class hierarchy */
2623 bool ClassDef::isVisibleInHierarchy()
2625 static bool allExternals = Config_getBool("ALLEXTERNALS");
2626 static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
2627 static bool extractStatic = Config_getBool("EXTRACT_STATIC");
2629 return // show all classes or a subclass is visible
2630 (allExternals || hasNonReferenceSuperClass()) &&
2631 // and not an anonymous compound
2632 name().find('@')==-1 &&
2633 // not an artificially introduced class
2634 /*!isArtificial() &&*/ // 1.8.2: allowed these to appear
2635 // and not privately inherited
2636 protectionLevelVisible(m_impl->prot) &&
2637 // documented or shown anyway or documentation is external
2638 (hasDocumentation() ||
2639 !hideUndocClasses ||
2640 (m_impl->templateMaster && m_impl->templateMaster->hasDocumentation()) ||
2643 // is not part of an unnamed namespace or shown anyway
2644 (!m_impl->isStatic || extractStatic);
2647 bool ClassDef::hasDocumentation() const
2649 return Definition::hasDocumentation();
2652 //----------------------------------------------------------------------
2653 // recursive function:
2654 // returns TRUE iff class definition `bcd' represents an (in)direct base
2655 // class of class definition `cd'.
2657 bool ClassDef::isBaseClass(ClassDef *bcd, bool followInstances,int level)
2660 //printf("isBaseClass(cd=%s) looking for %s\n",name().data(),bcd->name().data());
2663 err("Possible recursive class relation while inside %s and looking for base class %s\n",qPrint(name()),qPrint(bcd->name()));
2668 // Beware: trying to optimise the iterator away using ->first() & ->next()
2669 // causes bug 625531
2670 BaseClassListIterator bcli(*baseClasses());
2671 for ( ; bcli.current() && !found ; ++bcli)
2673 ClassDef *ccd=bcli.current()->classDef;
2674 if (!followInstances && ccd->templateMaster()) ccd=ccd->templateMaster();
2675 //printf("isBaseClass() baseclass %s\n",ccd->name().data());
2679 found=ccd->isBaseClass(bcd,followInstances,level+1);
2685 //----------------------------------------------------------------------
2687 bool ClassDef::isSubClass(ClassDef *cd,int level)
2692 err("Possible recursive class relation while inside %s and looking for derived class %s\n",qPrint(name()),qPrint(cd->name()));
2697 BaseClassListIterator bcli(*subClasses());
2698 for ( ; bcli.current() && !found ; ++bcli)
2700 ClassDef *ccd=bcli.current()->classDef;
2704 found=ccd->isSubClass(cd,level+1);
2710 //----------------------------------------------------------------------------
2712 static bool isStandardFunc(MemberDef *md)
2714 return md->name()=="operator=" || // assignment operator
2715 md->isConstructor() || // constructor
2716 md->isDestructor(); // destructor
2720 * recusively merges the `all members' lists of a class base
2721 * with that of this class. Must only be called for classes without
2724 void ClassDef::mergeMembers()
2726 if (m_impl->membersMerged) return;
2728 //static bool optimizeOutputForJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
2729 //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
2730 SrcLangExt lang = getLanguage();
2731 QCString sep=getLanguageSpecificSeparator(lang,TRUE);
2732 int sepLen = sep.length();
2734 m_impl->membersMerged=TRUE;
2735 //printf(" mergeMembers for %s\n",name().data());
2736 bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB" );
2739 //printf(" => has base classes!\n");
2740 BaseClassListIterator bcli(*baseClasses());
2742 for ( ; (bcd=bcli.current()) ; ++bcli )
2744 ClassDef *bClass=bcd->classDef;
2746 // merge the members in the base class of this inheritance branch first
2747 bClass->mergeMembers();
2749 MemberNameInfoSDict *srcMnd = bClass->memberNameInfoSDict();
2750 MemberNameInfoSDict *dstMnd = m_impl->allMemberNameInfoSDict;
2754 MemberNameInfoSDict::Iterator srcMnili(*srcMnd);
2755 MemberNameInfo *srcMni;
2756 for ( ; (srcMni=srcMnili.current()) ; ++srcMnili)
2758 //printf(" Base member name %s\n",srcMni->memberName());
2759 MemberNameInfo *dstMni;
2760 if (dstMnd!=0 && (dstMni=dstMnd->find(srcMni->memberName())))
2761 // a member with that name is already in the class.
2762 // the member may hide or reimplement the one in the sub class
2763 // or there may be another path to the base class that is already
2764 // visited via another branch in the class hierarchy.
2766 MemberNameInfoIterator srcMnii(*srcMni);
2768 for ( ; (srcMi=srcMnii.current()) ; ++srcMnii )
2770 MemberDef *srcMd = srcMi->memberDef;
2774 MemberNameInfoIterator dstMnii(*dstMni);
2776 ClassDef *srcCd = srcMd->getClassDef();
2777 for ( ; (dstMi=dstMnii.current()) && !found; ++dstMnii )
2779 MemberDef *dstMd = dstMi->memberDef;
2780 if (srcMd!=dstMd) // different members
2782 ClassDef *dstCd = dstMd->getClassDef();
2783 //printf(" Is %s a base class of %s?\n",srcCd->name().data(),dstCd->name().data());
2784 if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE))
2785 // member is in the same or a base class
2787 ArgumentList *srcAl = srcMd->argumentList();
2788 ArgumentList *dstAl = dstMd->argumentList();
2789 found=matchArguments2(
2790 srcMd->getOuterScope(),srcMd->getFileDef(),srcAl,
2791 dstMd->getOuterScope(),dstMd->getFileDef(),dstAl,
2794 //printf(" Yes, matching (%s<->%s): %d\n",
2795 // argListToString(srcMd->argumentList()).data(),
2796 // argListToString(dstMd->argumentList()).data(),
2798 hidden = hidden || !found;
2800 else // member is in a non base class => multiple inheritance
2801 // using the same base class.
2803 //printf("$$ Existing member %s %s add scope %s\n",
2804 // dstMi->ambiguityResolutionScope.data(),
2805 // dstMd->name().data(),
2806 // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
2808 QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen);
2809 if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
2810 dstMi->ambiguityResolutionScope.prepend(scope);
2814 else // same members
2816 // do not add if base class is virtual or
2817 // if scope paths are equal or
2818 // if base class is an interface (and thus implicitly virtual).
2819 //printf("same member found srcMi->virt=%d dstMi->virt=%d\n",srcMi->virt,dstMi->virt);
2820 if ((srcMi->virt!=Normal && dstMi->virt!=Normal) ||
2821 bClass->name()+sep+srcMi->scopePath == dstMi->scopePath ||
2822 dstMd->getClassDef()->compoundType()==Interface
2827 else // member can be reached via multiple paths in the
2830 //printf("$$ Existing member %s %s add scope %s\n",
2831 // dstMi->ambiguityResolutionScope.data(),
2832 // dstMd->name().data(),
2833 // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
2835 QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen);
2836 if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
2838 dstMi->ambiguityResolutionScope.prepend(scope);
2844 //printf("member %s::%s hidden %d ambigue %d srcMi->ambigClass=%p\n",
2845 // srcCd->name().data(),srcMd->name().data(),hidden,ambigue,srcMi->ambigClass);
2847 // TODO: fix the case where a member is hidden by inheritance
2848 // of a member with the same name but with another prototype,
2849 // while there is more than one path to the member in the
2850 // base class due to multiple inheritance. In this case
2851 // it seems that the member is not reachable by prefixing a
2852 // scope name either (according to my compiler). Currently,
2853 // this case is shown anyway.
2854 if (!found && srcMd->protection()!=Private && !srcMd->isFriend())
2856 Protection prot=srcMd->protection();
2857 if (bcd->prot==Protected && prot==Public) prot=bcd->prot;
2858 else if (bcd->prot==Private) prot=bcd->prot;
2860 if (inlineInheritedMembers)
2862 if (!isStandardFunc(srcMd))
2864 //printf(" insertMember `%s'\n",srcMd->name().data());
2865 internalInsertMember(srcMd,prot,FALSE);
2869 Specifier virt=srcMi->virt;
2870 if (srcMi->virt==Normal && bcd->virt!=Normal) virt=bcd->virt;
2872 MemberInfo *newMi = new MemberInfo(srcMd,prot,virt,TRUE);
2873 newMi->scopePath=bClass->name()+sep+srcMi->scopePath;
2876 //printf("$$ New member %s %s add scope %s::\n",
2877 // srcMi->ambiguityResolutionScope.data(),
2878 // srcMd->name().data(),
2879 // bClass->name().data());
2881 QCString scope=bClass->name()+sep;
2882 if (scope!=srcMi->ambiguityResolutionScope.left(scope.length()))
2884 newMi->ambiguityResolutionScope=
2885 scope+srcMi->ambiguityResolutionScope.copy();
2890 if (srcMi->ambigClass==0)
2892 newMi->ambigClass=bClass;
2893 newMi->ambiguityResolutionScope=bClass->name()+sep;
2897 newMi->ambigClass=srcMi->ambigClass;
2898 newMi->ambiguityResolutionScope=srcMi->ambigClass->name()+sep;
2901 dstMni->append(newMi);
2905 else // base class has a member that is not in the sub class => copy
2907 // create a deep copy of the list (only the MemberInfo's will be
2908 // copied, not the actual MemberDef's)
2909 MemberNameInfo *newMni = 0;
2910 newMni = new MemberNameInfo(srcMni->memberName());
2912 // copy the member(s) from the base to the sub class
2913 MemberNameInfoIterator mnii(*srcMni);
2915 for (;(mi=mnii.current());++mnii)
2917 if (!mi->memberDef->isFriend()) // don't inherit friends
2919 Protection prot = mi->prot;
2920 if (bcd->prot==Protected)
2922 if (prot==Public) prot=Protected;
2924 else if (bcd->prot==Private)
2928 //printf("%s::%s: prot=%d bcd->prot=%d result=%d\n",
2929 // name().data(),mi->memberDef->name().data(),mi->prot,
2932 if (mi->prot!=Private)
2934 Specifier virt=mi->virt;
2935 if (mi->virt==Normal && bcd->virt!=Normal) virt=bcd->virt;
2937 if (inlineInheritedMembers)
2939 if (!isStandardFunc(mi->memberDef))
2941 //printf(" insertMember `%s'\n",mi->memberDef->name().data());
2942 internalInsertMember(mi->memberDef,prot,FALSE);
2945 //printf("Adding!\n");
2946 MemberInfo *newMi=new MemberInfo(mi->memberDef,prot,virt,TRUE);
2947 newMi->scopePath=bClass->name()+sep+mi->scopePath;
2948 newMi->ambigClass=mi->ambigClass;
2949 newMi->ambiguityResolutionScope=mi->ambiguityResolutionScope.copy();
2950 newMni->append(newMi);
2957 m_impl->allMemberNameInfoSDict = new MemberNameInfoSDict(17);
2958 m_impl->allMemberNameInfoSDict->setAutoDelete(TRUE);
2959 dstMnd = m_impl->allMemberNameInfoSDict;
2961 // add it to the dictionary
2962 dstMnd->append(newMni->memberName(),newMni);
2968 //printf(" end mergeMembers\n");
2971 //----------------------------------------------------------------------------
2973 /*! Merges the members of a Objective-C category into this class.
2975 void ClassDef::mergeCategory(ClassDef *category)
2977 static bool extractLocalMethods = Config_getBool("EXTRACT_LOCAL_METHODS");
2978 bool makePrivate = category->isLocal();
2979 // in case extract local methods is not enabled we don't add the methods
2980 // of the category in case it is defined in the .m file.
2981 if (makePrivate && !extractLocalMethods) return;
2982 bool isExtension = category->isExtension();
2984 category->setCategoryOf(this);
2987 category->setArtificial(TRUE);
2989 // copy base classes/protocols from extension
2990 if (category->baseClasses())
2992 BaseClassListIterator bcli(*category->baseClasses());
2994 for ( ; (bcd=bcli.current()) ; ++bcli )
2996 insertBaseClass(bcd->classDef,bcd->usedName,bcd->prot,bcd->virt,bcd->templSpecifiers);
2997 // correct bcd->classDef so that they do no longer derive from
2998 // category, but from this class!
2999 if (bcd->classDef->subClasses())
3001 BaseClassListIterator scli(*bcd->classDef->subClasses());
3003 for ( ; (scd=scli.current()) ; ++scli )
3005 if (scd->classDef==category)
3015 // make methods private for categories defined in the .m file
3016 //printf("%s::mergeCategory makePrivate=%d\n",name().data(),makePrivate);
3018 MemberNameInfoSDict *srcMnd = category->memberNameInfoSDict();
3019 MemberNameInfoSDict *dstMnd = m_impl->allMemberNameInfoSDict;
3021 if (srcMnd && dstMnd)
3023 MemberNameInfoSDict::Iterator srcMnili(*srcMnd);
3024 MemberNameInfo *srcMni;
3025 for ( ; (srcMni=srcMnili.current()) ; ++srcMnili)
3027 MemberNameInfo *dstMni=dstMnd->find(srcMni->memberName());
3028 if (dstMni) // method is already defined in the class
3030 //printf("Existing member %s\n",srcMni->memberName());
3031 MemberInfo *dstMi = dstMni->getFirst();
3032 MemberInfo *srcMi = srcMni->getFirst();
3035 // Protection prot = dstMi->prot;
3036 // if (makePrivate || isExtension)
3039 // removeMemberFromLists(dstMi->memberDef);
3040 // internalInsertMember(dstMi->memberDef,prot,FALSE);
3045 combineDeclarationAndDefinition(srcMi->memberDef,dstMi->memberDef);
3046 dstMi->memberDef->setCategory(category);
3047 dstMi->memberDef->setCategoryRelation(srcMi->memberDef);
3048 srcMi->memberDef->setCategoryRelation(dstMi->memberDef);
3051 else // new method name
3053 //printf("New member %s\n",srcMni->memberName());
3054 // create a deep copy of the list
3055 MemberNameInfo *newMni = 0;
3056 newMni = new MemberNameInfo(srcMni->memberName());
3058 // copy the member(s) from the category to this class
3059 MemberNameInfoIterator mnii(*srcMni);
3061 for (;(mi=mnii.current());++mnii)
3063 //printf("Adding '%s'\n",mi->memberDef->name().data());
3064 Protection prot = mi->prot;
3065 //if (makePrivate) prot = Private;
3066 MemberDef *newMd = mi->memberDef->deepCopy();
3067 //printf("Copying member %s\n",mi->memberDef->name().data());
3068 newMd->moveTo(this);
3070 MemberInfo *newMi=new MemberInfo(newMd,prot,mi->virt,mi->inherited);
3071 newMi->scopePath=mi->scopePath;
3072 newMi->ambigClass=mi->ambigClass;
3073 newMi->ambiguityResolutionScope=mi->ambiguityResolutionScope;
3074 newMni->append(newMi);
3076 // also add the newly created member to the global members list
3080 QCString name = newMd->name();
3081 if ((mn=Doxygen::memberNameSDict->find(name)))
3087 mn = new MemberName(newMd->name());
3089 Doxygen::memberNameSDict->append(name,mn);
3093 newMd->setCategory(category);
3094 newMd->setCategoryRelation(mi->memberDef);
3095 mi->memberDef->setCategoryRelation(newMd);
3096 if (makePrivate || isExtension)
3098 newMd->makeImplementationDetail();
3100 internalInsertMember(newMd,prot,FALSE);
3103 // add it to the dictionary
3104 dstMnd->append(newMni->memberName(),newMni);
3110 //----------------------------------------------------------------------------
3112 void ClassDef::addUsedClass(ClassDef *cd,const char *accessName,
3115 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
3116 static bool umlLook = Config_getBool("UML_LOOK");
3117 if (prot==Private && !extractPrivate) return;
3118 //printf("%s::addUsedClass(%s,%s)\n",name().data(),cd->name().data(),accessName);
3119 if (m_impl->usesImplClassDict==0)
3121 m_impl->usesImplClassDict = new UsesClassDict(17);
3122 m_impl->usesImplClassDict->setAutoDelete(TRUE);
3124 UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name());
3127 ucd = new UsesClassDef(cd);
3128 m_impl->usesImplClassDict->insert(cd->name(),ucd);
3129 //printf("Adding used class %s to class %s via accessor %s\n",
3130 // cd->name().data(),name().data(),accessName);
3132 QCString acc = accessName;
3137 case Public: acc.prepend("+"); break;
3138 case Private: acc.prepend("-"); break;
3139 case Protected: acc.prepend("#"); break;
3140 case Package: acc.prepend("~"); break;
3143 ucd->addAccessor(acc);
3146 void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName,
3149 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
3150 static bool umlLook = Config_getBool("UML_LOOK");
3151 if (prot==Private && !extractPrivate) return;
3152 //printf("%s::addUsedByClass(%s,%s)\n",name().data(),cd->name().data(),accessName);
3153 if (m_impl->usedByImplClassDict==0)
3155 m_impl->usedByImplClassDict = new UsesClassDict(17);
3156 m_impl->usedByImplClassDict->setAutoDelete(TRUE);
3158 UsesClassDef *ucd=m_impl->usedByImplClassDict->find(cd->name());
3161 ucd = new UsesClassDef(cd);
3162 m_impl->usedByImplClassDict->insert(cd->name(),ucd);
3163 //printf("Adding used by class %s to class %s\n",
3164 // cd->name().data(),name().data());
3166 QCString acc = accessName;
3171 case Public: acc.prepend("+"); break;
3172 case Private: acc.prepend("-"); break;
3173 case Protected: acc.prepend("#"); break;
3174 case Package: acc.prepend("~"); break;
3177 ucd->addAccessor(acc);
3182 /*! Builds up a dictionary of all classes that are used by the state of this
3183 * class (the "implementation").
3184 * Must be called before mergeMembers() is called!
3187 void ClassDef::determineImplUsageRelation()
3189 MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict);
3190 MemberNameInfo *mni;
3191 for (;(mni=mnili.current());++mnili)
3193 MemberNameInfoIterator mnii(*mni);
3195 for (mnii.toFirst();(mi=mnii.current());++mnii)
3197 MemberDef *md=mi->memberDef;
3198 if (md->isVariable()) // for each member variable in this class
3200 QCString type=removeRedundantWhiteSpace(md->typeString());
3201 //printf("in class %s found var type=`%s' name=`%s'\n",
3202 // name().data(),type.data(),md->name().data());
3204 QCString usedClassName;
3207 while (extractClassNameFromType(type,pos,usedClassName,templSpec)!=-1 && !found)
3209 //printf("usedClassName=`%s' templSpec=%s\n",usedClassName.data(),templSpec.data());
3210 // check if usedClassName is a template argument of its class
3211 ClassDef *cd=md->getClassDef();
3212 if (cd && cd->templateArguments())
3214 ArgumentListIterator ali(*cd->templateArguments());
3217 for (ali.toFirst();(arg=ali.current());++ali,++count)
3219 if (arg->name==usedClassName) // type is a template argument
3222 if (m_impl->usesImplClassDict==0) m_impl->usesImplClassDict = new UsesClassDict(257);
3223 cd = new ClassDef(cd->getDefFileName(),cd->getDefLine(),
3224 usedClassName,ClassDef::Class);
3225 cd->setIsTemplateBaseClass(count);
3226 UsesClassDef *ucd = new UsesClassDef(cd);
3227 m_impl->usesImplClassDict->insert(cd->name(),ucd);
3228 ucd->templSpecifiers = templSpec;
3229 ucd->addAccessor(md->name());
3230 Doxygen::hiddenClasses.append(cd);
3231 //printf("Adding used template argument %s to class %s\n",
3232 // cd->name().data(),name().data());
3233 //printf("Adding accessor %s to class %s\n",
3234 // md->name().data(),ucd->classDef->name().data());
3242 if (getNamespaceDef()!=0)
3244 cd=getResolvedClass(getNamespaceDef()->name()+"::"+usedClassName,0,&templSpec);
3246 if (cd==0) cd=getResolvedClass(name()+"::"+usedClassName,0,&templSpec);
3247 if (cd==0) cd=getResolvedClass(usedClassName,0,&templSpec); // TODO: also try in-between scopes!
3248 //printf("Search for class %s result=%p\n",usedClassName.data(),cd);
3249 if (cd) // class exists
3252 if (m_impl->usesImplClassDict==0)
3254 m_impl->usesImplClassDict = new UsesClassDict(257);
3255 m_impl->usesImplClassDict->setAutoDelete(TRUE);
3257 UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name());
3258 if (ucd==0 || ucd->templSpecifiers!=templSpec)
3260 ucd = new UsesClassDef(cd);
3261 m_impl->usesImplClassDict->insert(cd->name(),ucd);
3262 ucd->templSpecifiers = templSpec;
3263 //printf("Adding used class %s to class %s\n",
3264 // cd->name().data(),name().data());
3266 ucd->addAccessor(md->name());
3267 //printf("Adding accessor %s to class %s\n",
3268 // md->name().data(),ucd->classDef->name().data());
3276 if (m_impl->usesClassDict)
3278 msg("Class %s uses the following classes:\n",name().data());
3279 UsesClassDictIterator ucdi(*m_impl->usesClassDict);
3281 for (;(ucd=ucdi.current());++ucdi)
3283 msg(" %s via ",ucd->classDef->name().data());
3284 QDictIterator<void> dvi(*ucd->accessors);
3286 for (;(s=dvi.currentKey());++dvi)
3296 //----------------------------------------------------------------------------
3298 // I have disabled this code because the graphs it renders quickly become
3299 // too large to be of practical use.
3301 void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr)
3303 QCString type = typeStr;
3304 static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*");
3306 while ((i=re.match(type,p,&l))!=-1) // for each class name in the type
3308 ClassDef *cd=getClass(name()+"::"+type.mid(i,l));
3309 if (cd==0) cd=getClass(type.mid(i,l)); // TODO: also try in-between scopes!
3310 if (cd && cd!=this && !isBaseClass(cd))
3312 if (m_impl->usesIntfClassDict==0)
3314 m_impl->usesIntfClassDict = new UsesClassDict(257);
3316 UsesClassDef *ucd=m_impl->usesIntfClassDict->find(cd->name());
3319 ucd = new UsesClassDef(cd);
3320 m_impl->usesIntfClassDict->insert(cd->name(),ucd);
3321 //printf("in class `%s' adding used intf class `%s'\n",
3322 // name().data(),cd->name().data());
3324 ucd->addAccessor(md->name());
3325 //printf("in class `%s' adding accessor `%s' to class `%s'\n",
3326 // name().data(),md->name().data(),ucd->classDef->name().data());
3332 void ClassDef::determineIntfUsageRelation()
3334 MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoList);
3335 MemberNameInfo *mni;
3336 for (;(mni=mnili.current());++mnili)
3338 MemberNameInfoIterator mnii(*mni);
3340 for (mnii.toFirst();(mi=mnii.current());++mnii)
3342 MemberDef *md=mi->memberDef;
3344 // compute the protection level for this member
3345 Protection protect=md->protection();
3346 if (mi->prot==Protected) // inherited protection
3348 if (protect==Public) protect=Protected;
3349 else if (protect==Protected) protect=Private;
3352 if (!md->name().isEmpty() && md->name()[0]!='@' &&
3353 (mi->prot!=Private && protect!=Private)
3356 // add classes found in the return type
3357 addUsedInterfaceClasses(md,md->typeString());
3358 ArgumentList *al = md->argumentList();
3359 if (al) // member has arguments
3361 // add classes found in the types of the argument list
3362 ArgumentListIterator ali(*al);
3364 for (;(a=ali.current());++ali)
3366 if (!a->type.isEmpty() && a->type.at(0)!='@')
3368 addUsedInterfaceClasses(md,a->type);
3378 QCString ClassDef::compoundTypeString() const
3380 if (getLanguage()==SrcLangExt_Fortran)
3382 switch (m_impl->compType)
3384 case Class: return "module";
3385 case Struct: return "type";
3386 case Union: return "union";
3387 case Interface: return "interface";
3388 case Protocol: return "protocol";
3389 case Category: return "category";
3390 case Exception: return "exception";
3391 default: return "unknown";
3396 switch (m_impl->compType)
3398 case Class: return isJavaEnum() ? "enum" : "class";
3399 case Struct: return "struct";
3400 case Union: return "union";
3401 case Interface: return getLanguage()==SrcLangExt_ObjC ? "class" : "interface";
3402 case Protocol: return "protocol";
3403 case Category: return "category";
3404 case Exception: return "exception";
3405 case Service: return "service";
3406 case Singleton: return "singleton";
3407 default: return "unknown";
3412 QCString ClassDef::getOutputFileBase() const
3414 static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES");
3415 static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS");
3416 static bool separateMemberPages = Config_getBool("SEPARATE_MEMBER_PAGES");
3417 if (!Doxygen::generatingXmlOutput && !separateMemberPages)
3419 Definition *scope=0;
3420 if (inlineGroupedClasses && partOfGroups()!=0)
3422 // point to the group that embeds this class
3423 return partOfGroups()->at(0)->getOutputFileBase();
3425 else if (inlineSimpleClasses && m_impl->isSimple && partOfGroups()!=0)
3427 // point to simple struct inside a group
3428 return partOfGroups()->at(0)->getOutputFileBase();
3430 else if (inlineSimpleClasses && m_impl->isSimple && (scope=getOuterScope()))
3432 if (scope==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) // simple struct embedded in file
3434 return getFileDef()->getOutputFileBase();
3436 else if (scope->isLinkableInProject()) // simple struct embedded in other container (namespace/group/class)
3438 return getOuterScope()->getOutputFileBase();
3442 if (m_impl->templateMaster)
3444 // point to the template of which this class is an instance
3445 return m_impl->templateMaster->getOutputFileBase();
3447 else if (isReference())
3449 // point to the external location
3450 return m_impl->fileName;
3454 // normal locally defined class
3455 return convertNameToFile(m_impl->fileName);
3459 QCString ClassDef::getInstanceOutputFileBase() const
3463 return m_impl->fileName;
3467 return convertNameToFile(m_impl->fileName);
3471 QCString ClassDef::getFileBase() const
3473 if (m_impl->templateMaster)
3475 return m_impl->templateMaster->getFileBase();
3479 return m_impl->fileName;
3483 QCString ClassDef::getSourceFileBase() const
3485 if (m_impl->templateMaster)
3487 return m_impl->templateMaster->getSourceFileBase();
3491 return Definition::getSourceFileBase();
3495 void ClassDef::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs)
3498 //printf("ClassDef::setGroupDefForAllMembers(%s)\n",gd->name().data());
3499 if (m_impl->allMemberNameInfoSDict==0) return;
3500 MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict);
3501 MemberNameInfo *mni;
3502 for (;(mni=mnili.current());++mnili)
3504 MemberNameInfoIterator mnii(*mni);
3506 for (mnii.toFirst();(mi=mnii.current());++mnii)
3508 MemberDef *md=mi->memberDef;
3509 md->setGroupDef(gd,pri,fileName,startLine,hasDocs);
3510 gd->insertMember(md,TRUE);
3511 ClassDef *innerClass = md->getClassDefOfAnonymousType();
3512 if (innerClass) innerClass->setGroupDefForAllMembers(gd,pri,fileName,startLine,hasDocs);
3517 void ClassDef::addInnerCompound(Definition *d)
3519 //printf("**** %s::addInnerCompound(%s)\n",name().data(),d->name().data());
3520 if (d->definitionType()==Definition::TypeClass) // only classes can be
3521 // nested in classes.
3523 if (m_impl->innerClasses==0)
3525 m_impl->innerClasses = new ClassSDict(17);
3527 m_impl->innerClasses->inSort(d->localName(),(ClassDef *)d);
3531 Definition *ClassDef::findInnerCompound(const char *name)
3533 Definition *result=0;
3534 if (name==0) return 0;
3535 if (m_impl->innerClasses)
3537 result = m_impl->innerClasses->find(name);
3542 //void ClassDef::initTemplateMapping()
3544 // m_impl->templateMapping->clear();
3545 // ArgumentList *al = templateArguments();
3548 // ArgumentListIterator ali(*al);
3550 // for (ali.toFirst();(arg=ali.current());++ali)
3552 // setTemplateArgumentMapping(arg->name,arg->defval);
3556 //void ClassDef::setTemplateArgumentMapping(const char *formal,const char *actual)
3558 // //printf("ClassDef::setTemplateArgumentMapping(%s,%s)\n",formal,actual);
3559 // if (m_impl->templateMapping && formal)
3561 // if (m_impl->templateMapping->find(formal))
3563 // m_impl->templateMapping->remove(formal);
3565 // m_impl->templateMapping->insert(formal,new QCString(actual));
3569 //QCString ClassDef::getTemplateArgumentMapping(const char *formal) const
3571 // if (m_impl->templateMapping && formal)
3573 // QCString *s = m_impl->templateMapping->find(formal);
3582 ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName,
3583 int startLine, int startColumn, const QCString &templSpec,bool &freshInstance)
3585 freshInstance = FALSE;
3586 if (m_impl->templateInstances==0)
3588 m_impl->templateInstances = new QDict<ClassDef>(17);
3590 ClassDef *templateClass=m_impl->templateInstances->find(templSpec);
3591 if (templateClass==0)
3593 Debug::print(Debug::Classes,0," New template instance class `%s'`%s'\n",name().data(),templSpec.data());
3594 QCString tcname = removeRedundantWhiteSpace(localName()+templSpec);
3595 templateClass = new ClassDef(
3596 fileName,startLine,startColumn,tcname,ClassDef::Class);
3597 templateClass->setTemplateMaster(this);
3598 templateClass->setOuterScope(getOuterScope());
3599 templateClass->setHidden(isHidden());
3600 m_impl->templateInstances->insert(templSpec,templateClass);
3603 return templateClass;
3606 ClassDef *ClassDef::getVariableInstance(const char *templSpec)
3608 if (m_impl->variableInstances==0)
3610 m_impl->variableInstances = new QDict<ClassDef>(17);
3611 m_impl->variableInstances->setAutoDelete(TRUE);
3613 ClassDef *templateClass=m_impl->variableInstances->find(templSpec);
3614 if (templateClass==0)
3616 Debug::print(Debug::Classes,0," New template variable instance class `%s'`%s'\n",qPrint(name()),qPrint(templSpec));
3617 QCString tcname = removeRedundantWhiteSpace(name()+templSpec);
3618 templateClass = new ClassDef("<code>",1,1,tcname,
3619 ClassDef::Class,0,0,FALSE);
3620 templateClass->addMembersToTemplateInstance( this, templSpec );
3621 templateClass->setTemplateMaster(this);
3622 m_impl->variableInstances->insert(templSpec,templateClass);
3624 return templateClass;
3627 void ClassDef::setTemplateBaseClassNames(QDict<int> *templateNames)
3629 if (templateNames==0) return;
3630 if (m_impl->templBaseClassNames==0)
3632 m_impl->templBaseClassNames = new QDict<int>(17);
3633 m_impl->templBaseClassNames->setAutoDelete(TRUE);
3635 // make a deep copy of the dictionary.
3636 QDictIterator<int> qdi(*templateNames);
3637 for (;qdi.current();++qdi)
3639 if (m_impl->templBaseClassNames->find(qdi.currentKey())==0)
3641 m_impl->templBaseClassNames->insert(qdi.currentKey(),new int(*qdi.current()));
3646 QDict<int> *ClassDef::getTemplateBaseClassNames() const
3648 return m_impl->templBaseClassNames;
3651 void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec)
3653 //printf("%s::addMembersToTemplateInstance(%s,%s)\n",name().data(),cd->name().data(),templSpec);
3654 if (cd->memberNameInfoSDict()==0) return;
3655 MemberNameInfoSDict::Iterator mnili(*cd->memberNameInfoSDict());
3656 MemberNameInfo *mni;
3657 for (;(mni=mnili.current());++mnili)
3659 MemberNameInfoIterator mnii(*mni);
3661 for (mnii.toFirst();(mi=mnii.current());++mnii)
3663 ArgumentList *actualArguments = new ArgumentList;
3664 stringToArgumentList(templSpec,actualArguments);
3665 MemberDef *md = mi->memberDef;
3666 MemberDef *imd = md->createTemplateInstanceMember(
3667 cd->templateArguments(),actualArguments);
3668 delete actualArguments;
3669 //printf("%s->setMemberClass(%p)\n",imd->name().data(),this);
3670 imd->setMemberClass(this);
3671 imd->setTemplateMaster(md);
3672 imd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
3673 imd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
3674 imd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
3675 imd->setMemberSpecifiers(md->getMemberSpecifiers());
3676 imd->setMemberGroupId(md->getMemberGroupId());
3678 //printf("Adding member=%s %s%s to class %s templSpec %s\n",
3679 // imd->typeString(),imd->name().data(),imd->argsString(),
3680 // imd->getClassDef()->name().data(),templSpec);
3681 // insert imd in the list of all members
3682 //printf("Adding member=%s class=%s\n",imd->name().data(),name().data());
3683 MemberName *mn = Doxygen::memberNameSDict->find(imd->name());
3686 mn = new MemberName(imd->name());
3687 Doxygen::memberNameSDict->append(imd->name(),mn);
3694 QCString ClassDef::getReference() const
3696 if (m_impl->templateMaster)
3698 return m_impl->templateMaster->getReference();
3702 return Definition::getReference();
3706 bool ClassDef::isReference() const
3708 if (m_impl->templateMaster)
3710 return m_impl->templateMaster->isReference();
3714 return Definition::isReference();
3718 void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const
3720 Definition *d=getOuterScope();
3723 if (d->definitionType()==Definition::TypeClass)
3725 ClassDef *cd=(ClassDef *)d;
3726 cd->getTemplateParameterLists(lists);
3729 if (templateArguments())
3731 lists.append(templateArguments());
3735 QCString ClassDef::qualifiedNameWithTemplateParameters(
3736 QList<ArgumentList> *actualParams,int *actualParamIndex) const
3738 //static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
3739 static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES");
3740 //printf("qualifiedNameWithTemplateParameters() localName=%s\n",localName().data());
3742 Definition *d=getOuterScope();
3745 if (d->definitionType()==Definition::TypeClass)
3747 ClassDef *cd=(ClassDef *)d;
3748 scName = cd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex);
3750 else if (!hideScopeNames)
3752 scName = d->qualifiedName();
3756 SrcLangExt lang = getLanguage();
3757 QCString scopeSeparator = getLanguageSpecificSeparator(lang);
3758 if (!scName.isEmpty()) scName+=scopeSeparator;
3760 bool isSpecialization = localName().find('<')!=-1;
3762 QCString clName = className();
3763 //bool isGeneric = getLanguage()==SrcLangExt_CSharp;
3764 //if (isGeneric && clName.right(2)=="-g")
3766 // clName = clName.left(clName.length()-2);
3768 //printf("m_impl->lang=%d clName=%s\n",m_impl->lang,clName.data());
3771 if (templateArguments())
3773 if (actualParams && *actualParamIndex<(int)actualParams->count())
3775 al = actualParams->at(*actualParamIndex);
3776 if (!isSpecialization)
3778 scName+=tempArgListToString(al);
3780 (*actualParamIndex)++;
3784 if (!isSpecialization)
3786 scName+=tempArgListToString(templateArguments());
3790 //printf("qualifiedNameWithTemplateParameters: scope=%s qualifiedName=%s\n",name().data(),scName.data());
3794 QCString ClassDef::className() const
3796 if (m_impl->className.isEmpty())
3802 return m_impl->className;
3806 void ClassDef::setClassName(const char *name)
3808 m_impl->className = name;
3811 void ClassDef::addListReferences()
3813 SrcLangExt lang = getLanguage();
3814 if (!isLinkableInProject()) return;
3815 //printf("ClassDef(%s)::addListReferences()\n",name().data());
3817 QList<ListItemInfo> *xrefItems = xrefListItems();
3818 addRefItem(xrefItems,
3820 lang==SrcLangExt_Fortran ? theTranslator->trType(TRUE,TRUE)
3821 : theTranslator->trClass(TRUE,TRUE),
3822 getOutputFileBase(),
3827 if (m_impl->memberGroupSDict)
3829 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
3831 for (;(mg=mgli.current());++mgli)
3833 mg->addListReferences(this);
3836 QListIterator<MemberList> mli(m_impl->memberLists);
3838 for (mli.toFirst();(ml=mli.current());++mli)
3840 if (ml->listType()&MemberListType_detailedLists)
3842 ml->addListReferences(this);
3847 MemberDef *ClassDef::getMemberByName(const QCString &name) const
3850 if (m_impl->allMemberNameInfoSDict)
3852 MemberNameInfo *mni = m_impl->allMemberNameInfoSDict->find(name);
3855 const int maxInheritanceDepth = 100000;
3856 int mdist=maxInheritanceDepth;
3857 MemberNameInfoIterator mnii(*mni);
3859 for (mnii.toFirst();(mi=mnii.current());++mnii)
3861 ClassDef *mcd=mi->memberDef->getClassDef();
3862 int m=minClassDistance(this,mcd);
3863 //printf("found member in %s linkable=%d m=%d\n",
3864 // mcd->name().data(),mcd->isLinkable(),m);
3865 if (m<mdist && mcd->isLinkable())
3873 //printf("getMemberByName(%s)=%p\n",name.data(),xmd);
3877 bool ClassDef::isAccessibleMember(MemberDef *md)
3879 return md->getClassDef() && isBaseClass(md->getClassDef(),TRUE);
3882 MemberList *ClassDef::createMemberList(MemberListType lt)
3884 m_impl->memberLists.setAutoDelete(TRUE);
3885 QListIterator<MemberList> mli(m_impl->memberLists);
3887 for (mli.toFirst();(ml=mli.current());++mli)
3889 if (ml->listType()==lt)
3894 // not found, create a new member list
3895 ml = new MemberList(lt);
3896 m_impl->memberLists.append(ml);
3900 MemberList *ClassDef::getMemberList(MemberListType lt)
3902 QListIterator<MemberList> mli(m_impl->memberLists);
3904 for (;(ml=mli.current());++mli)
3906 if (ml->listType()==lt)
3914 void ClassDef::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief)
3916 static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS");
3917 static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS");
3918 MemberList *ml = createMemberList(lt);
3919 ml->setNeedsSorting((isBrief && sortBriefDocs) || (!isBrief && sortMemberDocs));
3922 // for members in the declaration lists we set the section, needed for member grouping
3923 if ((ml->listType()&MemberListType_detailedLists)==0) md->setSectionList(this,ml);
3926 void ClassDef::sortMemberLists()
3928 QListIterator<MemberList> mli(m_impl->memberLists);
3930 for (;(ml=mli.current());++mli)
3932 if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); }
3934 if (m_impl->innerClasses)
3936 m_impl->innerClasses->sort();
3940 int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom,
3941 int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses)
3943 //printf("%s: countMemberDeclarations for %d and %d\n",name().data(),lt,lt2);
3945 MemberList * ml = getMemberList(lt);
3946 MemberList * ml2 = getMemberList((MemberListType)lt2);
3947 if (getLanguage()!=SrcLangExt_VHDL) // use specific declarations function
3951 ml->countDecMembers();
3952 count+=ml->numDecMembers();
3953 //printf("-> ml=%d\n",ml->numDecMembers());
3957 ml2->countDecMembers();
3958 count+=ml2->numDecMembers();
3959 //printf("-> ml2=%d\n",ml2->numDecMembers());
3961 // also include grouped members that have their own section in the class (see bug 722759)
3962 if (inheritedFrom && m_impl->memberGroupSDict)
3964 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
3966 for (;(mg=mgli.current());++mgli)
3968 count+=mg->countGroupedInheritedMembers(lt);
3969 if (lt2!=1) count+=mg->countGroupedInheritedMembers((MemberListType)lt2);
3972 static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB");
3973 if (!inlineInheritedMembers) // show inherited members as separate lists
3975 QPtrDict<void> visited(17);
3976 count+=countInheritedDecMembers(lt,inheritedFrom,invert,showAlways,visitedClasses);
3979 //printf("-> %d\n",count);
3984 int ClassDef::countInheritedDecMembers(MemberListType lt,
3985 ClassDef *inheritedFrom,bool invert,bool showAlways,
3986 QPtrDict<void> *visitedClasses)
3989 int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE);
3990 bool process = count>0;
3991 //printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n",
3992 // name().data(),lt,process,count,invert);
3993 if ((process^invert) || showAlways)
3995 if (m_impl->inherits)
3997 BaseClassListIterator it(*m_impl->inherits);
3999 for (it.toFirst();(ibcd=it.current());++it)
4001 ClassDef *icd=ibcd->classDef;
4003 if (icd->isLinkable())
4005 convertProtectionLevel(lt,ibcd->prot,<1,<2);
4006 //printf("%s: convert %d->(%d,%d) prot=%d\n",
4007 // icd->name().data(),lt,lt1,lt2,ibcd->prot);
4008 if (visitedClasses->find(icd)==0)
4010 visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance
4013 inhCount+=icd->countMemberDeclarations((MemberListType)lt1,inheritedFrom,lt2,FALSE,TRUE,visitedClasses);
4023 void ClassDef::getTitleForMemberListType(MemberListType type,
4024 QCString &title,QCString &subtitle)
4026 SrcLangExt lang = getLanguage();
4027 QListIterator<LayoutDocEntry> eli(
4028 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
4029 LayoutDocEntry *lde;
4030 for (eli.toFirst();(lde=eli.current());++eli)
4032 if (lde->kind()==LayoutDocEntry::MemberDecl)
4034 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
4035 if (lmd->type==type)
4037 title = lmd->title(lang);
4038 subtitle = lmd->subtitle(lang);
4047 int ClassDef::countAdditionalInheritedMembers()
4050 QListIterator<LayoutDocEntry> eli(
4051 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
4052 LayoutDocEntry *lde;
4053 for (eli.toFirst();(lde=eli.current());++eli)
4055 if (lde->kind()==LayoutDocEntry::MemberDecl)
4057 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
4058 if (lmd->type!=MemberListType_friends) // friendship is not inherited
4060 //MemberList *ml = getMemberList(lmd->type);
4061 //if (ml==0 || ml->numDecMembers()==0)
4063 QPtrDict<void> visited(17);
4064 totalCount+=countInheritedDecMembers(lmd->type,this,TRUE,FALSE,&visited);
4069 //printf("countAdditonalInheritedMembers()=%d\n",totalCount);
4073 void ClassDef::writeAdditionalInheritedMembers(OutputList &ol)
4075 //printf("**** writeAdditionalInheritedMembers()\n");
4076 QListIterator<LayoutDocEntry> eli(
4077 LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
4078 LayoutDocEntry *lde;
4079 for (eli.toFirst();(lde=eli.current());++eli)
4081 if (lde->kind()==LayoutDocEntry::MemberDecl)
4083 LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
4084 if (lmd->type!=MemberListType_friends)
4086 QPtrDict<void> visited(17);
4087 writeInheritedMemberDeclarations(ol,lmd->type,-1,lmd->title(getLanguage()),this,TRUE,FALSE,&visited);
4093 int ClassDef::countMembersIncludingGrouped(MemberListType lt,
4094 ClassDef *inheritedFrom,bool additional)
4097 MemberList *ml = getMemberList(lt);
4100 count=ml->countInheritableMembers(inheritedFrom);
4102 //printf("%s:countMembersIncludingGrouped: count=%d\n",name().data(),count);
4103 if (m_impl->memberGroupSDict)
4105 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
4107 for (;(mg=mgli.current());++mgli)
4109 bool hasOwnSection = !mg->allMembersInSameSection() ||
4110 !m_impl->subGrouping; // group is in its own section
4111 if ((additional && hasOwnSection) || (!additional && !hasOwnSection))
4113 count+=mg->countGroupedInheritedMembers(lt);
4117 //printf("%s:countMembersIncludingGrouped(lt=%d,%s)=%d\n",
4118 // name().data(),lt,ml?ml->listTypeAsString(ml->listType()).data():"<none>",count);
4122 void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
4123 MemberListType lt,int lt2,const QCString &title,
4124 ClassDef *inheritedFrom,bool invert,bool showAlways,
4125 QPtrDict<void> *visitedClasses)
4127 ol.pushGeneratorState();
4128 ol.disableAllBut(OutputGenerator::Html);
4129 int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE);
4130 bool process = count>0;
4131 //printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n",
4132 // name().data(),lt,process,invert,showAlways);
4133 if ((process^invert) || showAlways)
4135 if (m_impl->inherits)
4137 BaseClassListIterator it(*m_impl->inherits);
4139 for (it.toFirst();(ibcd=it.current());++it)
4141 ClassDef *icd=ibcd->classDef;
4142 if (icd->isLinkable())
4145 convertProtectionLevel(lt,ibcd->prot,<1,<3);
4146 if (lt2==-1 && lt3!=-1)
4150 //printf("%s:convert %d->(%d,%d) prot=%d\n",icd->name().data(),lt,lt1,lt2,ibcd->prot);
4151 if (visitedClasses->find(icd)==0)
4153 visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance
4156 icd->writeMemberDeclarations(ol,(MemberListType)lt1,
4157 title,QCString(),FALSE,inheritedFrom,lt2,FALSE,TRUE,visitedClasses);
4162 //printf("%s: class already visited!\n",icd->name().data());
4168 ol.popGeneratorState();
4171 void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title,
4172 const char *subTitle,bool showInline,ClassDef *inheritedFrom,int lt2,
4173 bool invert,bool showAlways,QPtrDict<void> *visitedClasses)
4175 //printf("%s: ClassDef::writeMemberDeclarations lt=%d lt2=%d\n",name().data(),lt,lt2);
4176 MemberList * ml = getMemberList(lt);
4177 MemberList * ml2 = getMemberList((MemberListType)lt2);
4178 if (getLanguage()==SrcLangExt_VHDL) // use specific declarations function
4182 VhdlDocGen::writeVhdlDeclarations(ml,ol,0,this,0,0);
4187 //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",name().data(),title.data(),ml,ml2);
4188 QCString tt = title, st = subTitle;
4191 //printf(" writeDeclaration type=%d count=%d\n",lt,ml->numDecMembers());
4192 ml->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt);
4198 //printf(" writeDeclaration type=%d count=%d\n",lt2,ml2->numDecMembers());
4199 ml2->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt);
4201 static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB");
4202 if (!inlineInheritedMembers) // show inherited members as separate lists
4204 QPtrDict<void> visited(17);
4205 writeInheritedMemberDeclarations(ol,lt,lt2,title,
4206 inheritedFrom ? inheritedFrom : this,
4208 visitedClasses==0 ? &visited: visitedClasses);
4213 void ClassDef::addGroupedInheritedMembers(OutputList &ol,MemberListType lt,
4214 ClassDef *inheritedFrom,const QCString &inheritId)
4216 //printf("** %s::addGroupedInheritedMembers(%p) inheritId=%s\n",name().data(),m_impl->memberGroupSDict,inheritId.data());
4217 if (m_impl->memberGroupSDict)
4219 MemberGroupSDict::Iterator mgli(*m_impl->memberGroupSDict);
4221 for (;(mg=mgli.current());++mgli)
4223 if (!mg->allMembersInSameSection() || !m_impl->subGrouping) // group is in its own section
4225 mg->addGroupedInheritedMembers(ol,this,lt,inheritedFrom,inheritId);
4231 void ClassDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline)
4233 //printf("%s: ClassDef::writeMemberDocumentation()\n",name().data());
4234 MemberList * ml = getMemberList(lt);
4235 if (ml) ml->writeDocumentation(ol,displayName(),this,title,FALSE,showInline);
4238 void ClassDef::writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt)
4240 //printf("%s: ClassDef::writeSimpleMemberDocumentation()\n",name().data());
4241 MemberList * ml = getMemberList(lt);
4242 if (ml) ml->writeSimpleDocumentation(ol,this);
4245 void ClassDef::writePlainMemberDeclaration(OutputList &ol,
4246 MemberListType lt,bool inGroup,
4247 ClassDef *inheritedFrom,const char *inheritId)
4249 //printf("%s: ClassDef::writePlainMemberDeclaration()\n",name().data());
4250 MemberList * ml = getMemberList(lt);
4253 ml->setInGroup(inGroup);
4254 ml->writePlainDeclarations(ol,this,0,0,0,definitionType(),inheritedFrom,inheritId);
4258 bool ClassDef::isLocal() const
4260 return m_impl->isLocal;
4263 ClassSDict *ClassDef::getClassSDict()
4265 return m_impl->innerClasses;
4268 ClassDef::CompoundType ClassDef::compoundType() const
4270 return m_impl->compType;
4273 BaseClassList *ClassDef::baseClasses() const
4275 return m_impl->inherits;
4278 BaseClassList *ClassDef::subClasses() const
4280 return m_impl->inheritedBy;
4283 MemberNameInfoSDict *ClassDef::memberNameInfoSDict() const
4285 return m_impl->allMemberNameInfoSDict;
4288 Protection ClassDef::protection() const
4290 return m_impl->prot;
4293 ArgumentList *ClassDef::templateArguments() const
4295 return m_impl->tempArgs;
4298 NamespaceDef *ClassDef::getNamespaceDef() const
4300 return m_impl->nspace;
4303 FileDef *ClassDef::getFileDef() const
4305 return m_impl->fileDef;
4308 QDict<ClassDef> *ClassDef::getTemplateInstances() const
4310 return m_impl->templateInstances;
4313 ClassDef *ClassDef::templateMaster() const
4315 return m_impl->templateMaster;
4318 bool ClassDef::isTemplate() const
4320 return m_impl->tempArgs!=0;
4323 IncludeInfo *ClassDef::includeInfo() const
4325 return m_impl->incInfo;
4328 UsesClassDict *ClassDef::usedImplementationClasses() const
4330 return m_impl->usesImplClassDict;
4333 UsesClassDict *ClassDef::usedByImplementationClasses() const
4335 return m_impl->usedByImplClassDict;
4338 UsesClassDict *ClassDef::usedInterfaceClasses() const
4340 return m_impl->usesIntfClassDict;
4343 bool ClassDef::isTemplateArgument() const
4345 return m_impl->isTemplArg;
4348 bool ClassDef::isAbstract() const
4350 return m_impl->isAbstract || (m_impl->spec&Entry::Abstract);
4353 bool ClassDef::isFinal() const
4355 return m_impl->spec&Entry::Final;
4358 bool ClassDef::isSealed() const
4360 return m_impl->spec&Entry::Sealed;
4363 bool ClassDef::isPublished() const
4365 return m_impl->spec&Entry::Published;
4368 bool ClassDef::isObjectiveC() const
4370 return getLanguage()==SrcLangExt_ObjC;
4373 bool ClassDef::isCSharp() const
4375 return getLanguage()==SrcLangExt_CSharp;
4378 ClassDef *ClassDef::categoryOf() const
4380 return m_impl->categoryOf;
4383 const QList<MemberList> &ClassDef::getMemberLists() const
4385 return m_impl->memberLists;
4388 MemberGroupSDict *ClassDef::getMemberGroupSDict() const
4390 return m_impl->memberGroupSDict;
4393 void ClassDef::setNamespace(NamespaceDef *nd)
4395 m_impl->nspace = nd;
4398 void ClassDef::setFileDef(FileDef *fd)
4403 void ClassDef::setSubGrouping(bool enabled)
4405 m_impl->subGrouping = enabled;
4408 void ClassDef::setProtection(Protection p)
4413 void ClassDef::setIsStatic(bool b)
4418 void ClassDef::setCompoundType(CompoundType t)
4420 m_impl->compType = t;
4423 void ClassDef::setTemplateMaster(ClassDef *tm)
4425 m_impl->templateMaster=tm;
4428 void ClassDef::makeTemplateArgument(bool b)
4430 m_impl->isTemplArg = b;
4433 void ClassDef::setCategoryOf(ClassDef *cd)
4435 m_impl->categoryOf = cd;
4438 void ClassDef::setUsedOnly(bool b)
4440 m_impl->usedOnly = b;
4443 bool ClassDef::isUsedOnly() const
4445 return m_impl->usedOnly;
4448 bool ClassDef::isSimple() const
4450 return m_impl->isSimple;
4453 MemberDef *ClassDef::isSmartPointer() const
4455 return m_impl->arrowOperator;
4458 void ClassDef::reclassifyMember(MemberDef *md,MemberType t)
4460 md->setMemberType(t);
4461 QListIterator<MemberList> mli(m_impl->memberLists);
4463 for (;(ml=mli.current());++mli)
4470 QCString ClassDef::anchor() const
4473 if (isEmbeddedInOuterScope() && !Doxygen::generatingXmlOutput)
4475 if (m_impl->templateMaster)
4477 // point to the template of which this class is an instance
4478 anc = m_impl->templateMaster->getOutputFileBase();
4480 else if (isReference())
4482 // point to the external location
4483 anc = m_impl->fileName;
4487 // normal locally defined class
4488 anc = convertNameToFile(m_impl->fileName);
4494 bool ClassDef::isEmbeddedInOuterScope() const
4496 static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES");
4497 static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS");
4499 Definition *container = getOuterScope();
4501 bool containerLinkable =
4504 (container==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) || // global class in documented file
4505 container->isLinkableInProject() // class in documented scope
4508 // inline because of INLINE_GROUPED_CLASSES=YES ?
4509 bool b1 = (inlineGroupedClasses && partOfGroups()!=0); // a grouped class
4510 // inline because of INLINE_SIMPLE_STRUCTS=YES ?
4511 bool b2 = (inlineSimpleClasses && m_impl->isSimple && // a simple class
4512 (containerLinkable || // in a documented container
4513 partOfGroups()!=0 // or part of a group
4516 //printf("%s::isEmbeddedInOuterScope(): inlineGroupedClasses=%d "
4517 // "inlineSimpleClasses=%d partOfGroups()=%p m_impl->isSimple=%d "
4518 // "getOuterScope()=%s b1=%d b2=%d\n",
4519 // name().data(),inlineGroupedClasses,inlineSimpleClasses,
4520 // partOfGroups().pointer(),m_impl->isSimple,getOuterScope()?getOuterScope()->name().data():"<none>",b1,b2);
4521 return b1 || b2; // either reason will do
4524 const ClassList *ClassDef::taggedInnerClasses() const
4526 return m_impl->taggedInnerClasses;
4529 void ClassDef::addTaggedInnerClass(ClassDef *cd)
4531 if (m_impl->taggedInnerClasses==0)
4533 m_impl->taggedInnerClasses = new ClassList;
4535 m_impl->taggedInnerClasses->append(cd);
4538 ClassDef *ClassDef::tagLessReference() const
4540 return m_impl->tagLessRef;
4543 void ClassDef::setTagLessReference(ClassDef *cd)
4545 m_impl->tagLessRef = cd;
4548 void ClassDef::removeMemberFromLists(MemberDef *md)
4550 QListIterator<MemberList> mli(m_impl->memberLists);
4552 for (;(ml=mli.current());++mli)
4558 bool ClassDef::isJavaEnum() const
4560 return m_impl->isJavaEnum;
4563 bool ClassDef::isGeneric() const
4565 return m_impl->isGeneric;
4568 void ClassDef::setClassSpecifier(uint64 spec)
4570 m_impl->spec = spec;
4573 bool ClassDef::isExtension() const
4575 QCString n = name();
4576 int si = n.find('(');
4577 int ei = n.find(')');
4578 bool b = ei>si && n.mid(si+1,ei-si-1).stripWhiteSpace().isEmpty();
4582 const ClassSDict *ClassDef::innerClasses() const
4584 return m_impl->innerClasses;
4587 const FileList &ClassDef::usedFiles() const
4589 return m_impl->files;
4592 const ArgumentList *ClassDef::typeConstraints() const
4594 return m_impl->typeConstraints;
4597 const ExampleSDict *ClassDef::exampleList() const
4599 return m_impl->exampleSDict;
4602 bool ClassDef::subGrouping() const
4604 return m_impl->subGrouping;