diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2001-12-29 18:30:48 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2001-12-29 18:30:48 (GMT) |
commit | ad53b7bebd3042598e5a11b1f3ef29468815138b (patch) | |
tree | 048517043e4c90dcc686bc038b480825fe32886c /addon/doxmlparser/src/linkedtexthandler.cpp | |
parent | 7e4d434c3650bb9f7e5f460b1dbf6fed8be04a5f (diff) | |
download | Doxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.zip Doxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.tar.gz Doxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.tar.bz2 |
Release-1.2.13
Diffstat (limited to 'addon/doxmlparser/src/linkedtexthandler.cpp')
-rw-r--r-- | addon/doxmlparser/src/linkedtexthandler.cpp | 107 |
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; +} + + |