diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dia.cpp | 5 | ||||
-rw-r--r-- | src/dia.h | 3 | ||||
-rw-r--r-- | src/docbookvisitor.cpp | 32 | ||||
-rw-r--r-- | src/docbookvisitor.h | 9 | ||||
-rw-r--r-- | src/docparser.cpp | 23 | ||||
-rw-r--r-- | src/docparser.h | 238 | ||||
-rw-r--r-- | src/dot.cpp | 14 | ||||
-rw-r--r-- | src/dot.h | 10 | ||||
-rw-r--r-- | src/dotgraph.cpp | 8 | ||||
-rw-r--r-- | src/dotrunner.cpp | 17 | ||||
-rw-r--r-- | src/dotrunner.h | 9 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 43 | ||||
-rw-r--r-- | src/htmldocvisitor.h | 12 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 34 | ||||
-rw-r--r-- | src/latexdocvisitor.h | 9 | ||||
-rw-r--r-- | src/msc.cpp | 19 | ||||
-rw-r--r-- | src/msc.h | 11 | ||||
-rw-r--r-- | src/plantuml.cpp | 26 | ||||
-rw-r--r-- | src/plantuml.h | 18 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 24 | ||||
-rw-r--r-- | src/rtfdocvisitor.h | 4 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 2 |
22 files changed, 321 insertions, 249 deletions
diff --git a/src/dia.cpp b/src/dia.cpp index 13c1316..effc7a1 100644 --- a/src/dia.cpp +++ b/src/dia.cpp @@ -24,7 +24,8 @@ static const int maxCmdLine = 40960; void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,DiaOutputFormat format) + const QCString &outFile,DiaOutputFormat format, + const QCString &srcFile,int srcLine) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); @@ -63,7 +64,7 @@ void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, Portable::sysTimerStart(); if ((exitCode=Portable::system(diaExe,diaArgs,FALSE))!=0) { - err("Problems running %s. Check your installation or look typos in you dia file %s\n", + err_full(srcFile,srcLine,"Problems running %s. Check your installation or look typos in you dia file %s\n", qPrint(diaExe),qPrint(inFile)); Portable::sysTimerStop(); goto error; @@ -23,7 +23,8 @@ class QCString; enum DiaOutputFormat { DIA_BITMAP , DIA_EPS }; void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,DiaOutputFormat format); + const QCString &outFile,DiaOutputFormat format, + const QCString &srcFile,int srcLine); #endif diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index aa74e47..0bc2042 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -400,7 +400,7 @@ DB_VIS_C case DocVerbatim::PlantUML: { static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT); - QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine()); + QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine(),s->srcFile(),s->srcLine()); QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) @@ -1269,7 +1269,7 @@ void DocbookDocVisitor::visitPre(DocDotFile *df) { DB_VIS_C if (m_hide) return; - startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); + startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine()); } void DocbookDocVisitor::visitPost(DocDotFile *df) @@ -1283,7 +1283,7 @@ void DocbookDocVisitor::visitPre(DocMscFile *df) { DB_VIS_C if (m_hide) return; - startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); + startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine()); } void DocbookDocVisitor::visitPost(DocMscFile *df) @@ -1296,7 +1296,7 @@ void DocbookDocVisitor::visitPre(DocDiaFile *df) { DB_VIS_C if (m_hide) return; - startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); + startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine()); } void DocbookDocVisitor::visitPost(DocDiaFile *df) @@ -1634,7 +1634,7 @@ DB_VIS_C shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); - writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); + writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP,s->srcFile(),s->srcLine()); visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(), s->height()); visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); @@ -1660,7 +1660,9 @@ void DocbookDocVisitor::startMscFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, - const DocNodeList &children + const DocNodeList &children, + const QCString &srcFile, + int srcLine ) { DB_VIS_C @@ -1676,7 +1678,7 @@ DB_VIS_C } baseName.prepend("msc_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); - writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP); + writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } @@ -1699,7 +1701,7 @@ DB_VIS_C shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); - writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); + writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP,s->srcFile(),s->srcLine()); visitPreStart(m_t, s->children(), s->hasCaption(), shortName, s->width(),s->height()); visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); @@ -1709,7 +1711,9 @@ void DocbookDocVisitor::startDiaFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, - const DocNodeList &children + const DocNodeList &children, + const QCString &srcFile, + int srcLine ) { DB_VIS_C @@ -1725,7 +1729,7 @@ DB_VIS_C } baseName.prepend("dia_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); - writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); + writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } @@ -1748,7 +1752,7 @@ DB_VIS_C shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); - writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); + writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP,s->srcFile(),s->srcLine()); visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height()); visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); @@ -1758,7 +1762,9 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, - const DocNodeList &children + const DocNodeList &children, + const QCString &srcFile, + int srcLine ) { DB_VIS_C @@ -1775,7 +1781,7 @@ DB_VIS_C baseName.prepend("dot_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); QCString imgExt = getDotImageExtension(); - writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP); + writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, baseName + "." + imgExt, width, height); } diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index 5580de0..c35bac5 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -144,15 +144,18 @@ class DocbookDocVisitor : public DocVisitor const QCString &anchor); void endLink(); void startMscFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption,const DocNodeList &children); + const QCString &height, bool hasCaption,const DocNodeList &children, + const QCString &srcFile, int srcLine); void endMscFile(bool hasCaption); void writeMscFile(const QCString &fileName, DocVerbatim *s); void startDiaFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption,const DocNodeList &children); + const QCString &height, bool hasCaption,const DocNodeList &children, + const QCString &srcFile, int srcLine); void endDiaFile(bool hasCaption); void writeDiaFile(const QCString &fileName, DocVerbatim *s); void startDotFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption,const DocNodeList &children); + const QCString &height, bool hasCaption,const DocNodeList &children, + const QCString &srcFile, int srcLine); void endDotFile(bool hasCaption); void writeDotFile(const QCString &fileName, DocVerbatim *s); void writePlantUMLFile(const QCString &fileName, DocVerbatim *s); diff --git a/src/docparser.cpp b/src/docparser.cpp index e3187a0..331355f 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -2720,9 +2720,11 @@ endlink: //--------------------------------------------------------------------------- -DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context) : - m_name(name), m_relPath(g_relPath), m_context(context) +DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine) : + DocDiagramFileBase(name,context,srcFile,srcLine) { + m_relPath = g_relPath; m_parent = parent; } @@ -2757,9 +2759,11 @@ bool DocDotFile::parse() return ok; } -DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context) : - m_name(name), m_relPath(g_relPath), m_context(context) +DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile, int srcLine) : + DocDiagramFileBase(name,context,srcFile,srcLine) { + m_relPath = g_relPath; m_parent = parent; } @@ -2796,9 +2800,11 @@ bool DocMscFile::parse() //--------------------------------------------------------------------------- -DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &context) : - m_name(name), m_relPath(g_relPath), m_context(context) +DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine) : + DocDiagramFileBase(name,context,srcFile,srcLine) { + m_relPath = g_relPath; m_parent = parent; } @@ -5016,7 +5022,7 @@ void DocPara::handleFile(const QCString &cmdName) return; } QCString name = g_token->name; - T *df = new T(this,name,g_context); + T *df = new T(this,name,g_context,g_fileName,getDoctokinizerLineNr()); if (df->parse()) { m_children.push_back(std::unique_ptr<T>(df)); @@ -5550,6 +5556,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) dv->setText(g_token->verb); dv->setWidth(width); dv->setHeight(height); + dv->setLocation(g_fileName,getDoctokinizerLineNr()); m_children.push_back(std::unique_ptr<DocVerbatim>(dv)); if (retval==0) warn_doc_error(g_fileName,getDoctokinizerLineNr(),"dot section ended without end marker"); doctokenizerYYsetStatePara(); @@ -5566,6 +5573,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) dv->setText(g_token->verb); dv->setWidth(width); dv->setHeight(height); + dv->setLocation(g_fileName,getDoctokinizerLineNr()); m_children.push_back(std::unique_ptr<DocVerbatim>(dv)); if (retval==0) warn_doc_error(g_fileName,getDoctokinizerLineNr(),"msc section ended without end marker"); doctokenizerYYsetStatePara(); @@ -5642,6 +5650,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) dv->setText(stripLeadingAndTrailingEmptyLines(g_token->verb,line)); dv->setWidth(width); dv->setHeight(height); + dv->setLocation(g_fileName,getDoctokinizerLineNr()); if (jarPath.isEmpty()) { warn_doc_error(g_fileName,getDoctokinizerLineNr(),"ignoring \\startuml command because PLANTUML_JAR_PATH is not set"); diff --git a/src/docparser.h b/src/docparser.h index 40fdc0c..2117cbb 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -177,7 +177,7 @@ template<class T> class CompAccept : public DocNode { public: - void accept(DocVisitor *v) + void accept(DocVisitor *v) override { T *obj = dynamic_cast<T *>(this); v->visitPre(obj); @@ -199,8 +199,8 @@ class DocWord : public DocNode public: DocWord(DocNode *parent,const QCString &word); QCString word() const { return m_word; } - Kind kind() const { return Kind_Word; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_Word; } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_word; @@ -215,13 +215,13 @@ class DocLinkedWord : public DocNode const QCString &ref,const QCString &file, const QCString &anchor,const QCString &tooltip); QCString word() const { return m_word; } - Kind kind() const { return Kind_LinkedWord; } + Kind kind() const override { return Kind_LinkedWord; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } QCString tooltip() const { return m_tooltip; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_word; @@ -239,8 +239,8 @@ class DocURL : public DocNode DocURL(DocNode *parent,const QCString &url,bool isEmail) : m_url(url), m_isEmail(isEmail) { m_parent=parent; } QCString url() const { return m_url; } - Kind kind() const { return Kind_URL; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_URL; } + void accept(DocVisitor *v) override { v->visit(this); } bool isEmail() const { return m_isEmail; } private: @@ -255,8 +255,8 @@ class DocLineBreak : public DocNode DocLineBreak(DocNode *parent) { m_parent = parent; } DocLineBreak(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_LineBreak; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_LineBreak; } + void accept(DocVisitor *v) override { v->visit(this); } const HtmlAttribList &attribs() const { return m_attribs; } @@ -270,8 +270,8 @@ class DocHorRuler : public DocNode public: DocHorRuler(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HorRuler; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_HorRuler; } + void accept(DocVisitor *v) override { v->visit(this); } const HtmlAttribList &attribs() const { return m_attribs; } @@ -284,10 +284,10 @@ class DocAnchor : public DocNode { public: DocAnchor(DocNode *parent,const QCString &id,bool newAnchor); - Kind kind() const { return Kind_Anchor; } + Kind kind() const override { return Kind_Anchor; } QCString anchor() const { return m_anchor; } QCString file() const { return m_file; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } const HtmlAttribList &attribs() const { return m_attribs; } @@ -302,13 +302,13 @@ class DocCite : public DocNode { public: DocCite(DocNode *parent,const QCString &target,const QCString &context); - Kind kind() const { return Kind_Ref; } + Kind kind() const override { return Kind_Ref; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } QCString text() const { return m_text; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_file; @@ -344,12 +344,12 @@ class DocStyleChange : public DocNode const HtmlAttribList *attribs=0) : m_position(position), m_style(s), m_enable(enable) { m_parent = parent; if (attribs) m_attribs=*attribs; m_tagName = tagName.lower();} - Kind kind() const { return Kind_StyleChange; } + Kind kind() const override { return Kind_StyleChange; } Style style() const { return m_style; } const char *styleString() const; bool enable() const { return m_enable; } uint position() const { return m_position; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } const HtmlAttribList &attribs() const { return m_attribs; } QCString tagName() const { return m_tagName; } @@ -437,8 +437,8 @@ class DocSymbol : public DocNode DocSymbol(DocNode *parent,SymType s) : m_symbol(s) { m_parent = parent; } SymType symbol() const { return m_symbol; } - Kind kind() const { return Kind_Symbol; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_Symbol; } + void accept(DocVisitor *v) override { v->visit(this); } static SymType decodeSymbol(const QCString &symName); private: @@ -452,8 +452,8 @@ class DocEmoji : public DocNode DocEmoji(DocNode *parent,const QCString &symName); QCString name() const { return m_symName; } int index() const { return m_index; } - Kind kind() const { return Kind_Emoji; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_Emoji; } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_symName; @@ -466,9 +466,9 @@ class DocWhiteSpace : public DocNode public: DocWhiteSpace(DocNode *parent,const QCString &chars) : m_chars(chars) { m_parent = parent; } - Kind kind() const { return Kind_WhiteSpace; } + Kind kind() const override { return Kind_WhiteSpace; } QCString chars() const { return m_chars; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_chars; }; @@ -479,9 +479,9 @@ class DocSeparator : public DocNode public: DocSeparator(DocNode *parent,const QCString &chars) : m_chars(chars) { m_parent = parent; } - Kind kind() const { return Kind_Sep; } + Kind kind() const override { return Kind_Sep; } QCString chars() const { return m_chars; } - void accept(DocVisitor *) { } + void accept(DocVisitor *) override { } private: QCString m_chars; }; @@ -494,11 +494,11 @@ class DocVerbatim : public DocNode DocVerbatim(DocNode *parent,const QCString &context, const QCString &text, Type t,bool isExample, const QCString &exampleFile,bool isBlock=FALSE,const QCString &lang=QCString()); - Kind kind() const { return Kind_Verbatim; } + Kind kind() const override { return Kind_Verbatim; } Type type() const { return m_type; } QCString text() const { return m_text; } QCString context() const { return m_context; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } bool isExample() const { return m_isExample; } QCString exampleFile() const { return m_exampleFile; } QCString relPath() const { return m_relPath; } @@ -510,10 +510,13 @@ class DocVerbatim : public DocNode QCString engine() const { return m_engine; } const DocNodeList &children() const { return m_children; } DocNodeList &children() { return m_children; } + QCString srcFile() const { return m_srcFile; } + int srcLine() const { return m_srcLine; } void setText(const QCString &t) { m_text=t; } void setWidth(const QCString &w) { m_width=w; } void setHeight(const QCString &h) { m_height=h; } void setEngine(const QCString &e) { m_engine=e; } + void setLocation(const QCString &file,int line) { m_srcFile=file; m_srcLine=line; } private: QCString m_context; @@ -528,6 +531,8 @@ class DocVerbatim : public DocNode QCString m_height; QCString m_engine; DocNodeList m_children; + QCString m_srcFile; + int m_srcLine = -1; }; @@ -545,7 +550,7 @@ class DocInclude : public DocNode m_file(file), m_context(context), m_type(t), m_isExample(isExample), m_isBlock(isBlock), m_exampleFile(exampleFile), m_blockId(blockId) { m_parent = parent; } - Kind kind() const { return Kind_Include; } + Kind kind() const override { return Kind_Include; } QCString file() const { return m_file; } QCString extension() const { int i=m_file.findRev('.'); if (i!=-1) @@ -560,7 +565,7 @@ class DocInclude : public DocNode bool isExample() const { return m_isExample; } QCString exampleFile() const { return m_exampleFile; } bool isBlock() const { return m_isBlock; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } void parse(); private: @@ -584,7 +589,7 @@ class DocIncOperator : public DocNode m_type(t), m_pattern(pat), m_context(context), m_isFirst(FALSE), m_isLast(FALSE), m_isExample(isExample), m_exampleFile(exampleFile) { m_parent = parent; } - Kind kind() const { return Kind_IncOperator; } + Kind kind() const override { return Kind_IncOperator; } Type type() const { return m_type; } const char *typeAsString() const { @@ -602,7 +607,7 @@ class DocIncOperator : public DocNode QCString text() const { return m_text; } QCString pattern() const { return m_pattern; } QCString context() const { return m_context; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } void markFirst(bool v=TRUE) { m_isFirst = v; } @@ -631,12 +636,12 @@ class DocFormula : public DocNode { public: DocFormula(DocNode *parent,int id); - Kind kind() const { return Kind_Formula; } + Kind kind() const override { return Kind_Formula; } QCString name() const { return m_name; } QCString text() const { return m_text; } QCString relPath() const { return m_relPath; } int id() const { return m_id; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } bool isInline() { return m_text.length()>1 ? !(m_text.at(0)=='\\' && (m_text.at(1)=='{' || m_text.at(1)=='[')): TRUE; } private: @@ -652,12 +657,12 @@ class DocIndexEntry : public DocNode public: DocIndexEntry(DocNode *parent,const Definition *scope,const MemberDef *md) : m_scope(scope), m_member(md){ m_parent = parent; } - Kind kind() const { return Kind_IndexEntry; } + Kind kind() const override { return Kind_IndexEntry; } int parse(); const Definition *scope() const { return m_scope; } const MemberDef *member() const { return m_member; } QCString entry() const { return m_entry; } - void accept(DocVisitor *v) { v->visit(this); } + void accept(DocVisitor *v) override { v->visit(this); } private: QCString m_entry; @@ -672,7 +677,7 @@ class DocAutoList : public CompAccept<DocAutoList> { public: DocAutoList(DocNode *parent,int indent,bool isEnumList,int depth); - Kind kind() const { return Kind_AutoList; } + Kind kind() const override { return Kind_AutoList; } bool isEnumList() const { return m_isEnumList; } int indent() const { return m_indent; } int depth() const { return m_depth; } @@ -689,7 +694,7 @@ class DocAutoListItem : public CompAccept<DocAutoListItem> { public: DocAutoListItem(DocNode *parent,int indent,int num); - Kind kind() const { return Kind_AutoListItem; } + Kind kind() const override { return Kind_AutoListItem; } int itemNumber() const { return m_itemNum; } int parse(); @@ -707,7 +712,7 @@ class DocTitle : public CompAccept<DocTitle> DocTitle(DocNode *parent) { m_parent = parent; } void parse(); void parseFromString(const QCString &title); - Kind kind() const { return Kind_Title; } + Kind kind() const override { return Kind_Title; } bool hasTitle() const { return !m_children.empty(); } private: @@ -718,7 +723,7 @@ class DocXRefItem : public CompAccept<DocXRefItem> { public: DocXRefItem(DocNode *parent,int id,const QCString &key); - Kind kind() const { return Kind_XRefItem; } + Kind kind() const override { return Kind_XRefItem; } QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } QCString title() const { return m_title; } @@ -742,7 +747,7 @@ class DocImage : public CompAccept<DocImage> enum Type { Html, Latex, Rtf, DocBook }; DocImage(DocNode *parent,const HtmlAttribList &attribs, const QCString &name,Type t,const QCString &url=QCString(), bool inlineImage = TRUE); - Kind kind() const { return Kind_Image; } + Kind kind() const override { return Kind_Image; } Type type() const { return m_type; } QCString name() const { return m_name; } bool hasCaption() const { return !m_children.empty(); } @@ -766,73 +771,62 @@ class DocImage : public CompAccept<DocImage> bool m_inlineImage = false; }; -/** Node representing a dot file */ -class DocDotFile : public CompAccept<DocDotFile> -{ - public: - DocDotFile(DocNode *parent,const QCString &name,const QCString &context); - bool parse(); - Kind kind() const { return Kind_DotFile; } - QCString name() const { return m_name; } - QCString file() const { return m_file; } - QCString relPath() const { return m_relPath; } - bool hasCaption() const { return !m_children.empty(); } - QCString width() const { return m_width; } - QCString height() const { return m_height; } - QCString context() const { return m_context; } - private: - QCString m_name; - QCString m_file; - QCString m_relPath; - QCString m_width; - QCString m_height; - QCString m_context; -}; - -/** Node representing a msc file */ -class DocMscFile : public CompAccept<DocMscFile> +template<class T> +class DocDiagramFileBase : public CompAccept<T> { public: - DocMscFile(DocNode *parent,const QCString &name,const QCString &context); - bool parse(); - Kind kind() const { return Kind_MscFile; } + DocDiagramFileBase(const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine) + : m_name(name), m_context(context), m_srcFile(srcFile), m_srcLine(srcLine) {} QCString name() const { return m_name; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } - bool hasCaption() const { return !m_children.empty(); } + bool hasCaption() const { return !this->m_children.empty(); } QCString width() const { return m_width; } QCString height() const { return m_height; } QCString context() const { return m_context; } - private: + QCString srcFile() const { return m_srcFile; } + int srcLine() const { return m_srcLine; } + + protected: QCString m_name; QCString m_file; QCString m_relPath; QCString m_width; QCString m_height; QCString m_context; + QCString m_srcFile; + int m_srcLine = -1; +}; + +/** Node representing a dot file */ +class DocDotFile : public DocDiagramFileBase<DocDotFile> +{ + public: + DocDotFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine); + Kind kind() const override { return Kind_DotFile; } + bool parse(); +}; + +/** Node representing a msc file */ +class DocMscFile : public DocDiagramFileBase<DocMscFile> +{ + public: + DocMscFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine); + Kind kind() const override { return Kind_MscFile; } + bool parse(); }; /** Node representing a dia file */ -class DocDiaFile : public CompAccept<DocDiaFile> +class DocDiaFile : public DocDiagramFileBase<DocDiaFile> { public: - DocDiaFile(DocNode *parent,const QCString &name,const QCString &context); + DocDiaFile(DocNode *parent,const QCString &name,const QCString &context, + const QCString &srcFile,int srcLine); + Kind kind() const override { return Kind_DiaFile; } bool parse(); - Kind kind() const { return Kind_DiaFile; } - QCString name() const { return m_name; } - QCString file() const { return m_file; } - QCString relPath() const { return m_relPath; } - bool hasCaption() const { return !m_children.empty(); } - QCString width() const { return m_width; } - QCString height() const { return m_height; } - QCString context() const { return m_context; } - private: - QCString m_name; - QCString m_file; - QCString m_relPath; - QCString m_width; - QCString m_height; - QCString m_context; }; /** Node representing a VHDL flow chart */ @@ -841,7 +835,7 @@ class DocVhdlFlow : public CompAccept<DocVhdlFlow> public: DocVhdlFlow(DocNode *parent); void parse(); - Kind kind() const { return Kind_VhdlFlow; } + Kind kind() const override { return Kind_VhdlFlow; } bool hasCaption() { return !m_children.empty(); } private: }; @@ -852,7 +846,7 @@ class DocLink : public CompAccept<DocLink> public: DocLink(DocNode *parent,const QCString &target); QCString parse(bool,bool isXmlLink=FALSE); - Kind kind() const { return Kind_Link; } + Kind kind() const override { return Kind_Link; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } @@ -872,7 +866,7 @@ class DocRef : public CompAccept<DocRef> public: DocRef(DocNode *parent,const QCString &target,const QCString &context); void parse(); - Kind kind() const { return Kind_Ref; } + Kind kind() const override { return Kind_Ref; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } @@ -901,7 +895,7 @@ class DocInternalRef : public CompAccept<DocInternalRef> public: DocInternalRef(DocNode *parent,const QCString &target); void parse(); - Kind kind() const { return Kind_Ref; } + Kind kind() const override { return Kind_Ref; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString anchor() const { return m_anchor; } @@ -922,7 +916,7 @@ class DocHRef : public CompAccept<DocHRef> int parse(); QCString url() const { return m_url; } QCString relPath() const { return m_relPath; } - Kind kind() const { return Kind_HRef; } + Kind kind() const override { return Kind_HRef; } const HtmlAttribList &attribs() const { return m_attribs; } private: @@ -938,7 +932,7 @@ class DocHtmlHeader : public CompAccept<DocHtmlHeader> DocHtmlHeader(DocNode *parent,const HtmlAttribList &attribs,int level) : m_level(level), m_attribs(attribs) { m_parent = parent; } int level() const { return m_level; } - Kind kind() const { return Kind_HtmlHeader; } + Kind kind() const override { return Kind_HtmlHeader; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -953,7 +947,7 @@ class DocHtmlDescTitle : public CompAccept<DocHtmlDescTitle> public: DocHtmlDescTitle(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HtmlDescTitle; } + Kind kind() const override { return Kind_HtmlDescTitle; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -967,7 +961,7 @@ class DocHtmlDescList : public CompAccept<DocHtmlDescList> public: DocHtmlDescList(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HtmlDescList; } + Kind kind() const override { return Kind_HtmlDescList; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -981,7 +975,7 @@ class DocSection : public CompAccept<DocSection> public: DocSection(DocNode *parent,int level,const QCString &id) : m_level(level), m_id(id) { m_parent = parent; } - Kind kind() const { return Kind_Section; } + Kind kind() const override { return Kind_Section; } int level() const { return m_level; } QCString title() const { return m_title; } QCString anchor() const { return m_anchor; } @@ -1003,7 +997,7 @@ class DocSecRefItem : public CompAccept<DocSecRefItem> public: DocSecRefItem(DocNode *parent,const QCString &target) : m_target(target) { m_parent = parent; } - Kind kind() const { return Kind_SecRefItem; } + Kind kind() const override { return Kind_SecRefItem; } QCString target() const { return m_target; } QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } @@ -1021,7 +1015,7 @@ class DocSecRefList : public CompAccept<DocSecRefList> public: DocSecRefList(DocNode *parent) { m_parent = parent; } void parse(); - Kind kind() const { return Kind_SecRefList; } + Kind kind() const override { return Kind_SecRefList; } private: }; @@ -1032,7 +1026,7 @@ class DocInternal : public CompAccept<DocInternal> public: DocInternal(DocNode *parent) { m_parent = parent; } int parse(int); - Kind kind() const { return Kind_Internal; } + Kind kind() const override { return Kind_Internal; } private: }; @@ -1043,7 +1037,7 @@ class DocParBlock : public CompAccept<DocParBlock> public: DocParBlock(DocNode *parent) { m_parent = parent; } int parse(); - Kind kind() const { return Kind_ParBlock; } + Kind kind() const override { return Kind_ParBlock; } private: }; @@ -1054,7 +1048,7 @@ class DocSimpleList : public CompAccept<DocSimpleList> { public: DocSimpleList(DocNode *parent) { m_parent = parent; } - Kind kind() const { return Kind_SimpleList; } + Kind kind() const override { return Kind_SimpleList; } int parse(); private: @@ -1067,7 +1061,7 @@ class DocHtmlList : public CompAccept<DocHtmlList> enum Type { Unordered, Ordered }; DocHtmlList(DocNode *parent,const HtmlAttribList &attribs,Type t) : m_type(t), m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HtmlList; } + Kind kind() const override { return Kind_HtmlList; } Type type() const { return m_type; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -1089,10 +1083,10 @@ class DocSimpleSect : public CompAccept<DocSimpleSect> }; DocSimpleSect(DocNode *parent,Type t); virtual ~DocSimpleSect(); - Kind kind() const { return Kind_SimpleSect; } + Kind kind() const override { return Kind_SimpleSect; } Type type() const { return m_type; } QCString typeString() const; - void accept(DocVisitor *v); + void accept(DocVisitor *v) override; int parse(bool userTitle,bool needsSeparator); int parseRcs(); int parseXml(); @@ -1111,8 +1105,8 @@ class DocSimpleSectSep : public DocNode { public: DocSimpleSectSep(DocNode *parent) { m_parent = parent; } - Kind kind() const { return Kind_SimpleSectSep; } - void accept(DocVisitor *v) { v->visit(this); } + Kind kind() const override { return Kind_SimpleSectSep; } + void accept(DocVisitor *v) override { v->visit(this); } private: }; @@ -1134,7 +1128,7 @@ class DocParamSect : public CompAccept<DocParamSect> : m_type(t), m_hasInOutSpecifier(FALSE), m_hasTypeSpecifier(FALSE) { m_parent = parent; } int parse(const QCString &cmdName,bool xmlContext,Direction d); - Kind kind() const { return Kind_ParamSect; } + Kind kind() const override { return Kind_ParamSect; } Type type() const { return m_type; } bool hasInOutSpecifier() const { return m_hasInOutSpecifier; } bool hasTypeSpecifier() const { return m_hasTypeSpecifier; } @@ -1152,7 +1146,7 @@ class DocPara : public CompAccept<DocPara> DocPara(DocNode *parent) : m_isFirst(FALSE), m_isLast(FALSE) { m_parent = parent; } int parse(); - Kind kind() const { return Kind_Para; } + Kind kind() const override { return Kind_Para; } bool isEmpty() const { return m_children.empty(); } void markFirst(bool v=TRUE) { m_isFirst=v; } void markLast(bool v=TRUE) { m_isLast=v; } @@ -1204,7 +1198,7 @@ class DocParamList : public DocNode m_parent = parent; } virtual ~DocParamList() { } - Kind kind() const { return Kind_ParamList; } + Kind kind() const override { return Kind_ParamList; } DocNodeList ¶meters() { return m_params; } DocNodeList ¶mTypes() { return m_paramTypes; } DocParamSect::Type type() const { return m_type; } @@ -1213,7 +1207,7 @@ class DocParamList : public DocNode void markLast(bool b=TRUE) { m_isLast=b; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } - void accept(DocVisitor *v) + void accept(DocVisitor *v) override { v->visitPre(this); for (const auto &n : m_paragraphs) n->accept(v); @@ -1240,8 +1234,8 @@ class DocSimpleListItem : public DocNode { m_paragraph=new DocPara(this); m_parent = parent; } int parse(); virtual ~DocSimpleListItem() { delete m_paragraph; } - Kind kind() const { return Kind_SimpleListItem; } - void accept(DocVisitor *v) + Kind kind() const override { return Kind_SimpleListItem; } + void accept(DocVisitor *v) override { v->visitPre(this); m_paragraph->accept(v); @@ -1258,7 +1252,7 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem> public: DocHtmlListItem(DocNode *parent,const HtmlAttribList &attribs,int num) : m_attribs(attribs), m_itemNum(num) { m_parent = parent; } - Kind kind() const { return Kind_HtmlListItem; } + Kind kind() const override { return Kind_HtmlListItem; } int itemNumber() const { return m_itemNum; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -1274,7 +1268,7 @@ class DocHtmlDescData : public CompAccept<DocHtmlDescData> { public: DocHtmlDescData(DocNode *parent) { m_parent = parent; } - Kind kind() const { return Kind_HtmlDescData; } + Kind kind() const override { return Kind_HtmlDescData; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -1294,7 +1288,7 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> bool isHeading() const { return m_isHeading; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } - Kind kind() const { return Kind_HtmlCell; } + Kind kind() const override { return Kind_HtmlCell; } void markFirst(bool v=TRUE) { m_isFirst=v; } void markLast(bool v=TRUE) { m_isLast=v; } const HtmlAttribList &attribs() const { return m_attribs; } @@ -1323,7 +1317,7 @@ class DocHtmlCaption : public CompAccept<DocHtmlCaption> { public: DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs); - Kind kind() const { return Kind_HtmlCaption; } + Kind kind() const override { return Kind_HtmlCaption; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); bool hasCaptionId() const { return m_hasCaptionId; } @@ -1344,7 +1338,7 @@ class DocHtmlRow : public CompAccept<DocHtmlRow> public: DocHtmlRow(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HtmlRow; } + Kind kind() const override { return Kind_HtmlRow; } size_t numCells() const { return m_children.size(); } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); @@ -1378,14 +1372,14 @@ class DocHtmlTable : public CompAccept<DocHtmlTable> DocHtmlTable(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_caption=0; m_numCols=0; m_parent = parent; } ~DocHtmlTable() { delete m_caption; } - Kind kind() const { return Kind_HtmlTable; } + Kind kind() const override { return Kind_HtmlTable; } size_t numRows() const { return m_children.size(); } bool hasCaption() { return m_caption!=0; } const HtmlAttribList &attribs() const { return m_attribs; } int parse(); int parseXml(); size_t numColumns() const { return m_numCols; } - void accept(DocVisitor *v); + void accept(DocVisitor *v) override; DocHtmlCaption *caption() const { return m_caption; } DocHtmlRow *firstRow() const { return (!m_children.empty() && m_children.front()->kind()==Kind_HtmlRow) ? @@ -1405,7 +1399,7 @@ class DocHtmlBlockQuote : public CompAccept<DocHtmlBlockQuote> public: DocHtmlBlockQuote(DocNode *parent,const HtmlAttribList &attribs) : m_attribs(attribs) { m_parent = parent; } - Kind kind() const { return Kind_HtmlBlockQuote; } + Kind kind() const override { return Kind_HtmlBlockQuote; } int parse(); const HtmlAttribList &attribs() const { return m_attribs; } @@ -1418,7 +1412,7 @@ class DocText : public CompAccept<DocText> { public: DocText() {} - Kind kind() const { return Kind_Text; } + Kind kind() const override { return Kind_Text; } void parse(); bool isEmpty() const { return m_children.empty(); } }; @@ -1428,7 +1422,7 @@ class DocRoot : public CompAccept<DocRoot> { public: DocRoot(bool indent,bool sl) : m_indent(indent), m_singleLine(sl) {} - Kind kind() const { return Kind_Root; } + Kind kind() const override { return Kind_Root; } void parse(); bool indent() const { return m_indent; } bool singleLine() const { return m_singleLine; } diff --git a/src/dot.cpp b/src/dot.cpp index 8aa30b7..b3fb678 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -270,7 +270,8 @@ bool DotManager::run() const //-------------------------------------------------------------------- void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,GraphOutputFormat format) + const QCString &outFile,GraphOutputFormat format, + const QCString &srcFile,int srcLine) { Dir d(outDir.str()); if (!d.exists()) @@ -286,17 +287,17 @@ void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, DotRunner dotRun(inFile); if (format==GOF_BITMAP) { - dotRun.addJob(Config_getEnum(DOT_IMAGE_FORMAT),absImgName); + dotRun.addJob(Config_getEnum(DOT_IMAGE_FORMAT),absImgName,srcFile,srcLine); } else // format==GOF_EPS { if (Config_getBool(USE_PDFLATEX)) { - dotRun.addJob("pdf",absOutFile+".pdf"); + dotRun.addJob("pdf",absOutFile+".pdf",srcFile,srcLine); } else { - dotRun.addJob("ps",absOutFile+".eps"); + dotRun.addJob("ps",absOutFile+".eps",srcFile,srcLine); } } @@ -322,7 +323,8 @@ void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, void writeDotImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, - const QCString &context,int graphId) + const QCString &context,int graphId, + const QCString &srcFile,int srcLine) { Dir d(outDir.str()); @@ -337,7 +339,7 @@ void writeDotImageMapFromFile(TextStream &t, QCString absOutFile = QCString(d.absPath())+"/"+mapName; DotRunner dotRun(inFile); - dotRun.addJob(MAP_CMD,absOutFile); + dotRun.addJob(MAP_CMD,absOutFile,srcFile,srcLine); dotRun.preventCleanUp(); if (!dotRun.run()) { @@ -49,10 +49,12 @@ class DotManager }; void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,GraphOutputFormat format); + const QCString &outFile,GraphOutputFormat format, + const QCString &srcFile,int srcLine); void writeDotImageMapFromFile(TextStream &t, - const QCString& inFile, const QCString& outDir, - const QCString& relPath,const QCString& baseName, - const QCString& context,int graphId=-1); + const QCString &inFile, const QCString& outDir, + const QCString &relPath,const QCString& baseName, + const QCString &context,int graphId, + const QCString &srcFile,int srcLine); #endif diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index fbcc8ff..f8cb194 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -182,8 +182,8 @@ bool DotGraph::prepareDotFile() { // run dot to create a bitmap image DotRunner * dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); - dotRun->addJob(Config_getEnum(DOT_IMAGE_FORMAT), absImgName()); - if (m_generateImageMap) dotRun->addJob(MAP_CMD, absMapName()); + dotRun->addJob(Config_getEnum(DOT_IMAGE_FORMAT), absImgName(), absDotName(), 1); + if (m_generateImageMap) dotRun->addJob(MAP_CMD, absMapName(), absDotName(), 1); } else if (m_graphFormat == GOF_EPS) { @@ -191,11 +191,11 @@ bool DotGraph::prepareDotFile() DotRunner *dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); if (Config_getBool(USE_PDFLATEX)) { - dotRun->addJob("pdf",absImgName()); + dotRun->addJob("pdf",absImgName(),absDotName(),1); } else { - dotRun->addJob("ps",absImgName()); + dotRun->addJob("ps",absImgName(),absDotName(),1); } } return TRUE; diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index f9f077d..0597a91 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -147,7 +147,8 @@ DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) } -void DotRunner::addJob(const QCString &format, const QCString &output) +void DotRunner::addJob(const QCString &format, const QCString &output, + const QCString &srcFile,int srcLine) { for (auto& s: m_jobs) @@ -158,7 +159,7 @@ void DotRunner::addJob(const QCString &format, const QCString &output) return; } auto args = QCString("-T") + format + " -o \"" + output + "\""; - m_jobs.emplace_back(format.str(), output, args); + m_jobs.emplace_back(format.str(), output, args, srcFile, srcLine); } QCString getBaseNameOfOutput(const QCString &output) @@ -174,6 +175,9 @@ bool DotRunner::run() QCString dotArgs; + QCString srcFile; + int srcLine=-1; + // create output if (Config_getBool(DOT_MULTI_TARGETS)) { @@ -183,12 +187,19 @@ bool DotRunner::run() dotArgs+=' '; dotArgs+=s.args; } + if (!m_jobs.empty()) + { + srcFile = m_jobs.front().srcFile; + srcLine = m_jobs.front().srcLine; + } if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } else { for (auto& s : m_jobs) { + srcFile = s.srcFile; + srcLine = s.srcLine; dotArgs=QCString("\"")+m_file+"\" "+s.args; if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } @@ -236,7 +247,7 @@ bool DotRunner::run() } return TRUE; error: - err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n", + err_full(srcFile,srcLine,"Problems running dot: exit code=%d, command='%s', arguments='%s'\n", exitCode,qPrint(m_dotExe),qPrint(dotArgs)); return FALSE; } diff --git a/src/dotrunner.h b/src/dotrunner.h index 19bdc79..715d06f 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -31,11 +31,14 @@ class DotRunner { struct DotJob { - DotJob(const QCString &f, const QCString &o, const QCString &a) - : format(f), output(o), args(a) {} + DotJob(const QCString &f, const QCString &o, const QCString &a, + const QCString &s,int l) + : format(f), output(o), args(a), srcFile(s), srcLine(l) {} QCString format; QCString output; QCString args; + QCString srcFile; + int srcLine; }; public: @@ -45,7 +48,7 @@ class DotRunner /** Adds an additional job to the run. * Performing multiple jobs one file can be faster. */ - void addJob(const QCString &format,const QCString &output); + void addJob(const QCString &format,const QCString &output,const QCString &srcFile,int srcLine); /** Prevent cleanup of the dot file (for user provided dot files) */ void preventCleanUp() { m_cleanUp = false; } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 4bed69a..e4ec0d6 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -570,7 +570,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) file.close(); m_t << "<div class=\"dotgraph\">\n"; - writeDotFile(fileName,s->relPath(),s->context()); + writeDotFile(fileName,s->relPath(),s->context(),s->srcFile(),s->srcLine()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); @@ -607,7 +607,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) file.close(); m_t << "<div class=\"mscgraph\">\n"; - writeMscFile(baseName+".msc",s->relPath(),s->context()); + writeMscFile(baseName+".msc",s->relPath(),s->context(),s->srcFile(),s->srcLine()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); @@ -628,9 +628,11 @@ void HtmlDocVisitor::visit(DocVerbatim *s) { format = PlantumlManager::PUML_SVG; } - QCString baseName = PlantumlManager::instance().writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format,s->engine()); + QCString baseName = PlantumlManager::instance().writePlantUMLSource( + htmlOutput,s->exampleFile(), + s->text(),format,s->engine(),s->srcFile(),s->srcLine()); m_t << "<div class=\"plantumlgraph\">\n"; - writePlantUMLFile(baseName,s->relPath(),s->context()); + writePlantUMLFile(baseName,s->relPath(),s->context(),s->srcFile(),s->srcLine()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); @@ -1789,7 +1791,7 @@ void HtmlDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; m_t << "<div class=\"dotgraph\">\n"; - writeDotFile(df->file(),df->relPath(),df->context()); + writeDotFile(df->file(),df->relPath(),df->context(),df->srcFile(),df->srcLine()); if (df->hasCaption()) { m_t << "<div class=\"caption\">\n"; @@ -1810,7 +1812,7 @@ void HtmlDocVisitor::visitPre(DocMscFile *df) { if (m_hide) return; m_t << "<div class=\"mscgraph\">\n"; - writeMscFile(df->file(),df->relPath(),df->context()); + writeMscFile(df->file(),df->relPath(),df->context(),df->srcFile(),df->srcLine()); if (df->hasCaption()) { m_t << "<div class=\"caption\">\n"; @@ -1830,7 +1832,7 @@ void HtmlDocVisitor::visitPre(DocDiaFile *df) { if (m_hide) return; m_t << "<div class=\"diagraph\">\n"; - writeDiaFile(df->file(),df->relPath(),df->context()); + writeDiaFile(df->file(),df->relPath(),df->context(),df->srcFile(),df->srcLine()); if (df->hasCaption()) { m_t << "<div class=\"caption\">\n"; @@ -2240,7 +2242,7 @@ void HtmlDocVisitor::endLink() } void HtmlDocVisitor::writeDotFile(const QCString &fn,const QCString &relPath, - const QCString &context) + const QCString &context,const QCString &srcFile,int srcLine) { QCString baseName=fn; int i; @@ -2254,13 +2256,12 @@ void HtmlDocVisitor::writeDotFile(const QCString &fn,const QCString &relPath, } baseName.prepend("dot_"); QCString outDir = Config_getString(HTML_OUTPUT); - writeDotGraphFromFile(fn,outDir,baseName,GOF_BITMAP); - writeDotImageMapFromFile(m_t,fn,outDir,relPath,baseName,context); + writeDotGraphFromFile(fn,outDir,baseName,GOF_BITMAP,srcFile,srcLine); + writeDotImageMapFromFile(m_t,fn,outDir,relPath,baseName,context,-1,srcFile,srcLine); } -void HtmlDocVisitor::writeMscFile(const QCString &fileName, - const QCString &relPath, - const QCString &context) +void HtmlDocVisitor::writeMscFile(const QCString &fileName,const QCString &relPath, + const QCString &context,const QCString &srcFile,int srcLine) { QCString baseName=fileName; int i; @@ -2278,13 +2279,12 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName, MscOutputFormat mscFormat = MSC_BITMAP; if ("svg" == imgExt) mscFormat = MSC_SVG; - writeMscGraphFromFile(fileName,outDir,baseName,mscFormat); - writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat); + writeMscGraphFromFile(fileName,outDir,baseName,mscFormat,srcFile,srcLine); + writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat,srcFile,srcLine); } -void HtmlDocVisitor::writeDiaFile(const QCString &fileName, - const QCString &relPath, - const QCString &) +void HtmlDocVisitor::writeDiaFile(const QCString &fileName, const QCString &relPath, + const QCString &,const QCString &srcFile,int srcLine) { QCString baseName=fileName; int i; @@ -2298,14 +2298,13 @@ void HtmlDocVisitor::writeDiaFile(const QCString &fileName, } baseName.prepend("dia_"); QCString outDir = Config_getString(HTML_OUTPUT); - writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); + writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP,srcFile,srcLine); m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n"; } -void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, - const QCString &relPath, - const QCString &) +void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, const QCString &relPath, + const QCString &,const QCString &srcFile,int srcLine) { QCString baseName=fileName; int i; diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 287088d..efb9e9e 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -145,10 +145,14 @@ class HtmlDocVisitor : public DocVisitor const QCString &relPath,const QCString &anchor, const QCString &tooltip = ""); void endLink(); - void writeDotFile(const QCString &fileName,const QCString &relPath,const QCString &context); - void writeMscFile(const QCString &fileName,const QCString &relPath,const QCString &context); - void writeDiaFile(const QCString &fileName,const QCString &relPath,const QCString &context); - void writePlantUMLFile(const QCString &fileName,const QCString &relPath,const QCString &context); + void writeDotFile(const QCString &fileName,const QCString &relPath,const QCString &context, + const QCString &srcFile,int srcLine); + void writeMscFile(const QCString &fileName,const QCString &relPath,const QCString &context, + const QCString &srcFile,int srcLine); + void writeDiaFile(const QCString &fileName,const QCString &relPath,const QCString &context, + const QCString &srcFile,int srcLine); + void writePlantUMLFile(const QCString &fileName,const QCString &relPath,const QCString &context, + const QCString &srcFile,int srcLine); void forceEndParagraph(DocNode *n); void forceStartParagraph(DocNode *n); diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index e793f50..db97b1b 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -392,7 +392,7 @@ void LatexDocVisitor::visit(DocVerbatim *s) file.write( s->text().data(), s->text().length() ); file.close(); - startDotFile(fileName,s->width(),s->height(),s->hasCaption()); + startDotFile(fileName,s->width(),s->height(),s->hasCaption(),s->srcFile(),s->srcLine()); visitCaption(this, s->children()); endDotFile(s->hasCaption()); @@ -432,7 +432,9 @@ void LatexDocVisitor::visit(DocVerbatim *s) case DocVerbatim::PlantUML: { QCString latexOutput = Config_getString(LATEX_OUTPUT); - QCString baseName = PlantumlManager::instance().writePlantUMLSource(latexOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_EPS,s->engine()); + QCString baseName = PlantumlManager::instance().writePlantUMLSource( + latexOutput,s->exampleFile(),s->text(), + PlantumlManager::PUML_EPS,s->engine(),s->srcFile(),s->srcLine()); writePlantUMLFile(baseName, s); } @@ -1461,7 +1463,7 @@ void LatexDocVisitor::visitPost(DocImage *img) void LatexDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; - startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); + startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->srcFile(),df->srcLine()); } void LatexDocVisitor::visitPost(DocDotFile *df) @@ -1472,7 +1474,7 @@ void LatexDocVisitor::visitPost(DocDotFile *df) void LatexDocVisitor::visitPre(DocMscFile *df) { if (m_hide) return; - startMscFile(df->file(),df->width(),df->height(),df->hasCaption()); + startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->srcFile(),df->srcLine()); } void LatexDocVisitor::visitPost(DocMscFile *df) @@ -1484,7 +1486,7 @@ void LatexDocVisitor::visitPost(DocMscFile *df) void LatexDocVisitor::visitPre(DocDiaFile *df) { if (m_hide) return; - startDiaFile(df->file(),df->width(),df->height(),df->hasCaption()); + startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->srcFile(),df->srcLine()); } void LatexDocVisitor::visitPost(DocDiaFile *df) @@ -1885,7 +1887,9 @@ void LatexDocVisitor::endLink(const QCString &ref,const QCString &file,const QCS void LatexDocVisitor::startDotFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QCString &srcFile, + int srcLine ) { QCString baseName=fileName; @@ -1901,7 +1905,7 @@ void LatexDocVisitor::startDotFile(const QCString &fileName, baseName.prepend("dot_"); QCString outDir = Config_getString(LATEX_OUTPUT); QCString name = fileName; - writeDotGraphFromFile(name,outDir,baseName,GOF_EPS); + writeDotGraphFromFile(name,outDir,baseName,GOF_EPS,srcFile,srcLine); visitPreStart(m_t,hasCaption, baseName, width, height); } @@ -1914,7 +1918,9 @@ void LatexDocVisitor::endDotFile(bool hasCaption) void LatexDocVisitor::startMscFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QCString &srcFile, + int srcLine ) { QCString baseName=fileName; @@ -1930,7 +1936,7 @@ void LatexDocVisitor::startMscFile(const QCString &fileName, baseName.prepend("msc_"); QCString outDir = Config_getString(LATEX_OUTPUT); - writeMscGraphFromFile(fileName,outDir,baseName,MSC_EPS); + writeMscGraphFromFile(fileName,outDir,baseName,MSC_EPS,srcFile,srcLine); visitPreStart(m_t,hasCaption, baseName, width, height); } @@ -1950,7 +1956,7 @@ void LatexDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s) shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(LATEX_OUTPUT); - writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_EPS); + writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_EPS,s->srcFile(),s->srcLine()); visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); @@ -1960,7 +1966,9 @@ void LatexDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s) void LatexDocVisitor::startDiaFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QCString &srcFile, + int srcLine ) { QCString baseName=fileName; @@ -1976,7 +1984,7 @@ void LatexDocVisitor::startDiaFile(const QCString &fileName, baseName.prepend("dia_"); QCString outDir = Config_getString(LATEX_OUTPUT); - writeDiaGraphFromFile(fileName,outDir,baseName,DIA_EPS); + writeDiaGraphFromFile(fileName,outDir,baseName,DIA_EPS,srcFile,srcLine); visitPreStart(m_t,hasCaption, baseName, width, height); } @@ -1996,7 +2004,7 @@ void LatexDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s) shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(LATEX_OUTPUT); - writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS); + writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS,s->srcFile(),s->srcLine()); visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 696147f..62fa618 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -159,16 +159,19 @@ class LatexDocVisitor : public DocVisitor const QCString &anchor,bool refToTable=FALSE); QCString escapeMakeIndexChars(const char *s); void startDotFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption, + const QCString &srcFile,int srcLine); void endDotFile(bool hasCaption); void startMscFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption, + const QCString &srcFile,int srcLine); void endMscFile(bool hasCaption); void writeMscFile(const QCString &fileName, DocVerbatim *s); void startDiaFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption, + const QCString &srcFile,int srcLine); void endDiaFile(bool hasCaption); void writeDiaFile(const QCString &fileName, DocVerbatim *s); void writePlantUMLFile(const QCString &fileName, DocVerbatim *s); diff --git a/src/msc.cpp b/src/msc.cpp index b486389..2c8b536 100644 --- a/src/msc.cpp +++ b/src/msc.cpp @@ -89,7 +89,9 @@ static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString } void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,MscOutputFormat format) + const QCString &outFile,MscOutputFormat format, + const QCString &srcFile,int srcLine + ) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); @@ -117,7 +119,7 @@ void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, int code; if ((code=mscgen_generate(inFile.data(),imgName.data(),msc_format))!=0) { - err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", + err_full(srcFile,srcLine,"Problems generating msc output (error=%s). Look for typos in you msc file %s\n", mscgen_error2str(code),qPrint(inFile)); return; } @@ -130,7 +132,8 @@ void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, Portable::sysTimerStart(); if (Portable::system("epstopdf",epstopdfArgs)!=0) { - err("Problems running epstopdf. Check your TeX installation!\n"); + err_full(srcFile,srcLine,"Problems running epstopdf when processing '%s.eps'. Check your TeX installation!\n", + qPrint(absOutFile)); } Portable::sysTimerStop(); } @@ -141,7 +144,7 @@ void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, const QCString& relPath,const QCString& context, - bool writeSVGMap) + bool writeSVGMap,const QCString &srcFile,int srcLine) { QCString outFile = inFile + ".map"; @@ -149,7 +152,7 @@ static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& o if ((code=mscgen_generate(inFile.data(),outFile.data(), writeSVGMap ? mscgen_format_svgmap : mscgen_format_pngmap))!=0) { - err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", + err_full(srcFile,srcLine,"Problems generating msc output (error=%s). Look for typos in you msc file %s\n", mscgen_error2str(code),qPrint(inFile)); return ""; } @@ -167,7 +170,9 @@ void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, const QCString &relPath, const QCString &baseName, const QCString &context, - MscOutputFormat format + MscOutputFormat format, + const QCString &srcFile, + int srcLine ) { QCString mapName = baseName+".map"; @@ -186,7 +191,7 @@ void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, default: t << "unknown"; } - QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context,format==MSC_SVG); + QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context,format==MSC_SVG,srcFile,srcLine); if (!imap.isEmpty()) { t << "\" alt=\"" @@ -22,15 +22,18 @@ class TextStream; enum MscOutputFormat { MSC_BITMAP , MSC_EPS, MSC_SVG }; void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, - const QCString &outFile,MscOutputFormat format); + const QCString &outFile,MscOutputFormat format, + const QCString &srcFile,int srcLine); -QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, - const QCString& relPath,const QCString& context); +QCString getMscImageMapFromFile(const QCString &inFile, const QCString &outDir, + const QCString &relPath,const QCString &context, + const QCString &srcFile,int srcLine); void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, - MscOutputFormat format + MscOutputFormat format, + const QCString &srcFile,int srcLine ); #endif diff --git a/src/plantuml.cpp b/src/plantuml.cpp index 12e0fee..52e57e4 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -23,7 +23,9 @@ #include "fileinfo.h" #include "dir.h" -QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QCString &fileName,const QCString &content,OutputFormat format, const QCString &engine) +QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QCString &fileName, + const QCString &content,OutputFormat format, const QCString &engine, + const QCString &srcFile,int srcLine) { QCString baseName; QCString puName; @@ -80,7 +82,7 @@ QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QC uint pos = qcOutDir.findRev("/"); QCString generateType(qcOutDir.right(qcOutDir.length() - (pos + 1)) ); Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType)); - PlantumlManager::instance().insert(generateType.str(),puName.str(),outDir,format,text); + PlantumlManager::instance().insert(generateType.str(),puName.str(),outDir,format,text,srcFile,srcLine); Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType)); return baseName; @@ -233,7 +235,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, std::ofstream file(puFileName.str(),std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s for writing\n",puFileName.data()); + err_full(nb.srcFile,nb.srcLine,"Could not open file %s for writing\n",puFileName.data()); } file.write( nb.content.data(), nb.content.length() ); file.close(); @@ -242,7 +244,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, Portable::sysTimerStart(); if ((exitCode=Portable::system(pumlExe.data(),pumlArguments.data(),TRUE))!=0) { - err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n", + err_full(nb.srcFile,nb.srcLine,"Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n", plantumlJarPath.data(),exitCode); } else if (Config_getBool(DOT_CLEANUP)) @@ -267,7 +269,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, Portable::sysTimerStart(); if ((exitCode=Portable::system("epstopdf",epstopdfArgs.data()))!=0) { - err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode); + err_full(nb.srcFile,nb.srcLine,"Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode); } Portable::sysTimerStop(); } @@ -333,18 +335,20 @@ static void addPlantumlFiles(PlantumlManager::FilesMap &plantumlFiles, } static void addPlantumlContent(PlantumlManager::ContentMap &plantumlContent, - const std::string &key, const QCString &outDir, const QCString &puContent) + const std::string &key, const QCString &outDir, const QCString &puContent, + const QCString &srcFile,int srcLine) { auto kv = plantumlContent.find(key); if (kv==plantumlContent.end()) { - kv = plantumlContent.insert(std::make_pair(key,PlantumlContent("",outDir))).first; + kv = plantumlContent.insert(std::make_pair(key,PlantumlContent("",outDir,srcFile,srcLine))).first; } kv->second.content+=puContent; } void PlantumlManager::insert(const std::string &key, const std::string &value, - const QCString &outDir,OutputFormat format,const QCString &puContent) + const QCString &outDir,OutputFormat format,const QCString &puContent, + const QCString &srcFile,int srcLine) { int find; @@ -364,19 +368,19 @@ void PlantumlManager::insert(const std::string &key, const std::string &value, case PUML_BITMAP: addPlantumlFiles(m_pngPlantumlFiles,key,value); print(m_pngPlantumlFiles); - addPlantumlContent(m_pngPlantumlContent,key,outDir,puContent); + addPlantumlContent(m_pngPlantumlContent,key,outDir,puContent,srcFile,srcLine); print(m_pngPlantumlContent); break; case PUML_EPS: addPlantumlFiles(m_epsPlantumlFiles,key,value); print(m_epsPlantumlFiles); - addPlantumlContent(m_epsPlantumlContent,key,outDir,puContent); + addPlantumlContent(m_epsPlantumlContent,key,outDir,puContent,srcFile,srcLine); print(m_epsPlantumlContent); break; case PUML_SVG: addPlantumlFiles(m_svgPlantumlFiles,key,value); print(m_svgPlantumlFiles); - addPlantumlContent(m_svgPlantumlContent,key,outDir,puContent); + addPlantumlContent(m_svgPlantumlContent,key,outDir,puContent,srcFile,srcLine); print(m_svgPlantumlContent); break; } diff --git a/src/plantuml.h b/src/plantuml.h index 53c39a7..83f1299 100644 --- a/src/plantuml.h +++ b/src/plantuml.h @@ -29,10 +29,12 @@ class QCString; struct PlantumlContent { - PlantumlContent(const QCString &content_, const QCString &outDir_) - : content(content_), outDir(outDir_) {} + PlantumlContent(const QCString &content_, const QCString &outDir_, const QCString &srcFile_, int srcLine_) + : content(content_), outDir(outDir_), srcFile(srcFile_), srcLine(srcLine_) {} QCString content; QCString outDir; + QCString srcFile; + int srcLine; }; /** Singleton that manages plantuml relation actions */ @@ -52,9 +54,15 @@ class PlantumlManager * @param[in] fileName the name of the file. If empty a name will be chosen automatically. * @param[in] content the contents of the PlantUML file. * @param[in] format the image format to generate. + * @param[in] engine the plantuml engine to use. + * @param[in] srcFile the source file resulting in the write command. + * @param[in] srcLine the line number resulting in the write command. * @returns The name of the generated file. */ - QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content, OutputFormat format, const QCString &engine); + QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName, + const QCString &content, OutputFormat format, + const QCString &engine,const QCString &srcFile, + int srcLine); /** Convert a PlantUML file to an image. * @param[in] baseName the name of the generated file (as returned by writePlantUMLSource()) @@ -72,7 +80,9 @@ class PlantumlManager const std::string &value, const QCString &outDir, OutputFormat format, - const QCString &puContent); + const QCString &puContent, + const QCString &srcFile, + int srcLine); FilesMap m_pngPlantumlFiles; FilesMap m_svgPlantumlFiles; diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index cec672e..b1df440 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -344,7 +344,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) file.close(); } - writeDotFile(fileName, s->hasCaption()); + writeDotFile(fileName, s->hasCaption(), s->srcFile(), s->srcLine()); visitCaption(this, s->children()); includePicturePostRTF(true, s->hasCaption()); @@ -372,7 +372,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) file.write( text.data(), text.length() ); file.close(); - writeMscFile(baseName, s->hasCaption()); + writeMscFile(baseName, s->hasCaption(), s->srcFile(), s->srcLine()); visitCaption(this, s->children()); includePicturePostRTF(true, s->hasCaption()); @@ -382,7 +382,9 @@ void RTFDocVisitor::visit(DocVerbatim *s) case DocVerbatim::PlantUML: { static QCString rtfOutput = Config_getString(RTF_OUTPUT); - QCString baseName = PlantumlManager::instance().writePlantUMLSource(rtfOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine()); + QCString baseName = PlantumlManager::instance().writePlantUMLSource( + rtfOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP, + s->engine(),s->srcFile(),s->srcLine()); writePlantUMLFile(baseName, s->hasCaption()); visitCaption(this, s->children()); @@ -1835,9 +1837,10 @@ void RTFDocVisitor::endLink(const QCString &ref) void RTFDocVisitor::writeDotFile(DocDotFile *df) { - writeDotFile(df->file(), df->hasCaption()); + writeDotFile(df->file(), df->hasCaption(), df->srcFile(), df->srcLine()); } -void RTFDocVisitor::writeDotFile(const QCString &filename, bool hasCaption) +void RTFDocVisitor::writeDotFile(const QCString &filename, bool hasCaption, + const QCString &srcFile, int srcLine) { QCString baseName=filename; int i; @@ -1846,16 +1849,17 @@ void RTFDocVisitor::writeDotFile(const QCString &filename, bool hasCaption) baseName=baseName.right(baseName.length()-i-1); } QCString outDir = Config_getString(RTF_OUTPUT); - writeDotGraphFromFile(filename,outDir,baseName,GOF_BITMAP); + writeDotGraphFromFile(filename,outDir,baseName,GOF_BITMAP,srcFile,srcLine); QCString imgExt = getDotImageExtension(); includePicturePreRTF(baseName + "." + imgExt, true, hasCaption); } void RTFDocVisitor::writeMscFile(DocMscFile *df) { - writeMscFile(df->file(), df->hasCaption()); + writeMscFile(df->file(), df->hasCaption(), df->srcFile(), df->srcLine()); } -void RTFDocVisitor::writeMscFile(const QCString &fileName, bool hasCaption) +void RTFDocVisitor::writeMscFile(const QCString &fileName, bool hasCaption, + const QCString &srcFile, int srcLine) { QCString baseName=fileName; int i; @@ -1864,7 +1868,7 @@ void RTFDocVisitor::writeMscFile(const QCString &fileName, bool hasCaption) baseName=baseName.right(baseName.length()-i-1); } QCString outDir = Config_getString(RTF_OUTPUT); - writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP); + writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP,srcFile,srcLine); includePicturePreRTF(baseName + ".png", true, hasCaption); } @@ -1877,7 +1881,7 @@ void RTFDocVisitor::writeDiaFile(DocDiaFile *df) baseName=baseName.right(baseName.length()-i-1); } QCString outDir = Config_getString(RTF_OUTPUT); - writeDiaGraphFromFile(df->file(),outDir,baseName,DIA_BITMAP); + writeDiaGraphFromFile(df->file(),outDir,baseName,DIA_BITMAP,df->srcFile(),df->srcLine()); includePicturePreRTF(baseName + ".png", true, df->hasCaption()); } diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 01be1aa..f7c9ae4 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -152,9 +152,9 @@ class RTFDocVisitor : public DocVisitor void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE); void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE); - void writeDotFile(const QCString &fileName, bool hasCaption); + void writeDotFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine); void writeDotFile(DocDotFile *); - void writeMscFile(const QCString &fileName, bool hasCaption); + void writeMscFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine); void writeMscFile(DocMscFile *); void writeDiaFile(DocDiaFile *); void writePlantUMLFile(const QCString &fileName, bool hasCaption); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 7e7051f..6c677e7 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -3341,7 +3341,7 @@ void FlowChart::printUmlTree() QCString htmlOutDir = Config_getString(HTML_OUTPUT); QCString n=convertNameToFileName(); - n=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG,"uml"); + n=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG,"uml",n,1); PlantumlManager::instance().generatePlantUMLOutput(n,htmlOutDir,PlantumlManager::PUML_SVG); } |