summaryrefslogtreecommitdiffstats
path: root/src/xmlgen.cpp
diff options
context:
space:
mode:
authorTravis A. Everett <travis.a.everett@gmail.com>2018-08-29 05:14:51 (GMT)
committerTravis A. Everett <travis.a.everett@gmail.com>2018-08-29 05:14:51 (GMT)
commit172016e3d3b5cfe6f51470d43669f794b993da65 (patch)
tree3df7d2716411e9c2e3ecbd05dde2ba8f103d48c3 /src/xmlgen.cpp
parentfe904c77b07bfeae9c5b3c2472ecac3b450ecbd2 (diff)
downloadDoxygen-172016e3d3b5cfe6f51470d43669f794b993da65.zip
Doxygen-172016e3d3b5cfe6f51470d43669f794b993da65.tar.gz
Doxygen-172016e3d3b5cfe6f51470d43669f794b993da65.tar.bz2
declares XMLCodeGenerator in xmlgen.h
In order for sqlite3gen to re-use parts of the XML generator, XMLCodeGenerator needs to be declared in a header file. I parroted how other generators handle this and have it working in both the XML and sqlite3 outputs, but I don't have any sense of whether this is otherwise "right".
Diffstat (limited to 'src/xmlgen.cpp')
-rw-r--r--src/xmlgen.cpp233
1 files changed, 102 insertions, 131 deletions
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index e68c454..88350d3 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -222,146 +222,117 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf
/** Generator for producing XML formatted source code. */
-class XMLCodeGenerator : public CodeOutputInterface
+void XMLCodeGenerator::codify(const char *text)
{
- public:
-
- XMLCodeGenerator(FTextStream &t) : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0),
- m_insideCodeLine(FALSE), m_normalHLNeedStartTag(TRUE), m_insideSpecialHL(FALSE) {}
- virtual ~XMLCodeGenerator() { }
-
- void codify(const char *text)
- {
- XML_DB(("(codify \"%s\")\n",text));
- if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag)
- {
- m_t << "<highlight class=\"normal\">";
- m_normalHLNeedStartTag=FALSE;
- }
- writeXMLCodeString(m_t,text,m_col);
- }
- void writeCodeLink(const char *ref,const char *file,
- const char *anchor,const char *name,
- const char *tooltip)
- {
- XML_DB(("(writeCodeLink)\n"));
- if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag)
- {
- m_t << "<highlight class=\"normal\">";
- m_normalHLNeedStartTag=FALSE;
- }
- writeXMLLink(m_t,ref,file,anchor,name,tooltip);
- m_col+=qstrlen(name);
- }
- void writeTooltip(const char *, const DocLinkInfo &, const char *,
- const char *, const SourceLinkInfo &, const SourceLinkInfo &
- )
- {
- XML_DB(("(writeToolTip)\n"));
- }
- void startCodeLine(bool)
- {
- XML_DB(("(startCodeLine)\n"));
- m_t << "<codeline";
- if (m_lineNumber!=-1)
- {
- m_t << " lineno=\"" << m_lineNumber << "\"";
- if (!m_refId.isEmpty())
- {
- m_t << " refid=\"" << m_refId << "\"";
- if (m_isMemberRef)
- {
- m_t << " refkind=\"member\"";
- }
- else
- {
- m_t << " refkind=\"compound\"";
- }
- }
- if (!m_external.isEmpty())
- {
- m_t << " external=\"" << m_external << "\"";
- }
- }
- m_t << ">";
- m_insideCodeLine=TRUE;
- m_col=0;
- }
- void endCodeLine()
- {
- XML_DB(("(endCodeLine)\n"));
- if (!m_insideSpecialHL && !m_normalHLNeedStartTag)
- {
- m_t << "</highlight>";
- m_normalHLNeedStartTag=TRUE;
- }
- m_t << "</codeline>" << endl; // non DocBook
- m_lineNumber = -1;
- m_refId.resize(0);
- m_external.resize(0);
- m_insideCodeLine=FALSE;
- }
- void startFontClass(const char *colorClass)
+ XML_DB(("(codify \"%s\")\n",text));
+ if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag)
+ {
+ m_t << "<highlight class=\"normal\">";
+ m_normalHLNeedStartTag=FALSE;
+ }
+ writeXMLCodeString(m_t,text,m_col);
+}
+void XMLCodeGenerator::writeCodeLink(const char *ref,const char *file,
+ const char *anchor,const char *name,
+ const char *tooltip)
+{
+ XML_DB(("(writeCodeLink)\n"));
+ if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag)
+ {
+ m_t << "<highlight class=\"normal\">";
+ m_normalHLNeedStartTag=FALSE;
+ }
+ writeXMLLink(m_t,ref,file,anchor,name,tooltip);
+ m_col+=qstrlen(name);
+}
+void XMLCodeGenerator::writeTooltip(const char *, const DocLinkInfo &, const char *,
+ const char *, const SourceLinkInfo &, const SourceLinkInfo &
+ )
+{
+ XML_DB(("(writeToolTip)\n"));
+}
+void XMLCodeGenerator::startCodeLine(bool)
+{
+ XML_DB(("(startCodeLine)\n"));
+ m_t << "<codeline";
+ if (m_lineNumber!=-1)
+ {
+ m_t << " lineno=\"" << m_lineNumber << "\"";
+ if (!m_refId.isEmpty())
{
- XML_DB(("(startFontClass)\n"));
- if (m_insideCodeLine && !m_insideSpecialHL && !m_normalHLNeedStartTag)
+ m_t << " refid=\"" << m_refId << "\"";
+ if (m_isMemberRef)
{
- m_t << "</highlight>";
- m_normalHLNeedStartTag=TRUE;
+ m_t << " refkind=\"member\"";
}
- m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
- m_insideSpecialHL=TRUE;
- }
- void endFontClass()
- {
- XML_DB(("(endFontClass)\n"));
- m_t << "</highlight>"; // non DocBook
- m_insideSpecialHL=FALSE;
- }
- void writeCodeAnchor(const char *)
- {
- XML_DB(("(writeCodeAnchor)\n"));
- }
- void writeLineNumber(const char *extRef,const char *compId,
- const char *anchorId,int l)
- {
- XML_DB(("(writeLineNumber)\n"));
- // we remember the information provided here to use it
- // at the <codeline> start tag.
- m_lineNumber = l;
- if (compId)
+ else
{
- m_refId=compId;
- if (anchorId) m_refId+=(QCString)"_1"+anchorId;
- m_isMemberRef = anchorId!=0;
- if (extRef) m_external=extRef;
+ m_t << " refkind=\"compound\"";
}
}
- void setCurrentDoc(Definition *,const char *,bool)
- {
- }
- void addWord(const char *,bool)
+ if (!m_external.isEmpty())
{
+ m_t << " external=\"" << m_external << "\"";
}
-
- void finish()
- {
- if (m_insideCodeLine) endCodeLine();
- }
-
- private:
- FTextStream &m_t;
- QCString m_refId;
- QCString m_external;
- int m_lineNumber;
- bool m_isMemberRef;
- int m_col;
-
- bool m_insideCodeLine;
- bool m_normalHLNeedStartTag;
- bool m_insideSpecialHL;
-};
-
+ }
+ m_t << ">";
+ m_insideCodeLine=TRUE;
+ m_col=0;
+}
+void XMLCodeGenerator::endCodeLine()
+{
+ XML_DB(("(endCodeLine)\n"));
+ if (!m_insideSpecialHL && !m_normalHLNeedStartTag)
+ {
+ m_t << "</highlight>";
+ m_normalHLNeedStartTag=TRUE;
+ }
+ m_t << "</codeline>" << endl; // non DocBook
+ m_lineNumber = -1;
+ m_refId.resize(0);
+ m_external.resize(0);
+ m_insideCodeLine=FALSE;
+}
+void XMLCodeGenerator::startFontClass(const char *colorClass)
+{
+ XML_DB(("(startFontClass)\n"));
+ if (m_insideCodeLine && !m_insideSpecialHL && !m_normalHLNeedStartTag)
+ {
+ m_t << "</highlight>";
+ m_normalHLNeedStartTag=TRUE;
+ }
+ m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
+ m_insideSpecialHL=TRUE;
+}
+void XMLCodeGenerator::endFontClass()
+{
+ XML_DB(("(endFontClass)\n"));
+ m_t << "</highlight>"; // non DocBook
+ m_insideSpecialHL=FALSE;
+}
+void XMLCodeGenerator::writeCodeAnchor(const char *)
+{
+ XML_DB(("(writeCodeAnchor)\n"));
+}
+void XMLCodeGenerator::writeLineNumber(const char *extRef,const char *compId,
+ const char *anchorId,int l)
+{
+ XML_DB(("(writeLineNumber)\n"));
+ // we remember the information provided here to use it
+ // at the <codeline> start tag.
+ m_lineNumber = l;
+ if (compId)
+ {
+ m_refId=compId;
+ if (anchorId) m_refId+=(QCString)"_1"+anchorId;
+ m_isMemberRef = anchorId!=0;
+ if (extRef) m_external=extRef;
+ }
+}
+void XMLCodeGenerator::finish()
+{
+ if (m_insideCodeLine) endCodeLine();
+}
static void writeTemplateArgumentList(ArgumentList *al,
FTextStream &t,