summaryrefslogtreecommitdiffstats
path: root/addon/doxmlparser/src/linkedtexthandler.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-12-29 18:30:48 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-12-29 18:30:48 (GMT)
commitff11b7d98ad7d24770afd151aa6b439adc7506d2 (patch)
tree048517043e4c90dcc686bc038b480825fe32886c /addon/doxmlparser/src/linkedtexthandler.cpp
parent414d7b3bbfad8ec16237c3708af188ecaee62886 (diff)
downloadDoxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.zip
Doxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.tar.gz
Doxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.tar.bz2
Release-1.2.13
Diffstat (limited to 'addon/doxmlparser/src/linkedtexthandler.cpp')
-rw-r--r--addon/doxmlparser/src/linkedtexthandler.cpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp
new file mode 100644
index 0000000..b142188
--- /dev/null
+++ b/addon/doxmlparser/src/linkedtexthandler.cpp
@@ -0,0 +1,107 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#include "linkedtexthandler.h"
+#include <doxmlintf.h>
+
+class LT_Text : public ILT_Text
+{
+ public:
+ LT_Text(const QString &text) : m_text(text) {}
+ virtual ~LT_Text() {}
+
+ // ILT_Text
+ virtual QString text() const { return m_text; }
+ virtual Kind kind() const { return Kind_Text; }
+ private:
+ QString m_text;
+};
+
+class LT_Ref : public ILT_Ref
+{
+ public:
+ LT_Ref() {}
+ virtual ~LT_Ref() {}
+ void setRefId(const QString &refId) { m_refId=refId; }
+ void setText(const QString &text) { m_text=text; }
+ void setExtId(const QString &extId) { m_extId=extId; }
+
+ // ILT_Ref
+ virtual QString text() const { return m_text; }
+ virtual QString id() const { return m_refId; }
+ virtual QString external() const { return m_extId; }
+ virtual Kind kind() const { return Kind_Ref; }
+
+ private:
+ QString m_refId;
+ QString m_extId;
+ QString m_text;
+};
+
+LinkedTextHandler::LinkedTextHandler(IBaseHandler *parent,
+ QList<ILinkedText> &children
+ )
+ : m_parent(parent), m_children(children)
+{
+ addStartHandler("ref",this,&LinkedTextHandler::startRef);
+ addEndHandler("ref",this,&LinkedTextHandler::endRef);
+ m_children.setAutoDelete(TRUE);
+ m_ref=0;
+}
+
+LinkedTextHandler::~LinkedTextHandler()
+{
+}
+
+void LinkedTextHandler::start(const char *endTag)
+{
+ addEndHandler(endTag,this,&LinkedTextHandler::end);
+ m_parent->setDelegate(this);
+ m_curString="";
+}
+
+void LinkedTextHandler::end()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new LT_Text(m_curString));
+ printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ m_curString="";
+ }
+ m_parent->setDelegate(0);
+}
+
+void LinkedTextHandler::startRef(const QXmlAttributes& attrib)
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new LT_Text(m_curString));
+ printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ m_curString="";
+ }
+ ASSERT(m_ref==0);
+ m_ref = new LT_Ref;
+ m_ref->setRefId(attrib.value("idref"));
+ m_ref->setExtId(attrib.value("external"));
+}
+
+void LinkedTextHandler::endRef()
+{
+ m_ref->setText(m_curString);
+ m_children.append(m_ref);
+ printf("LinkedTextHandler: add ref `%s'\n",m_ref->text().data());
+ m_ref=0;
+}
+
+