From 046aece77e373b5280b56bf871fa6e974d06e85d Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 15 Oct 2021 10:45:59 +0900 Subject: Imported Upstream version 1.8.3 --- src/dot.cpp | 114 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 43 deletions(-) (limited to 'src/dot.cpp') diff --git a/src/dot.cpp b/src/dot.cpp index 71a96a1..0866768 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -1,6 +1,6 @@ /***************************************************************************** * - * $Id: dot.cpp,v 1.20 2001/03/19 19:27:40 root Exp $ + * * * * Copyright (C) 1997-2012 by Dimitri van Heesch. @@ -23,6 +23,13 @@ #include +#include +#include +#include +#include +#include +#include + #include "dot.h" #include "doxygen.h" #include "message.h" @@ -36,15 +43,15 @@ #include "portable.h" #include "dirdef.h" #include "vhdldocgen.h" -#include -#include #include "ftextstream.h" #include "md5.h" -#include - -#include -#include -#include +#include "memberlist.h" +#include "groupdef.h" +#include "classlist.h" +#include "filename.h" +#include "namespacedef.h" +#include "memberdef.h" +#include "membergroup.h" #define MAP_CMD "cmapx" @@ -762,7 +769,7 @@ class DotNodeList : public QList public: DotNodeList() : QList() {} ~DotNodeList() {} - int compareItems(GCI item1,GCI item2) + int compareItems(QCollection::Item item1,QCollection::Item item2) { return stricmp(((DotNode *)item1)->m_label,((DotNode *)item2)->m_label); } @@ -1408,7 +1415,6 @@ bool DotManager::run() return TRUE; } - //-------------------------------------------------------------------- @@ -1682,6 +1688,18 @@ static void writeBoxMemberList(FTextStream &t, } } +static QCString stripProtectionPrefix(const QCString &s) +{ + if (!s.isEmpty() && (s[0]=='-' || s[0]=='+' || s[0]=='~' || s[0]=='#')) + { + return s.mid(1); + } + else + { + return s; + } +} + void DotNode::writeBox(FTextStream &t, GraphType gt, GraphOutputFormat /*format*/, @@ -1698,18 +1716,29 @@ void DotNode::writeBox(FTextStream &t, if (m_classDef && umlLook && (gt==Inheritance || gt==Collaboration)) { - // add names shown as relation to a dictionary, so we don't show + // add names shown as relations to a dictionary, so we don't show // them as attributes as well QDict arrowNames(17); if (m_edgeInfo) { + // for each edge QListIterator li(*m_edgeInfo); EdgeInfo *ei; for (li.toFirst();(ei=li.current());++li) { - if (!ei->m_label.isEmpty()) + if (!ei->m_label.isEmpty()) // labels joined by \n { - arrowNames.insert(ei->m_label,(void*)0x8); + int li=ei->m_label.find('\n'); + int p=0; + QCString lab; + while ((li=ei->m_label.find('\n',p))!=-1) + { + lab = stripProtectionPrefix(ei->m_label.mid(p,li-p)); + arrowNames.insert(lab,(void*)0x8); + p=li+1; + } + lab = stripProtectionPrefix(ei->m_label.right(ei->m_label.length()-p)); + arrowNames.insert(lab,(void*)0x8); } } } @@ -1718,32 +1747,32 @@ void DotNode::writeBox(FTextStream &t, static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); t << "{" << convertLabel(m_label); t << "\\n|"; - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubAttribs),m_classDef,FALSE,&arrowNames); - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubStaticAttribs),m_classDef,TRUE,&arrowNames); - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::properties),m_classDef,FALSE,&arrowNames); - writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacAttribs),m_classDef,FALSE,&arrowNames); - writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacStaticAttribs),m_classDef,TRUE,&arrowNames); - writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proAttribs),m_classDef,FALSE,&arrowNames); - writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proStaticAttribs),m_classDef,TRUE,&arrowNames); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubAttribs),m_classDef,FALSE,&arrowNames); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubStaticAttribs),m_classDef,TRUE,&arrowNames); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_properties),m_classDef,FALSE,&arrowNames); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberListType_pacAttribs),m_classDef,FALSE,&arrowNames); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberListType_pacStaticAttribs),m_classDef,TRUE,&arrowNames); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberListType_proAttribs),m_classDef,FALSE,&arrowNames); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberListType_proStaticAttribs),m_classDef,TRUE,&arrowNames); if (extractPrivate) { - writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priAttribs),m_classDef,FALSE,&arrowNames); - writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priStaticAttribs),m_classDef,TRUE,&arrowNames); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberListType_priAttribs),m_classDef,FALSE,&arrowNames); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberListType_priStaticAttribs),m_classDef,TRUE,&arrowNames); } t << "|"; - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubMethods),m_classDef); - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubStaticMethods),m_classDef,TRUE); - writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberList::pubSlots),m_classDef); - writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacMethods),m_classDef); - writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberList::pacStaticMethods),m_classDef,TRUE); - writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proMethods),m_classDef); - writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proStaticMethods),m_classDef,TRUE); - writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberList::proSlots),m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubMethods),m_classDef); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubStaticMethods),m_classDef,TRUE); + writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubSlots),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberListType_pacMethods),m_classDef); + writeBoxMemberList(t,'~',m_classDef->getMemberList(MemberListType_pacStaticMethods),m_classDef,TRUE); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberListType_proMethods),m_classDef); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberListType_proStaticMethods),m_classDef,TRUE); + writeBoxMemberList(t,'#',m_classDef->getMemberList(MemberListType_proSlots),m_classDef); if (extractPrivate) { - writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priMethods),m_classDef); - writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priStaticMethods),m_classDef,TRUE); - writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberList::priSlots),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberListType_priMethods),m_classDef); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberListType_priStaticMethods),m_classDef,TRUE); + writeBoxMemberList(t,'-',m_classDef->getMemberList(MemberListType_priSlots),m_classDef); } if (m_classDef->getLanguage()!=SrcLangExt_Fortran && m_classDef->getMemberGroupSDict()) @@ -2252,7 +2281,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out, { removeDotGraph(absBaseName+".dot"); } - Doxygen::indexList.addImageFile(imgName); + Doxygen::indexList->addImageFile(imgName); // write image and map in a table row QCString mapLabel = escapeCharsInString(n->m_label,FALSE); out << ""; @@ -3066,7 +3095,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out, DotManager::instance()->addRun(dotRun); } } - Doxygen::indexList.addImageFile(baseName+"."+imgExt); + Doxygen::indexList->addImageFile(baseName+"."+imgExt); if (format==BITMAP && generateImageMap) // produce HTML to include the image { @@ -3386,7 +3415,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out, } } - Doxygen::indexList.addImageFile(baseName+"."+imgExt); + Doxygen::indexList->addImageFile(baseName+"."+imgExt); if (format==BITMAP && generateImageMap) { @@ -3678,7 +3707,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat format, } } - Doxygen::indexList.addImageFile(baseName+"."+imgExt); + Doxygen::indexList->addImageFile(baseName+"."+imgExt); if (format==BITMAP && generateImageMap) { @@ -3823,7 +3852,7 @@ QCString DotDirDeps::writeGraph(FTextStream &out, DotManager::instance()->addRun(dotRun); } } - Doxygen::indexList.addImageFile(baseName+"."+imgExt); + Doxygen::indexList->addImageFile(baseName+"."+imgExt); if (format==BITMAP && generateImageMap) { @@ -3923,8 +3952,7 @@ void generateGraphLegend(const char *path) QFile dotFile(absDotName); if (!dotFile.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", - convertToQCString(dotFile.name()).data()); + err("Could not open file %s for writing\n",dotFile.name().data()); return; } @@ -3942,7 +3970,7 @@ void generateGraphLegend(const char *path) { removeDotGraph(absDotName); } - Doxygen::indexList.addImageFile(imgName); + Doxygen::indexList->addImageFile(imgName); if (imgExt=="svg") { @@ -3991,7 +4019,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, if (format==BITMAP) checkDotResult(absImgName); - Doxygen::indexList.addImageFile(imgName); + Doxygen::indexList->addImageFile(imgName); } @@ -4128,7 +4156,7 @@ void DotGroupCollaboration::buildGraph(GroupDef* gd) // Write collaboration // Add members - addMemberList( gd->getMemberList(MemberList::allMembersList) ); + addMemberList( gd->getMemberList(MemberListType_allMembersList) ); // Add classes if ( gd->getClasses() && gd->getClasses()->count() ) -- cgit v1.2.3