diff options
Diffstat (limited to 'addon/xmlparse')
-rw-r--r-- | addon/xmlparse/Doxyfile | 161 | ||||
-rw-r--r-- | addon/xmlparse/Makefile.in | 16 | ||||
-rw-r--r-- | addon/xmlparse/basehandler.h | 279 | ||||
-rw-r--r-- | addon/xmlparse/compoundhandler.cpp | 148 | ||||
-rw-r--r-- | addon/xmlparse/compoundhandler.h | 87 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.cpp | 1373 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.h | 749 | ||||
-rw-r--r-- | addon/xmlparse/doxmlintf.h | 87 | ||||
-rw-r--r-- | addon/xmlparse/main.cpp | 66 | ||||
-rw-r--r-- | addon/xmlparse/mainhandler.cpp | 124 | ||||
-rw-r--r-- | addon/xmlparse/mainhandler.h | 64 | ||||
-rw-r--r-- | addon/xmlparse/memberhandler.cpp | 160 | ||||
-rw-r--r-- | addon/xmlparse/memberhandler.h | 91 | ||||
-rw-r--r-- | addon/xmlparse/paramhandler.cpp | 94 | ||||
-rw-r--r-- | addon/xmlparse/paramhandler.h | 59 | ||||
-rw-r--r-- | addon/xmlparse/sectionhandler.cpp | 61 | ||||
-rw-r--r-- | addon/xmlparse/sectionhandler.h | 51 | ||||
-rw-r--r-- | addon/xmlparse/xmlparse.pro.in | 26 |
18 files changed, 0 insertions, 3696 deletions
diff --git a/addon/xmlparse/Doxyfile b/addon/xmlparse/Doxyfile deleted file mode 100644 index c711577..0000000 --- a/addon/xmlparse/Doxyfile +++ /dev/null @@ -1,161 +0,0 @@ -# Doxyfile 1.2.8-20010715 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = xmlparse -PROJECT_NUMBER = -OUTPUT_DIRECTORY = doc -OUTPUT_LANGUAGE = English -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = NO -CLASS_DIAGRAMS = YES -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ENABLED_SECTIONS = -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = . -FILE_PATTERNS = *.h *.cpp -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = NO -HTML_OUTPUT = -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = ../../qtools_docs/qtools.tag=../../../../qtools_docs/html -GENERATE_TAGFILE = -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -MAX_DOT_GRAPH_WIDTH = 1280 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/addon/xmlparse/Makefile.in b/addon/xmlparse/Makefile.in deleted file mode 100644 index 5fe8421..0000000 --- a/addon/xmlparse/Makefile.in +++ /dev/null @@ -1,16 +0,0 @@ -all clean depend: Makefile.xmlparse - $(MAKE) -f Makefile.xmlparse $@ - -distclean: clean - $(RM) -rf Makefile.xmlparse xmlparse.pro Makefile obj - -tmake: - $(ENV) $(PERL) $(TMAKE) xmlparse.pro >Makefile.xmlparse - -Makefile.xmlparse: xmlparse.pro - $(ENV) $(PERL) $(TMAKE) xmlparse.pro >Makefile.xmlparse - -install: - $(INSTTOOL) -d $(INSTALL)/bin - $(INSTTOOL) -m 755 ../../bin/xmlparse $(INSTALL)/bin - diff --git a/addon/xmlparse/basehandler.h b/addon/xmlparse/basehandler.h deleted file mode 100644 index 33b8831..0000000 --- a/addon/xmlparse/basehandler.h +++ /dev/null @@ -1,279 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _BASEHANDLER_H -#define _BASEHANDLER_H - -#include <qxml.h> -#include <qdict.h> -#include <qstring.h> - -class IBaseHandler -{ - public: - virtual void setDelegate(QXmlDefaultHandler *delegate) = 0; - virtual QXmlDefaultHandler *delegate() const = 0; -}; - -class IFallBackHandler -{ - public: - virtual bool handleStartElement(const QString & name, - const QXmlAttributes & attrib) = 0; - virtual bool handleEndElement(const QString &name) = 0; -}; - -template<class T> class ElementMapper -{ - class StartElementHandler - { - typedef void (T::*Handler)(const QXmlAttributes &attrib); - public: - StartElementHandler() : m_parent(0) {} - StartElementHandler(T *parent, Handler h) - : m_parent(parent), m_handler(h) {} - void operator()(const QXmlAttributes &attrib) - { if (m_parent) (m_parent->*m_handler)(attrib); } - private: - T *m_parent; - Handler m_handler; - }; - - class EndElementHandler - { - typedef void (T::*Handler)(); - public: - EndElementHandler() : m_parent(0) {} - EndElementHandler(T *parent, Handler h) - : m_parent(parent), m_handler(h) {} - void operator()() - { if (m_parent) (m_parent->*m_handler)(); } - private: - T *m_parent; - Handler m_handler; - }; - - typedef StartElementHandler<T> StartElementHandlerT; - typedef EndElementHandler<T> EndElementHandlerT; - - public: - ElementMapper() : m_startHandlers(67), m_endHandlers(67) - { - m_startHandlers.setAutoDelete(TRUE); - m_endHandlers.setAutoDelete(TRUE); - } - virtual ~ElementMapper() - { - } - - void addStartHandler(const char *key) - { - m_startHandlers.insert(key,new StartElementHandlerT); - } - - void addStartHandler(const char *key, T *obj, void (T::*handler)(const QXmlAttributes &)) - { - m_startHandlers.insert(key,new StartElementHandlerT(obj,handler)); - } - - void addEndHandler(const char *key) - { - m_endHandlers.insert(key,new EndElementHandlerT); - } - - void addEndHandler(const char *key, T *obj, void (T::*handler)()) - { - m_endHandlers.insert(key,new EndElementHandlerT(obj,handler)); - } - - - protected: - QDict<StartElementHandlerT> m_startHandlers; - QDict<EndElementHandlerT> m_endHandlers; -}; - -template<class T> class BaseHandler : public IBaseHandler, - public QXmlDefaultHandler, - public ElementMapper<T> -{ - public: - BaseHandler() : m_delegateHandler(0), m_fallBackHandler(0) - { - } - - virtual ~BaseHandler() - { - ASSERT(m_delegateHandler==0); - } - - virtual bool startDocument() - { - return TRUE; - } - - virtual bool startElement( const QString & namespaceURI, - const QString & localName, - const QString & name, - const QXmlAttributes & attrib - ) - { - if (m_delegateHandler) - { - return m_delegateHandler->startElement(namespaceURI,localName,name,attrib); - } - if (!m_skipUntil.isEmpty()) // skip mode - { - if (m_skipUntil==name) m_skipCount++; - printf("skipping start tag %s count=%d\n",name.data(),m_skipCount); - return TRUE; - } - - StartElementHandlerT *handler = m_startHandlers[name]; - if (handler) - { - (*handler)(attrib); - //printf("found start tag %s\n",name.data()); - } - else if (!m_fallBackHandler || - !m_fallBackHandler->handleStartElement(name,attrib) - ) - { - printf("found unexpected tag `%s', skipping until matching end tag\n",name.data()); - m_skipUntil = name; - m_skipCount=1; - } - return TRUE; - } - - virtual bool endElement( const QString& namespaceURI, const QString& localName, const QString& name ) - { - if (m_delegateHandler) - { - return m_delegateHandler->endElement(namespaceURI,localName,name); - } - - if (name==m_skipUntil) - { - m_skipCount--; - printf("skipping end tag %s count=%d\n",name.data(),m_skipCount); - if (m_skipCount==0) - { - m_skipUntil=""; - } - //printf("found end tag %s\n",name.data()); - } - else if (m_skipUntil.isEmpty()) - { - EndElementHandlerT *handler = m_endHandlers[name]; - if (handler) - { - (*handler)(); - //printf("found end tag %s\n",name.data()); - } - else if (m_fallBackHandler) - { - m_fallBackHandler->handleEndElement(name); - } - } - m_curString=""; - return TRUE; - } - - bool skippedEntity ( const QString &s ) - { - if (m_delegateHandler) - { - return m_delegateHandler->skippedEntity(s); - } - - printf("Skipped unhandled entity %s\n",s.data()); - return TRUE; - } - - virtual bool characters ( const QString & ch ) - { - if (m_delegateHandler) - { - return m_delegateHandler->characters(ch); - } - - //printf("Found characters \"%s\"\n",ch.data()); - m_curString+=ch; - return TRUE; - } - - void setDelegate(QXmlDefaultHandler *delegate) - { - m_delegateHandler = delegate; - } - - QXmlDefaultHandler *delegate() const - { - return m_delegateHandler; - } - - void setFallBackHandler(IFallBackHandler *h) - { - m_fallBackHandler = h; - } - - IFallBackHandler *fallBackHandler() const - { - return m_fallBackHandler; - } - - protected: - QString m_curString; - QString m_skipUntil; - int m_skipCount; - QXmlDefaultHandler *m_delegateHandler; - IFallBackHandler *m_fallBackHandler; -}; - -template<class T> class BaseFallBackHandler : public ElementMapper<T>, - public IFallBackHandler -{ - public: - BaseFallBackHandler() - { - } - virtual ~BaseFallBackHandler() - { - } - bool handleStartElement(const QString & name, - const QXmlAttributes & attrib) - { - StartElementHandlerT *handler = m_startHandlers[name]; - if (handler) - { - (*handler)(attrib); - return TRUE; - } - return FALSE; - } - bool handleEndElement(const QString &name) - { - EndElementHandlerT *handler = m_endHandlers[name]; - if (handler) - { - (*handler)(); - return TRUE; - } - return FALSE; - } -}; - - -#endif diff --git a/addon/xmlparse/compoundhandler.cpp b/addon/xmlparse/compoundhandler.cpp deleted file mode 100644 index 0b420bf..0000000 --- a/addon/xmlparse/compoundhandler.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/****************************************************************************** - * - * $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 "mainhandler.h" -#include "compoundhandler.h" -#include "dochandler.h" - -CompoundHandler::CompoundHandler(IBaseHandler *parent) - : m_parent(parent), m_brief(0), m_detailed(0), m_programListing(0) -{ - m_superClasses.setAutoDelete(TRUE); - m_subClasses.setAutoDelete(TRUE); - m_sections.setAutoDelete(TRUE); - - addEndHandler("compounddef",this,&CompoundHandler::endCompound); - - addStartHandler("compoundname"); - addEndHandler("compoundname",this,&CompoundHandler::endCompoundName); - - addStartHandler("derivedcompoundref",this,&CompoundHandler::addSubClass); - addEndHandler("derivedcompoundref"); - - addStartHandler("basecompoundref",this,&CompoundHandler::addSuperClass); - addEndHandler("basecompoundref"); - - addStartHandler("briefdescription",this,&CompoundHandler::startBriefDesc); - - addStartHandler("detaileddescription",this,&CompoundHandler::startDetailedDesc); - - addStartHandler("sectiondef",this,&CompoundHandler::startSection); - - addStartHandler("location",this,&CompoundHandler::startLocation); - addEndHandler("location"); - - addStartHandler("programlisting",this,&CompoundHandler::startProgramListing); -} - -CompoundHandler::~CompoundHandler() -{ - delete m_brief; - delete m_detailed; - delete m_programListing; -} - -void CompoundHandler::startSection(const QXmlAttributes& attrib) -{ - SectionHandler *sectHandler = new SectionHandler(this); - sectHandler->startSection(attrib); - m_sections.append(sectHandler); -} - -void CompoundHandler::startBriefDesc(const QXmlAttributes& attrib) -{ - DocHandler *docHandler = new DocHandler(this); - docHandler->startDoc(attrib); - m_brief = docHandler; -} - -void CompoundHandler::startDetailedDesc(const QXmlAttributes& attrib) -{ - DocHandler *docHandler = new DocHandler(this); - docHandler->startDoc(attrib); - m_detailed = docHandler; -} - -void CompoundHandler::startProgramListing(const QXmlAttributes& attrib) -{ - ProgramListingHandler *plHandler = new ProgramListingHandler(this); - plHandler->startProgramListing(attrib); - m_programListing = plHandler; -} - -void CompoundHandler::startCompound(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - m_id = attrib.value("id"); - m_kind = attrib.value("kind"); - printf("startCompound(id=`%s' type=`%s')\n",m_id.data(),m_kind.data()); -} - -void CompoundHandler::startLocation(const QXmlAttributes& attrib) -{ - m_defFile = attrib.value("file"); - m_defLine = attrib.value("line").toInt(); -} - -void CompoundHandler::endCompound() -{ - printf("endCompound()\n"); - m_parent->setDelegate(0); -} - -void CompoundHandler::endCompoundName() -{ - m_name = m_curString.stripWhiteSpace(); - printf("Compound name `%s'\n",m_name.data()); -} - -void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) -{ - SuperClass *sc=new SuperClass( - attrib.value("idref"), - attrib.value("prot"), - attrib.value("virt") - ); - printf("super class id=`%s' prot=`%s' virt=`%s'\n", - sc->m_id.data(), - sc->m_protection.data(), - sc->m_virtualness.data()); - m_superClasses.append(sc); -} - -void CompoundHandler::addSubClass(const QXmlAttributes& attrib) -{ - SubClass *sc = new SubClass( - attrib.value("idref"), - attrib.value("prot"), - attrib.value("virt") - ); - printf("sub class id=`%s' prot=`%s' virt=`%s'\n", - sc->m_id.data(), - sc->m_protection.data(), - sc->m_virtualness.data()); - m_subClasses.append(sc); -} - -void CompoundHandler::initialize(MainHandler *m) -{ - QListIterator<ISection> msi(m_sections); - SectionHandler *sec; - for (;(sec=(SectionHandler *)msi.current());++msi) - { - sec->initialize(m); - } -} - diff --git a/addon/xmlparse/compoundhandler.h b/addon/xmlparse/compoundhandler.h deleted file mode 100644 index 51508aa..0000000 --- a/addon/xmlparse/compoundhandler.h +++ /dev/null @@ -1,87 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ -#ifndef _COMPOUNDHANDLER_H -#define _COMPOUNDHANDLER_H - -#include <qstring.h> -#include <qlist.h> -#include <qxml.h> - -#include "basehandler.h" -#include "sectionhandler.h" -#include "doxmlintf.h" - -class MainHandler; -class DocHandler; -class ProgramListingHandler; - -class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> -{ - public: - virtual void startSection(const QXmlAttributes& attrib); - virtual void startCompound(const QXmlAttributes& attrib); - virtual void addSuperClass(const QXmlAttributes& attrib); - virtual void addSubClass(const QXmlAttributes& attrib); - virtual void endCompound(); - virtual void endCompoundName(); - virtual void startBriefDesc(const QXmlAttributes& attrib); - virtual void startDetailedDesc(const QXmlAttributes& attrib); - virtual void startLocation(const QXmlAttributes& attrib); - virtual void startProgramListing(const QXmlAttributes& attrib); - - CompoundHandler(IBaseHandler *parent); - virtual ~CompoundHandler(); - - // ICompound - QString name() const { return m_name; } - QString id() const { return m_id; } - QString kind() const { return m_kind; } - QListIterator<ISection> getSectionIterator() const { return m_sections; } - void initialize(MainHandler *m); - - private: - struct SuperClass - { - SuperClass(const QString &id,const QString &prot,const QString &virt) : - m_id(id),m_protection(prot),m_virtualness(virt) {} - - QString m_id; - QString m_protection; - QString m_virtualness; - }; - struct SubClass - { - SubClass(const QString &id,const QString &prot,const QString &virt) : - m_id(id),m_protection(prot),m_virtualness(virt) {} - - QString m_id; - QString m_protection; - QString m_virtualness; - }; - QList<SuperClass> m_superClasses; - QList<SubClass> m_subClasses; - QList<ISection> m_sections; - IBaseHandler *m_parent; - DocHandler *m_brief; - DocHandler *m_detailed; - ProgramListingHandler *m_programListing; - QString m_id; - QString m_kind; - QString m_name; - QString m_defFile; - int m_defLine; -}; - -#endif diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp deleted file mode 100644 index 80df132..0000000 --- a/addon/xmlparse/dochandler.cpp +++ /dev/null @@ -1,1373 +0,0 @@ -/****************************************************************************** - * - * $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 "dochandler.h" -#include <qmap.h> - -class TypeNameMapper -{ - public: - TypeNameMapper() - { - m_typeNameMap.insert("see", SimpleSectHandler::See); - m_typeNameMap.insert("return", SimpleSectHandler::Return); - m_typeNameMap.insert("author", SimpleSectHandler::Author); - m_typeNameMap.insert("version", SimpleSectHandler::Version); - m_typeNameMap.insert("since", SimpleSectHandler::Since); - m_typeNameMap.insert("date", SimpleSectHandler::Date); - m_typeNameMap.insert("bug", SimpleSectHandler::Bug); - m_typeNameMap.insert("note", SimpleSectHandler::Note); - m_typeNameMap.insert("warning", SimpleSectHandler::Warning); - m_typeNameMap.insert("par", SimpleSectHandler::Par); - m_typeNameMap.insert("deprecated",SimpleSectHandler::Deprecated); - m_typeNameMap.insert("pre", SimpleSectHandler::Pre); - m_typeNameMap.insert("post", SimpleSectHandler::Post); - m_typeNameMap.insert("invariant", SimpleSectHandler::Invar); - m_typeNameMap.insert("remark", SimpleSectHandler::Remark); - m_typeNameMap.insert("attention", SimpleSectHandler::Attention); - m_typeNameMap.insert("todo", SimpleSectHandler::Todo); - m_typeNameMap.insert("test", SimpleSectHandler::Test); - m_typeNameMap.insert("rcs", SimpleSectHandler::RCS); - m_typeNameMap.insert("enumvalues",SimpleSectHandler::EnumValues); - m_typeNameMap.insert("examples", SimpleSectHandler::Examples); - } - SimpleSectHandler::Types stringToType(const QString &typeStr) - { - return m_typeNameMap[typeStr]; - } - private: - QMap<QString,SimpleSectHandler::Types> m_typeNameMap; -}; - -static TypeNameMapper g_typeMapper; - - -//---------------------------------------------------------------------- -// MarkupHandler -//---------------------------------------------------------------------- - -MarkupHandler::MarkupHandler(QList<DocNode> &children,QString &curString) - : m_children(children), m_curString(curString), m_curMarkup(DocNode::Normal) -{ - addStartHandler("bold",this,&MarkupHandler::startBold); - addEndHandler("bold",this,&MarkupHandler::endBold); - - addStartHandler("emphasis",this,&MarkupHandler::startEmphasis); - addEndHandler("emphasis",this,&MarkupHandler::endEmphasis); - - addStartHandler("computeroutput",this,&MarkupHandler::startComputerOutput); - addEndHandler("computeroutput",this,&MarkupHandler::endComputerOutput); - - addStartHandler("center",this,&MarkupHandler::startCenter); - addEndHandler("center",this,&MarkupHandler::endCenter); - - addStartHandler("small",this,&MarkupHandler::startSmallFont); - addEndHandler("small",this,&MarkupHandler::endSmallFont); - - addStartHandler("subscript",this,&MarkupHandler::startSubscript); - addEndHandler("subscript",this,&MarkupHandler::endSubscript); - - addStartHandler("superscript",this,&MarkupHandler::startSuperscript); - addEndHandler("superscript",this,&MarkupHandler::endSuperscript); -} - -MarkupHandler::~MarkupHandler() -{ -} - -void MarkupHandler::addTextNode() -{ - if (!m_curString.isEmpty()) - { - m_children.append(new TextNode(m_curString,m_curMarkup)); - printf("addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup); - m_curString=""; - } -} - -void MarkupHandler::startBold(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Bold,TRUE)); - m_curMarkup |= DocNode::Bold; -} - -void MarkupHandler::endBold() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Bold,FALSE)); - m_curMarkup &= ~DocNode::Bold; -} - -void MarkupHandler::startEmphasis(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Emphasis,TRUE)); - m_curMarkup |= DocNode::Emphasis; -} - -void MarkupHandler::endEmphasis() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Emphasis,FALSE)); - m_curMarkup &= ~DocNode::Emphasis; -} - -void MarkupHandler::startComputerOutput(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,TRUE)); - m_curMarkup |= DocNode::ComputerOutput; -} - -void MarkupHandler::endComputerOutput() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,FALSE)); - m_curMarkup &= ~DocNode::ComputerOutput; -} - -void MarkupHandler::startCenter(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Center,TRUE)); - m_curMarkup |= DocNode::Center; -} - -void MarkupHandler::endCenter() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Center,FALSE)); - m_curMarkup &= ~DocNode::Center; -} - -void MarkupHandler::startSmallFont(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::SmallFont,TRUE)); - m_curMarkup |= DocNode::SmallFont; -} - -void MarkupHandler::endSmallFont() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::SmallFont,FALSE)); - m_curMarkup &= ~DocNode::SmallFont; -} - -void MarkupHandler::startSubscript(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Subscript,TRUE)); - m_curMarkup |= DocNode::Subscript; -} - -void MarkupHandler::endSubscript() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Subscript,FALSE)); - m_curMarkup &= ~DocNode::Subscript; -} - -void MarkupHandler::startSuperscript(const QXmlAttributes & /*attrib*/) -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Superscript,TRUE)); - m_curMarkup |= DocNode::Superscript; -} - -void MarkupHandler::endSuperscript() -{ - addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Superscript,FALSE)); - m_curMarkup &= ~DocNode::Superscript; -} - -//---------------------------------------------------------------------- -// ListItemHandler -//---------------------------------------------------------------------- - -ListItemHandler::ListItemHandler(IBaseHandler *parent) - : DocNode(ListItem), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - - addEndHandler("listitem",this,&ListItemHandler::endListItem); - - addStartHandler("para",this,&ListItemHandler::startParagraph); -} - -ListItemHandler::~ListItemHandler() -{ -} - -void ListItemHandler::startListItem(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start list item handler\n"); -} - -void ListItemHandler::endListItem() -{ - printf("end list item handler\n"); - m_parent->setDelegate(0); -} - -void ListItemHandler::startParagraph(const QXmlAttributes& attrib) -{ - ParagraphHandler *parHandler = new ParagraphHandler(this); - parHandler->startParagraph(attrib); - m_children.append(parHandler); -} - -//---------------------------------------------------------------------- -// ListHandler -//---------------------------------------------------------------------- - -ListHandler::ListHandler(NodeKind k,IBaseHandler *parent) - : DocNode(k), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - const char *endListName=0; - switch(k) - { - case ItemizedList : endListName="itemizedlist"; break; - case OrderedList : endListName="orderedlist"; break; - default: ASSERT(0); - } - addEndHandler(endListName,this,&ListHandler::endList); - - addStartHandler("listitem",this,&ListHandler::startListItem); -} - -ListHandler::~ListHandler() -{ -} - -void ListHandler::startList(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); -} - -void ListHandler::endList() -{ - m_parent->setDelegate(0); -} - -void ListHandler::startListItem(const QXmlAttributes& attrib) -{ - ListItemHandler *liHandler = new ListItemHandler(this); - liHandler->startListItem(attrib); - m_children.append(liHandler); -} - -//---------------------------------------------------------------------- -// ParameterHandler -//---------------------------------------------------------------------- - -ParameterHandler::ParameterHandler(IBaseHandler *parent) : DocNode(Parameter), - m_parent(parent), m_description(0) -{ - addEndHandler("parametername",this,&ParameterHandler::endParameterName); - addEndHandler("parameterdescription",this,&ParameterHandler::endParameterDescription); - addStartHandler("para",this,&ParameterHandler::startParagraph); -} - -ParameterHandler::~ParameterHandler() -{ - delete m_description; -} - -void ParameterHandler::startParameterName(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); -} - -void ParameterHandler::endParameterName() -{ - m_name = m_curString; - printf("parameter %s\n",m_name.data()); - m_curString=""; - m_parent->setDelegate(0); -} - -void ParameterHandler::startParameterDescription(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); -} - -void ParameterHandler::endParameterDescription() -{ - m_parent->setDelegate(0); -} - -void ParameterHandler::startParagraph(const QXmlAttributes& attrib) -{ - ASSERT(m_description==0); - m_description = new ParagraphHandler(this); - m_description->startParagraph(attrib); -} - -//---------------------------------------------------------------------- -// ParameterListHandler -//---------------------------------------------------------------------- - -ParameterListHandler::ParameterListHandler(IBaseHandler *parent) - : DocNode(ParameterList), m_parent(parent) -{ - addEndHandler("parameterlist",this,&ParameterListHandler::endParameterList); - addStartHandler("parametername",this,&ParameterListHandler::startParameterName); - addStartHandler("parameterdescription",this,&ParameterListHandler::startParameterDescription); - addStartHandler("title"); - addEndHandler("title"); - m_parameters.setAutoDelete(TRUE); - m_curParam=0; -} - -ParameterListHandler::~ParameterListHandler() -{ -} - -void ParameterListHandler::startParameterList(const QXmlAttributes& attrib) -{ - QString kind = attrib.value("kind"); - if (kind=="retval") m_type=RetVal; - else if (kind=="exception") m_type=Exception; - else if (kind=="param") m_type=Param; - else - { - printf("Error: invalid parameterlist type: %s\n",kind.data()); - } - printf("parameterlist kind=%s\n",kind.data()); - m_parent->setDelegate(this); -} - -void ParameterListHandler::endParameterList() -{ - m_parent->setDelegate(0); -} - -void ParameterListHandler::startParameterName(const QXmlAttributes& attrib) -{ - m_curParam = new ParameterHandler(this); - m_parameters.append(m_curParam); - m_curParam->startParameterName(attrib); -} - -void ParameterListHandler::startParameterDescription(const QXmlAttributes& attrib) -{ - ASSERT(m_curParam!=0); - m_curParam->startParameterDescription(attrib); -} - -//---------------------------------------------------------------------- -// LinkHandler -//---------------------------------------------------------------------- - -LinkHandler::LinkHandler(IBaseHandler *parent) - : DocNode(Link), m_parent(parent) -{ - addEndHandler("link",this,&LinkHandler::endLink); -} - -LinkHandler::~LinkHandler() -{ -} - -void LinkHandler::startLink(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - printf("Start link\n"); - m_ref = attrib.value("linkend"); - m_curString=""; -} - -void LinkHandler::endLink() -{ - m_text = m_curString; - m_curString=""; - m_parent->setDelegate(0); - printf("End link\n"); -} - -//---------------------------------------------------------------------- -// EMailHandler -//---------------------------------------------------------------------- - -EMailHandler::EMailHandler(IBaseHandler *parent) - : DocNode(EMail), m_parent(parent) -{ - addEndHandler("email",this,&EMailHandler::endEMail); -} - -EMailHandler::~EMailHandler() -{ -} - -void EMailHandler::startEMail(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("Start email\n"); - m_curString=""; -} - -void EMailHandler::endEMail() -{ - m_address = m_curString; - m_curString=""; - m_parent->setDelegate(0); - printf("End email\n"); -} - -//---------------------------------------------------------------------- -// ULinkHandler -//---------------------------------------------------------------------- - -ULinkHandler::ULinkHandler(IBaseHandler *parent) - : DocNode(ULink), m_parent(parent) -{ - addEndHandler("ulink",this,&ULinkHandler::endULink); -} - -ULinkHandler::~ULinkHandler() -{ -} - -void ULinkHandler::startULink(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - printf("Start ulink\n"); - m_url = attrib.value("url"); - m_curString=""; -} - -void ULinkHandler::endULink() -{ - m_text = m_curString; - m_curString=""; - m_parent->setDelegate(0); - printf("End ulink\n"); -} - -//---------------------------------------------------------------------- -// LineBreakHandler -//---------------------------------------------------------------------- - -LineBreakHandler::LineBreakHandler(IBaseHandler *parent) - : DocNode(LineBreak), m_parent(parent) -{ - addEndHandler("linebreak",this,&LineBreakHandler::endLineBreak); -} - -LineBreakHandler::~LineBreakHandler() -{ -} - -void LineBreakHandler::startLineBreak(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("Start linebreak\n"); -} - -void LineBreakHandler::endLineBreak() -{ - m_parent->setDelegate(0); - printf("End linebreak\n"); -} - -//---------------------------------------------------------------------- -// HRulerHandler -//---------------------------------------------------------------------- - -HRulerHandler::HRulerHandler(IBaseHandler *parent) - : DocNode(HRuler), m_parent(parent) -{ - addEndHandler("hruler",this,&HRulerHandler::endHRuler); -} - -HRulerHandler::~HRulerHandler() -{ -} - -void HRulerHandler::startHRuler(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("Start hruler\n"); -} - -void HRulerHandler::endHRuler() -{ - m_parent->setDelegate(0); - printf("End hruler\n"); -} - -//---------------------------------------------------------------------- -// RefHandler -//---------------------------------------------------------------------- - -RefHandler::RefHandler(IBaseHandler *parent) - : DocNode(Ref), m_parent(parent) -{ - addEndHandler("ref",this,&RefHandler::endRef); -} - -RefHandler::~RefHandler() -{ -} - -void RefHandler::startRef(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - m_refId = attrib.value("idref"); - m_anchor = attrib.value("anchor"); - printf("Start ref refId=%s anchor=%s\n",m_refId.data(),m_anchor.data()); - m_curString=""; -} - -void RefHandler::endRef() -{ - m_linkText = m_curString; - m_parent->setDelegate(0); - printf("End ref: text=`%s'\n",m_linkText.data()); -} - - -//---------------------------------------------------------------------- -// TitleHandler -//---------------------------------------------------------------------- - -TitleHandler::TitleHandler(IBaseHandler *parent) - : DocNode(Title), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - m_markupHandler = new MarkupHandler(m_children,m_curString); - setFallBackHandler(m_markupHandler); - addStartHandler("ref",this,&TitleHandler::startRef); - addEndHandler("title",this,&TitleHandler::endTitle); -} - -TitleHandler::~TitleHandler() -{ - delete m_markupHandler; -} - -void TitleHandler::startTitle(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("Start title\n"); - m_curString=""; -} - -void TitleHandler::endTitle() -{ - addTextNode(); - m_parent->setDelegate(0); - printf("End title\n"); -} - -void TitleHandler::addTextNode() -{ - if (!m_curString.isEmpty()) - { - m_children.append(new TextNode(m_curString,m_markupHandler->markup())); - printf("addTextNode() text=\"%s\" markup=%x\n", - m_curString.data(),m_markupHandler->markup()); - m_curString=""; - } -} - -void TitleHandler::startRef(const QXmlAttributes& attrib) -{ - RefHandler *ref = new RefHandler(this); - ref->startRef(attrib); - m_children.append(ref); -} - -//---------------------------------------------------------------------- -// SimpleSectHandler -//---------------------------------------------------------------------- - -SimpleSectHandler::SimpleSectHandler(IBaseHandler *parent) - : DocNode(Para), m_parent(parent), m_paragraph(0), m_title(0) -{ - addStartHandler("title",this,&SimpleSectHandler::startTitle); - addStartHandler("para",this,&SimpleSectHandler::startParagraph); - addEndHandler("simplesect",this,&SimpleSectHandler::endSimpleSect); -} - -SimpleSectHandler::~SimpleSectHandler() -{ -} - -void SimpleSectHandler::startSimpleSect(const QXmlAttributes& attrib) -{ - m_type = g_typeMapper.stringToType(attrib.value("kind")); - printf("start simple section %s\n",attrib.value("kind").data()); - m_parent->setDelegate(this); -} - -void SimpleSectHandler::endSimpleSect() -{ - printf("end simple section\n"); - m_parent->setDelegate(0); -} - -void SimpleSectHandler::startTitle(const QXmlAttributes& attrib) -{ - ASSERT(m_title==0); - m_title = new TitleHandler(this); - m_title->startTitle(attrib); -} - -void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib) -{ - ASSERT(m_paragraph==0); - m_paragraph = new ParagraphHandler(this); - m_paragraph->startParagraph(attrib); -} - -//---------------------------------------------------------------------- -// VariableListEntryHandler -//---------------------------------------------------------------------- - -VariableListEntryHandler::VariableListEntryHandler(IBaseHandler *parent) - : DocNode(VariableListEntry), m_parent(parent), m_description(0) -{ - addStartHandler("term",this,&VariableListEntryHandler::startTerm); - addEndHandler("term",this,&VariableListEntryHandler::endTerm); - addStartHandler("para",this,&VariableListEntryHandler::startParagraph); - addEndHandler("varlistentry",this,&VariableListEntryHandler::endVarListEntry); - addEndHandler("listitem",this,&VariableListEntryHandler::endListItem); -} - -VariableListEntryHandler::~VariableListEntryHandler() -{ - delete m_description; -} - -void VariableListEntryHandler::startVarListEntry(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start varlistentry\n"); -} - -void VariableListEntryHandler::endVarListEntry() -{ - m_parent->setDelegate(0); - printf("end varlistentry\n"); -} - -void VariableListEntryHandler::startListItem(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start listitem\n"); -} - -void VariableListEntryHandler::endListItem() -{ - m_parent->setDelegate(0); - printf("end listitem\n"); -} - -void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/) -{ - m_curString=""; -} - -void VariableListEntryHandler::endTerm() -{ - m_term = m_curString; - printf("term=%s\n",m_term.data()); -} - -void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib) -{ - ASSERT(m_description==0); - m_description = new ParagraphHandler(this); - m_description->startParagraph(attrib); -} - - - -//---------------------------------------------------------------------- -// VariableListHandler -//---------------------------------------------------------------------- - -VariableListHandler::VariableListHandler(IBaseHandler *parent) - : DocNode(VariableList), m_parent(parent) -{ - m_entries.setAutoDelete(TRUE); - addStartHandler("varlistentry",this,&VariableListHandler::startVarListEntry); - addStartHandler("listitem",this,&VariableListHandler::startListItem); - addEndHandler("variablelist",this,&VariableListHandler::endVariableList); -} - -VariableListHandler::~VariableListHandler() -{ -} - -void VariableListHandler::startVariableList(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start variablelist\n"); -} - -void VariableListHandler::endVariableList() -{ - printf("end variablelist\n"); - m_parent->setDelegate(0); -} - -void VariableListHandler::startVarListEntry(const QXmlAttributes& attrib) -{ - VariableListEntryHandler *vle = new VariableListEntryHandler(this); - vle->startVarListEntry(attrib); - m_curEntry = vle; - m_entries.append(vle); -} - -void VariableListHandler::startListItem(const QXmlAttributes& attrib) -{ - ASSERT(m_curEntry!=0); - m_curEntry->startListItem(attrib); -} - -//---------------------------------------------------------------------- -// HighlightHandler -//---------------------------------------------------------------------- - -HighlightHandler::HighlightHandler(IBaseHandler *parent) - : DocNode(Highlight), m_parent(parent) -{ - addEndHandler("highlight",this,&HighlightHandler::endHighlight); -} - -HighlightHandler::~HighlightHandler() -{ -} - -void HighlightHandler::startHighlight(const QXmlAttributes& attrib) -{ - m_class = attrib.value("class"); - m_curString=""; - m_parent->setDelegate(this); -} - -void HighlightHandler::endHighlight() -{ - m_text = m_curString; - printf("highlight class=`%s' text=`%s'\n",m_class.data(),m_text.data()); - m_parent->setDelegate(0); -} - -//---------------------------------------------------------------------- -// CodeLineHandler -//---------------------------------------------------------------------- - -CodeLineHandler::CodeLineHandler(IBaseHandler *parent) - : DocNode(CodeLine), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - addEndHandler("codeline",this,&CodeLineHandler::endCodeLine); - addEndHandler("linenumber",this,&CodeLineHandler::endLineNumber); - addStartHandler("highlight",this,&CodeLineHandler::startHighlight); - addStartHandler("ref",this,&CodeLineHandler::startRef); - m_lineNumber = 0; -} - -CodeLineHandler::~CodeLineHandler() -{ -} - -void CodeLineHandler::startCodeLine(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start codeline\n"); -} - -void CodeLineHandler::endCodeLine() -{ - addTextNode(); - printf("end codeline\n"); - m_parent->setDelegate(0); -} - -void CodeLineHandler::startLineNumber(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - printf("start linenumber\n"); - m_lineNumber = attrib.value("line").toInt(); - m_refId = attrib.value("refid"); -} - -void CodeLineHandler::endLineNumber() -{ - m_parent->setDelegate(0); -} - -void CodeLineHandler::startHighlight(const QXmlAttributes& attrib) -{ - addTextNode(); - HighlightHandler *hlh = new HighlightHandler(this); - m_children.append(hlh); - hlh->startHighlight(attrib); -} - -void CodeLineHandler::startRef(const QXmlAttributes& attrib) -{ - addTextNode(); - RefHandler *rh = new RefHandler(this); - m_children.append(rh); - rh->startRef(attrib); -} - -void CodeLineHandler::addTextNode() -{ - if (!m_curString.isEmpty()) - { - m_children.append(new TextNode(m_curString,DocNode::Normal)); - printf("addTextNode() text=\"%s\"\n", - m_curString.data()); - m_curString=""; - } -} - -//---------------------------------------------------------------------- -// ProgramListingHandler -//---------------------------------------------------------------------- - -ProgramListingHandler::ProgramListingHandler(IBaseHandler *parent) - : DocNode(ProgramListing), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - m_hasLineNumber=FALSE; - addEndHandler("programlisting",this,&ProgramListingHandler::endProgramListing); - - addStartHandler("linenumber",this,&ProgramListingHandler::startLineNumber); - addStartHandler("codeline",this,&ProgramListingHandler::startCodeLine); -} - -ProgramListingHandler::~ProgramListingHandler() -{ -} - -void ProgramListingHandler::startProgramListing(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start programlisting\n"); -} - -void ProgramListingHandler::endProgramListing() -{ - printf("end programlisting\n"); - m_parent->setDelegate(0); -} - -void ProgramListingHandler::startLineNumber(const QXmlAttributes& attrib) -{ - CodeLineHandler *clh = new CodeLineHandler(this); - m_children.append(clh); - m_hasLineNumber=TRUE; - clh->startLineNumber(attrib); -} - -void ProgramListingHandler::startCodeLine(const QXmlAttributes& attrib) -{ - CodeLineHandler *clh = 0; - if (!m_hasLineNumber) - { - clh = new CodeLineHandler(this); - m_children.append(clh); - } - else - { - clh = m_children.getLast(); - } - ASSERT(clh!=0); - clh->startCodeLine(attrib); - m_hasLineNumber=FALSE; -} - -//---------------------------------------------------------------------- -// FormulaHandler -//---------------------------------------------------------------------- - -FormulaHandler::FormulaHandler(IBaseHandler *parent) - : DocNode(Formula), m_parent(parent) -{ - addEndHandler("formula",this,&FormulaHandler::endFormula); -} - -FormulaHandler::~FormulaHandler() -{ -} - -void FormulaHandler::startFormula(const QXmlAttributes& attrib) -{ - m_id = attrib.value("id"); - m_curString=""; - m_parent->setDelegate(this); -} - -void FormulaHandler::endFormula() -{ - m_text = m_curString; - printf("formula id=`%s' text=`%s'\n",m_id.data(),m_text.data()); - m_parent->setDelegate(0); -} - -//---------------------------------------------------------------------- -// ImageHandler -//---------------------------------------------------------------------- - -ImageHandler::ImageHandler(IBaseHandler *parent) - : DocNode(Image), m_parent(parent) -{ - addEndHandler("image",this,&ImageHandler::endImage); -} - -ImageHandler::~ImageHandler() -{ -} - -void ImageHandler::startImage(const QXmlAttributes& attrib) -{ - m_name = attrib.value("name"); - m_curString=""; - m_parent->setDelegate(this); -} - -void ImageHandler::endImage() -{ - m_caption = m_curString; - printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data()); - m_parent->setDelegate(0); -} - -//---------------------------------------------------------------------- -// DotFileHandler -//---------------------------------------------------------------------- - -DotFileHandler::DotFileHandler(IBaseHandler *parent) - : DocNode(DotFile), m_parent(parent) -{ - addEndHandler("image",this,&DotFileHandler::endDotFile); -} - -DotFileHandler::~DotFileHandler() -{ -} - -void DotFileHandler::startDotFile(const QXmlAttributes& attrib) -{ - m_name = attrib.value("name"); - m_curString=""; - m_parent->setDelegate(this); -} - -void DotFileHandler::endDotFile() -{ - m_caption = m_curString; - printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data()); - m_parent->setDelegate(0); -} - -//---------------------------------------------------------------------- -// IndexEntryHandler -//---------------------------------------------------------------------- - -IndexEntryHandler::IndexEntryHandler(IBaseHandler *parent) - : DocNode(IndexEntry), m_parent(parent) -{ - addEndHandler("indexentry",this,&IndexEntryHandler::endIndexEntry); - addStartHandler("primaryie",this,&IndexEntryHandler::startPrimaryIE); - addEndHandler("primaryie",this,&IndexEntryHandler::endPrimaryIE); - addStartHandler("secondaryie",this,&IndexEntryHandler::startSecondaryIE); - addEndHandler("secondaryie",this,&IndexEntryHandler::endSecondaryIE); -} - -IndexEntryHandler::~IndexEntryHandler() -{ -} - -void IndexEntryHandler::startIndexEntry(const QXmlAttributes& /*attrib*/) -{ - printf("start index entry\n"); - m_parent->setDelegate(this); -} - -void IndexEntryHandler::endIndexEntry() -{ - printf("index entry primary=`%s' secondary=`%s'\n", - m_primary.data(),m_secondary.data()); - m_parent->setDelegate(0); -} - -void IndexEntryHandler::startPrimaryIE(const QXmlAttributes& /*attrib*/) -{ - m_curString=""; -} - -void IndexEntryHandler::endPrimaryIE() -{ - m_primary = m_curString; -} - -void IndexEntryHandler::startSecondaryIE(const QXmlAttributes& /*attrib*/) -{ - m_curString=""; -} - -void IndexEntryHandler::endSecondaryIE() -{ - m_secondary = m_curString; -} - -//---------------------------------------------------------------------- -// EntryHandler -//---------------------------------------------------------------------- - -EntryHandler::EntryHandler(IBaseHandler *parent) - : DocNode(Entry), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - addEndHandler("entry",this,&EntryHandler::endEntry); - addStartHandler("para",this,&EntryHandler::startParagraph); -} - -EntryHandler::~EntryHandler() -{ -} - -void EntryHandler::startEntry(const QXmlAttributes&) -{ - m_parent->setDelegate(this); -} - -void EntryHandler::endEntry() -{ - m_parent->setDelegate(0); -} - -void EntryHandler::startParagraph(const QXmlAttributes& attrib) -{ - ParagraphHandler *ph = new ParagraphHandler(this); - ph->startParagraph(attrib); - m_children.append(ph); -} - -//---------------------------------------------------------------------- -// RowHandler -//---------------------------------------------------------------------- - -RowHandler::RowHandler(IBaseHandler *parent) - : DocNode(Row), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - addEndHandler("row",this,&RowHandler::endRow); - addStartHandler("entry",this,&RowHandler::startEntry); -} - -RowHandler::~RowHandler() -{ -} - -void RowHandler::startRow(const QXmlAttributes&) -{ - m_parent->setDelegate(this); -} - -void RowHandler::endRow() -{ - m_parent->setDelegate(0); -} - -void RowHandler::startEntry(const QXmlAttributes& attrib) -{ - EntryHandler *eh = new EntryHandler(this); - eh->startEntry(attrib); - m_children.append(eh); -} - -//---------------------------------------------------------------------- -// TableHandler -//---------------------------------------------------------------------- - -TableHandler::TableHandler(IBaseHandler *parent) - : DocNode(Table), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - addEndHandler("table",this,&TableHandler::endTable); - addStartHandler("row",this,&TableHandler::startRow); -} - -TableHandler::~TableHandler() -{ -} - -void TableHandler::startTable(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - m_numColumns = attrib.value("cols").toInt(); - printf("table cols=%d\n",m_numColumns); -} - -void TableHandler::endTable() -{ - m_parent->setDelegate(0); -} - -void TableHandler::startRow(const QXmlAttributes& attrib) -{ - RowHandler *rh = new RowHandler(this); - rh->startRow(attrib); - m_children.append(rh); -} - -//---------------------------------------------------------------------- -// ParagraphHandler -//---------------------------------------------------------------------- - -ParagraphHandler::ParagraphHandler(IBaseHandler *parent) - : DocNode(Para), m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - - m_markupHandler = new MarkupHandler(m_children,m_curString); - setFallBackHandler(m_markupHandler); - - addEndHandler("para",this,&ParagraphHandler::endParagraph); - - addStartHandler("itemizedlist",this,&ParagraphHandler::startItemizedList); - addStartHandler("orderedlist",this,&ParagraphHandler::startOrderedList); - addStartHandler("parameterlist",this,&ParagraphHandler::startParameterList); - addStartHandler("simplesect",this,&ParagraphHandler::startSimpleSect); - addStartHandler("ref",this,&ParagraphHandler::startRef); - addStartHandler("variablelist",this,&ParagraphHandler::startVariableList); - addStartHandler("hruler",this,&ParagraphHandler::startHRuler); - addStartHandler("linebreak",this,&ParagraphHandler::startLineBreak); - addStartHandler("ulink",this,&ParagraphHandler::startULink); - addStartHandler("email",this,&ParagraphHandler::startEMail); - addStartHandler("link",this,&ParagraphHandler::startLink); - addStartHandler("programlisting",this,&ParagraphHandler::startProgramListing); - addStartHandler("formula",this,&ParagraphHandler::startFormula); - addStartHandler("image",this,&ParagraphHandler::startImage); - addStartHandler("dotfile",this,&ParagraphHandler::startDotFile); - addStartHandler("indexentry",this,&ParagraphHandler::startIndexEntry); - addStartHandler("table",this,&ParagraphHandler::startTable); -} - -ParagraphHandler::~ParagraphHandler() -{ - delete m_markupHandler; -} - -void ParagraphHandler::startParagraph(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("para\n"); -} - -void ParagraphHandler::endParagraph() -{ - addTextNode(); - printf("end para\n"); - m_parent->setDelegate(0); -} - -void ParagraphHandler::startItemizedList(const QXmlAttributes& attrib) -{ - addTextNode(); - ListHandler *listHandler = new ListHandler(ItemizedList,this); - listHandler->startList(attrib); - m_children.append(listHandler); -} - -void ParagraphHandler::startOrderedList(const QXmlAttributes& attrib) -{ - addTextNode(); - ListHandler *listHandler = new ListHandler(OrderedList,this); - listHandler->startList(attrib); - m_children.append(listHandler); -} - -void ParagraphHandler::startParameterList(const QXmlAttributes& attrib) -{ - addTextNode(); - ParameterListHandler *parListHandler = new ParameterListHandler(this); - parListHandler->startParameterList(attrib); - m_children.append(parListHandler); -} - -void ParagraphHandler::startSimpleSect(const QXmlAttributes& attrib) -{ - addTextNode(); - SimpleSectHandler *sectHandler = new SimpleSectHandler(this); - sectHandler->startSimpleSect(attrib); - m_children.append(sectHandler); -} - -void ParagraphHandler::startRef(const QXmlAttributes& attrib) -{ - addTextNode(); - RefHandler *ref = new RefHandler(this); - ref->startRef(attrib); - m_children.append(ref); -} - -void ParagraphHandler::startVariableList(const QXmlAttributes& attrib) -{ - addTextNode(); - VariableListHandler *vl = new VariableListHandler(this); - vl->startVariableList(attrib); - m_children.append(vl); -} - -void ParagraphHandler::startHRuler(const QXmlAttributes& attrib) -{ - addTextNode(); - HRulerHandler *hr = new HRulerHandler(this); - hr->startHRuler(attrib); - m_children.append(hr); -} - -void ParagraphHandler::startLineBreak(const QXmlAttributes& attrib) -{ - addTextNode(); - LineBreakHandler *lb = new LineBreakHandler(this); - lb->startLineBreak(attrib); - m_children.append(lb); -} - -void ParagraphHandler::startULink(const QXmlAttributes& attrib) -{ - addTextNode(); - ULinkHandler *uh = new ULinkHandler(this); - uh->startULink(attrib); - m_children.append(uh); -} - -void ParagraphHandler::startEMail(const QXmlAttributes& attrib) -{ - addTextNode(); - EMailHandler *eh = new EMailHandler(this); - eh->startEMail(attrib); - m_children.append(eh); -} - -void ParagraphHandler::startLink(const QXmlAttributes& attrib) -{ - addTextNode(); - LinkHandler *lh = new LinkHandler(this); - lh->startLink(attrib); - m_children.append(lh); -} - -void ParagraphHandler::startProgramListing(const QXmlAttributes& attrib) -{ - addTextNode(); - ProgramListingHandler *pl = new ProgramListingHandler(this); - pl->startProgramListing(attrib); - m_children.append(pl); -} - -void ParagraphHandler::startFormula(const QXmlAttributes& attrib) -{ - addTextNode(); - FormulaHandler *fh = new FormulaHandler(this); - fh->startFormula(attrib); - m_children.append(fh); -} - -void ParagraphHandler::startImage(const QXmlAttributes& attrib) -{ - addTextNode(); - ImageHandler *ih = new ImageHandler(this); - ih->startImage(attrib); - m_children.append(ih); -} - -void ParagraphHandler::startDotFile(const QXmlAttributes& attrib) -{ - addTextNode(); - DotFileHandler *df = new DotFileHandler(this); - df->startDotFile(attrib); - m_children.append(df); -} - -void ParagraphHandler::startIndexEntry(const QXmlAttributes& attrib) -{ - addTextNode(); - IndexEntryHandler *df = new IndexEntryHandler(this); - df->startIndexEntry(attrib); - m_children.append(df); -} - -void ParagraphHandler::startTable(const QXmlAttributes& attrib) -{ - addTextNode(); - TableHandler *th = new TableHandler(this); - th->startTable(attrib); - m_children.append(th); -} - -void ParagraphHandler::addTextNode() -{ - if (!m_curString.isEmpty()) - { - m_children.append(new TextNode(m_curString,m_markupHandler->markup())); - printf("addTextNode() text=\"%s\" markup=%x\n", - m_curString.data(),m_markupHandler->markup()); - m_curString=""; - } -} - -//---------------------------------------------------------------------- -// DocHandler -//---------------------------------------------------------------------- - -DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) -{ - m_children.setAutoDelete(TRUE); - - addEndHandler("briefdescription",this,&DocHandler::endDoc); - addEndHandler("detaileddescription",this,&DocHandler::endDoc); - - addStartHandler("para",this,&DocHandler::startParagraph); -} - -DocHandler::~DocHandler() -{ -} - -void DocHandler::startDoc(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("start dochandler\n"); -} - -void DocHandler::endDoc() -{ - printf("end dochandler\n"); - m_parent->setDelegate(0); -} - -void DocHandler::startParagraph(const QXmlAttributes& attrib) -{ - ParagraphHandler *parHandler = new ParagraphHandler(this); - parHandler->startParagraph(attrib); - m_children.append(parHandler); -} - diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h deleted file mode 100644 index 1c599ca..0000000 --- a/addon/xmlparse/dochandler.h +++ /dev/null @@ -1,749 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _DOCHANDLER_H -#define _DOCHANDLER_H - -#include <qstring.h> -#include <qlist.h> -#include <qxml.h> - -#include "basehandler.h" - -class ParagraphHandler; - -//----------------------------------------------------------------------------- - -/*! \brief Node of a structured documentation tree. - * - */ -class DocNode -{ - public: - enum Markup - { - Normal = 0x00, - Bold = 0x01, - Emphasis = 0x02, - ComputerOutput = 0x04, - Subscript = 0x08, - Superscript = 0x10, - SmallFont = 0x20, - Center = 0x40 - }; - enum NodeKind - { - Para, - Text, - MarkupModifier, - ItemizedList, - OrderedList, - ListItem, - ParameterList, - Parameter, - SimpleSect, - Title, - Ref, - VariableList, - VariableListEntry, - HRuler, - LineBreak, - ULink, - EMail, - Link, - ProgramListing, - CodeLine, - Highlight, - Anchor, - Formula, - Image, - DotFile, - IndexEntry, - Table, - Row, - Entry - }; - DocNode(NodeKind k) : m_kind(k) {} - virtual ~DocNode() {} - - private: - NodeKind m_kind; -}; - -//----------------------------------------------------------------------------- - - -/*! \brief Node representing a piece of text. - * - */ -class TextNode : public DocNode -{ - public: - TextNode(const QString &t,int markup) - : DocNode(Text), m_text(t), m_markup(markup) {} - - private: - QString m_text; - int m_markup; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a change in the markup style. - * - */ -class MarkupModifierNode : public DocNode -{ - public: - MarkupModifierNode(int markup,bool enabled) - : DocNode(MarkupModifier), m_markup(markup), m_enabled(enabled) {} - - private: - int m_markup; - bool m_enabled; -}; - - -//----------------------------------------------------------------------------- - -/*! \brief Handles markup commands in the XML input. - * - */ -class MarkupHandler : public BaseFallBackHandler<MarkupHandler> -{ - public: - MarkupHandler(QList<DocNode> &children,QString &curString); - virtual ~MarkupHandler(); - int markup() const { return m_curMarkup; } - - virtual void startBold(const QXmlAttributes &attrib); - virtual void endBold(); - virtual void startEmphasis(const QXmlAttributes &attrib); - virtual void endEmphasis(); - virtual void startComputerOutput(const QXmlAttributes &attrib); - virtual void endComputerOutput(); - virtual void startCenter(const QXmlAttributes &attrib); - virtual void endCenter(); - virtual void startSmallFont(const QXmlAttributes &attrib); - virtual void endSmallFont(); - virtual void startSubscript(const QXmlAttributes &attrib); - virtual void endSubscript(); - virtual void startSuperscript(const QXmlAttributes &attrib); - virtual void endSuperscript(); - - - private: - void addTextNode(); - - QList<DocNode> &m_children; - QString &m_curString; - int m_curMarkup; -}; - - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a list item. - * - */ -class ListItemHandler : public DocNode, public BaseHandler<ListItemHandler> -{ - public: - ListItemHandler(IBaseHandler *parent); - virtual ~ListItemHandler(); - virtual void startListItem(const QXmlAttributes& attrib); - virtual void endListItem(); - virtual void startParagraph(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<DocNode> m_children; -}; - - -//----------------------------------------------------------------------------- - -/*! \brief Node representing list of items. - * - */ -class ListHandler : public DocNode, public BaseHandler<ListHandler> -{ - public: - ListHandler(NodeKind k,IBaseHandler *parent); - virtual ~ListHandler(); - virtual void startList(const QXmlAttributes& attrib); - virtual void endList(); - virtual void startListItem(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<DocNode> m_children; -}; - - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a parameter. - * - */ -class ParameterHandler : public DocNode, - public BaseHandler<ParameterHandler> -{ - public: - ParameterHandler(IBaseHandler *parent); - virtual ~ParameterHandler(); - virtual void startParameterName(const QXmlAttributes& attrib); - virtual void endParameterName(); - virtual void startParameterDescription(const QXmlAttributes& attrib); - virtual void endParameterDescription(); - virtual void startParagraph(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QString m_name; - ParagraphHandler *m_description; -}; - - -//----------------------------------------------------------------------------- - -/* \brief Node representing a parameter list. - * - */ -class ParameterListHandler : public DocNode, - public BaseHandler<ParameterListHandler> -{ - public: - enum Types { Param, RetVal, Exception }; - ParameterListHandler(IBaseHandler *parent); - virtual ~ParameterListHandler(); - virtual void startParameterList(const QXmlAttributes& attrib); - virtual void endParameterList(); - virtual void startParameterName(const QXmlAttributes& attrib); - virtual void startParameterDescription(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<ParameterHandler> m_parameters; - ParameterHandler *m_curParam; - Types m_type; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing a horizontal ruler - * - */ -class LineBreakHandler : public DocNode, public BaseHandler<LineBreakHandler> -{ - public: - LineBreakHandler(IBaseHandler *parent); - virtual ~LineBreakHandler(); - - void startLineBreak(const QXmlAttributes& attrib); - void endLineBreak(); - - private: - IBaseHandler *m_parent; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing a link to section - * - */ -class LinkHandler : public DocNode, public BaseHandler<LinkHandler> -{ - public: - LinkHandler(IBaseHandler *parent); - virtual ~LinkHandler(); - - void startLink(const QXmlAttributes& attrib); - void endLink(); - - private: - IBaseHandler *m_parent; - QString m_ref; - QString m_text; -}; - - -//----------------------------------------------------------------------------- - -/* \brief Node representing a link to an email address - * - */ -class EMailHandler : public DocNode, public BaseHandler<EMailHandler> -{ - public: - EMailHandler(IBaseHandler *parent); - virtual ~EMailHandler(); - - void startEMail(const QXmlAttributes& attrib); - void endEMail(); - - private: - IBaseHandler *m_parent; - QString m_address; -}; - - -//----------------------------------------------------------------------------- - -/* \brief Node representing a link to an URL - * - */ -class ULinkHandler : public DocNode, public BaseHandler<ULinkHandler> -{ - public: - ULinkHandler(IBaseHandler *parent); - virtual ~ULinkHandler(); - - void startULink(const QXmlAttributes& attrib); - void endULink(); - - private: - IBaseHandler *m_parent; - QString m_url; - QString m_text; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing a horizontal ruler - * - */ -class HRulerHandler : public DocNode, public BaseHandler<HRulerHandler> -{ - public: - HRulerHandler(IBaseHandler *parent); - virtual ~HRulerHandler(); - - void startHRuler(const QXmlAttributes& attrib); - void endHRuler(); - - private: - IBaseHandler *m_parent; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing a reference to another item - * - */ -class RefHandler : public DocNode, public BaseHandler<RefHandler> -{ - public: - RefHandler(IBaseHandler *parent); - virtual ~RefHandler(); - void startRef(const QXmlAttributes& attrib); - void endRef(); - private: - IBaseHandler *m_parent; - QString m_refId; - QString m_anchor; - QString m_linkText; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing the title of a section - * - */ -// children: text, ref -// children handled by MarkupHandler: -// bold, computeroutput, emphasis, center, -// small, subscript, superscript. -class TitleHandler : public DocNode, public BaseHandler<TitleHandler> -{ - public: - TitleHandler(IBaseHandler *parent); - virtual ~TitleHandler(); - virtual void startTitle(const QXmlAttributes& attrib); - virtual void endTitle(); - virtual void startRef(const QXmlAttributes& attrib); - void addTextNode(); - private: - IBaseHandler *m_parent; - QList<DocNode> m_children; - MarkupHandler *m_markupHandler; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing a simple section with an unnumbered header. - * - */ -// children: title, para -class SimpleSectHandler : public DocNode, - public BaseHandler<SimpleSectHandler> -{ - public: - enum Types { Invalid = 0, - See, Return, Author, Version, - Since, Date, Bug, Note, - Warning, Par, Deprecated, Pre, - Post, Invar, Remark, Attention, - Todo, Test, RCS, EnumValues, - Examples - }; - SimpleSectHandler(IBaseHandler *parent); - virtual ~SimpleSectHandler(); - virtual void startSimpleSect(const QXmlAttributes& attrib); - virtual void endSimpleSect(); - virtual void startTitle(const QXmlAttributes& attrib); - virtual void startParagraph(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - ParagraphHandler *m_paragraph; - Types m_type; - TitleHandler *m_title; -}; - -//----------------------------------------------------------------------------- - -/* \brief Node representing an named item of a VariableList. - * - */ -class VariableListEntryHandler : public DocNode, public BaseHandler<VariableListEntryHandler> -{ - public: - virtual void startVarListEntry(const QXmlAttributes& attrib); - virtual void endVarListEntry(); - virtual void startListItem(const QXmlAttributes& attrib); - virtual void endListItem(); - virtual void startTerm(const QXmlAttributes& attrib); - virtual void endTerm(); - virtual void startParagraph(const QXmlAttributes& attrib); - - VariableListEntryHandler(IBaseHandler *parent); - virtual ~VariableListEntryHandler(); - - private: - IBaseHandler *m_parent; - QString m_term; - ParagraphHandler *m_description; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a list of named items. - * - */ -// children: varlistentry, listitem -class VariableListHandler : public DocNode, public BaseHandler<VariableListHandler> -{ - public: - virtual void startVariableList(const QXmlAttributes& attrib); - virtual void endVariableList(); - virtual void startVarListEntry(const QXmlAttributes& attrib); - virtual void startListItem(const QXmlAttributes& attrib); - - VariableListHandler(IBaseHandler *parent); - virtual ~VariableListHandler(); - - private: - IBaseHandler *m_parent; - QList<VariableListEntryHandler> m_entries; - VariableListEntryHandler *m_curEntry; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a highlighted text fragment. - * - */ -// children: - -class HighlightHandler : public DocNode, public BaseHandler<HighlightHandler> -{ - public: - HighlightHandler(IBaseHandler *parent); - virtual ~HighlightHandler(); - void startHighlight(const QXmlAttributes& attrib); - void endHighlight(); - - private: - IBaseHandler *m_parent; - QString m_class; - QString m_text; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a line of code. - * - */ -// children: linenumber, highlight, anchor, ref -class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> -{ - public: - - virtual void startCodeLine(const QXmlAttributes&); - virtual void endCodeLine(); - virtual void startLineNumber(const QXmlAttributes&); - virtual void endLineNumber(); - virtual void startHighlight(const QXmlAttributes&); - virtual void startRef(const QXmlAttributes&); - - CodeLineHandler(IBaseHandler *parent); - virtual ~CodeLineHandler(); - - private: - void addTextNode(); - - IBaseHandler *m_parent; - int m_lineNumber; - QString m_refId; - QList<DocNode> m_children; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a program listing - * - */ -// children: codeline, linenumber -class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingHandler> -{ - public: - virtual void startProgramListing(const QXmlAttributes& attrib); - virtual void endProgramListing(); - virtual void startCodeLine(const QXmlAttributes&); - virtual void startLineNumber(const QXmlAttributes&); - - ProgramListingHandler(IBaseHandler *parent); - virtual ~ProgramListingHandler(); - private: - IBaseHandler *m_parent; - QList<CodeLineHandler> m_children; - bool m_hasLineNumber; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a formula. - * - */ -// children: - -class FormulaHandler : public DocNode, public BaseHandler<FormulaHandler> -{ - public: - FormulaHandler(IBaseHandler *parent); - virtual ~FormulaHandler(); - void startFormula(const QXmlAttributes& attrib); - void endFormula(); - - private: - IBaseHandler *m_parent; - QString m_id; - QString m_text; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing an image. - * - */ -// children: - -class ImageHandler : public DocNode, public BaseHandler<ImageHandler> -{ - public: - ImageHandler(IBaseHandler *parent); - virtual ~ImageHandler(); - void startImage(const QXmlAttributes& attrib); - void endImage(); - - private: - IBaseHandler *m_parent; - QString m_name; - QString m_caption; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a dot file. - * - */ -// children: - -class DotFileHandler : public DocNode, public BaseHandler<DotFileHandler> -{ - public: - DotFileHandler(IBaseHandler *parent); - virtual ~DotFileHandler(); - void startDotFile(const QXmlAttributes& attrib); - void endDotFile(); - - private: - IBaseHandler *m_parent; - QString m_name; - QString m_caption; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing an entry in the index. - * - */ -// children: - -class IndexEntryHandler : public DocNode, public BaseHandler<IndexEntryHandler> -{ - public: - IndexEntryHandler(IBaseHandler *parent); - virtual ~IndexEntryHandler(); - void startIndexEntry(const QXmlAttributes& attrib); - void endIndexEntry(); - void startPrimaryIE(const QXmlAttributes& attrib); - void endPrimaryIE(); - void startSecondaryIE(const QXmlAttributes& attrib); - void endSecondaryIE(); - - private: - IBaseHandler *m_parent; - QString m_primary; - QString m_secondary; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing an entry in the table entry. - * - */ -// children: para -class EntryHandler : public DocNode, public BaseHandler<EntryHandler> -{ - public: - EntryHandler(IBaseHandler *parent); - virtual ~EntryHandler(); - void startEntry(const QXmlAttributes& attrib); - void endEntry(); - void startParagraph(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<DocNode> m_children; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing an entry in the table row. - * - */ -// children: entry -class RowHandler : public DocNode, public BaseHandler<RowHandler> -{ - public: - RowHandler(IBaseHandler *parent); - virtual ~RowHandler(); - void startRow(const QXmlAttributes& attrib); - void endRow(); - void startEntry(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<EntryHandler> m_children; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing an entry in the table. - * - */ -// children: row -class TableHandler : public DocNode, public BaseHandler<TableHandler> -{ - public: - TableHandler(IBaseHandler *parent); - virtual ~TableHandler(); - void startTable(const QXmlAttributes& attrib); - void endTable(); - void startRow(const QXmlAttributes& attrib); - - private: - IBaseHandler *m_parent; - QList<RowHandler> m_children; - int m_numColumns; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a paragraph of text and commands. - * - */ -// children: itemizedlist, orderedlist, parameterlist, simplesect, ref, -// variablelist, hruler, linebreak, ulink, email, link -// programlisting, formula, image, dotfile, indexentry, -// table -// -// children handled by MarkupHandler: -// bold, computeroutput, emphasis, center, -// small, subscript, superscript. -// -class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> -{ - public: - virtual void startParagraph(const QXmlAttributes& attrib); - virtual void endParagraph(); - virtual void startItemizedList(const QXmlAttributes& attrib); - virtual void startOrderedList(const QXmlAttributes& attrib); - virtual void startParameterList(const QXmlAttributes& attrib); - virtual void startSimpleSect(const QXmlAttributes& attrib); - virtual void startRef(const QXmlAttributes& attrib); - virtual void startVariableList(const QXmlAttributes& attrib); - virtual void startHRuler(const QXmlAttributes& attrib); - virtual void startLineBreak(const QXmlAttributes& attrib); - virtual void startULink(const QXmlAttributes& attrib); - virtual void startEMail(const QXmlAttributes& attrib); - virtual void startLink(const QXmlAttributes& attrib); - virtual void startProgramListing(const QXmlAttributes& attrib); - virtual void startFormula(const QXmlAttributes& attrib); - virtual void startImage(const QXmlAttributes& attrib); - virtual void startDotFile(const QXmlAttributes& attrib); - virtual void startIndexEntry(const QXmlAttributes& attrib); - virtual void startTable(const QXmlAttributes& attrib); - - ParagraphHandler(IBaseHandler *parent); - virtual ~ParagraphHandler(); - - private: - void addTextNode(); - IBaseHandler *m_parent; - QList<DocNode> m_children; - MarkupHandler *m_markupHandler; -}; - -//----------------------------------------------------------------------------- - -/*! \brief Node representing a documentation block. - * - */ -// children: para -// TODO: title, sect1, sect2, sect3 -class DocHandler : public BaseHandler<DocHandler> -{ - public: - virtual void startDoc(const QXmlAttributes& attrib); - virtual void endDoc(); - virtual void startParagraph(const QXmlAttributes& attrib); - - DocHandler(IBaseHandler *parent); - virtual ~DocHandler(); - - private: - IBaseHandler *m_parent; - QList<DocNode> m_children; -}; - -#endif diff --git a/addon/xmlparse/doxmlintf.h b/addon/xmlparse/doxmlintf.h deleted file mode 100644 index 1af6a60..0000000 --- a/addon/xmlparse/doxmlintf.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _DOXMLINTF_H -#define _DOXMLINTF_H - -#include <qlist.h> -#include <qstring.h> - -class IMember; - -class IParam -{ - public: - virtual QString type() const = 0; - virtual QString declarationName() const = 0; - virtual QString definitionName() const = 0; - virtual QString attrib() const = 0; - virtual QString arraySpecifier() const = 0; - virtual QString defaultValue() const = 0; -}; - -class IMemberReference -{ - public: - virtual IMember *getMember() const = 0; - virtual QString getMemberName() const = 0; - virtual int getLineNumber() const = 0; -}; - -class IMember -{ - public: - virtual QString kind() const = 0; - virtual QString id() const = 0; - virtual QString protection() const = 0; - virtual QString virtualness() const = 0; - virtual QString type() const = 0; - virtual QString name() const = 0; - virtual QListIterator<IParam> getParamIterator() const = 0; -}; - -class ISection -{ - public: - virtual QString kind() const = 0; - virtual QListIterator<IMember> getMemberIterator() const = 0; -}; - -class ICompound -{ - public: - virtual QString name() const = 0; - virtual QString id() const = 0; - virtual QString kind() const = 0; - virtual QListIterator<ISection> getSectionIterator() const = 0; -}; - -/*! Root node of the object model. */ -class IDoxygen -{ - public: - /*! Returns an iterator that can be used to iterate over the list - * of compounds found in the project. - */ - virtual QListIterator<ICompound> getCompoundIterator() const = 0; - - /*! Returns a compound given its unique \a id. If you have a - * compound id this function is much more efficient than iterating - * over the compound list. Returns 0 if the id is not valid. - */ - virtual ICompound *getCompoundById(const QString &id) const = 0; - - /*! Returns a compound given its name (including the scope). - * Returns 0 if the name is not found in the project. - */ - virtual ICompound *getCompoundByName(const QString &name) const = 0; - - virtual IMember *getMemberById(const QString &id) const = 0; - virtual QList<IMember> *getMemberByName(const QString &name) const = 0; -}; - -/*! Factory method that creates an object model given an XML file generated - * by doxygen. - * @param xmlFileName The name of the XML to parse. - * @returns An iterface to the object model. - */ -IDoxygen *createObjectModelFromXML(const char *xmlFileName); - -#endif diff --git a/addon/xmlparse/main.cpp b/addon/xmlparse/main.cpp deleted file mode 100644 index 081b0d7..0000000 --- a/addon/xmlparse/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** - * - * $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 <stdio.h> -#include "doxmlintf.h" - - -int main(int argc,char **argv) -{ - if (argc!=2) - { - printf("Usage: %s file.xml\n",argv[0]); - exit(1); - } - - IDoxygen *dox = createObjectModelFromXML(argv[1]); - - { - QListIterator<ICompound> cli(dox->getCompoundIterator()); - ICompound *comp; - printf("--- compound list ---------\n"); - for (cli.toFirst();(comp=cli.current());++cli) - { - printf("Compound name=%s id=%s kind=%s\n", - comp->name().data(),comp->id().data(),comp->kind().data()); - QListIterator<ISection> sli(comp->getSectionIterator()); - ISection *sec; - for (sli.toFirst();(sec=sli.current());++sli) - { - printf(" Section kind=%s\n",sec->kind().data()); - QListIterator<IMember> mli(sec->getMemberIterator()); - IMember *mem; - for (mli.toFirst();(mem=mli.current());++mli) - { - printf(" Member type=%s name=%s\n",mem->type().data(),mem->name().data()); - QListIterator<IParam> pli(mem->getParamIterator()); - IParam *par; - for (pli.toFirst();(par=pli.current());++pli) - { - printf(" Param type=%s name=%s defvalue=%s\n", - par->type().data(),par->definitionName().data(),par->defaultValue().data()); - } - } - } - } - printf("---------------------------\n"); - - } - - delete dox; - - return 0; -} - diff --git a/addon/xmlparse/mainhandler.cpp b/addon/xmlparse/mainhandler.cpp deleted file mode 100644 index c32426f..0000000 --- a/addon/xmlparse/mainhandler.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** - * - * $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 <qxml.h> -#include "mainhandler.h" - -MainHandler::MainHandler() : m_compoundDict(10007), m_compoundNameDict(10007) -{ - m_compounds.setAutoDelete(TRUE); - addStartHandler("doxygen"); - addStartHandler("compounddef",this,&MainHandler::startCompound); - addEndHandler("doxygen"); - addEndHandler("compounddef"); -} - -MainHandler::~MainHandler() -{ - printf("MainHandler::~MainHandler()\n"); -} - -void MainHandler::startCompound(const QXmlAttributes& attrib) -{ - CompoundHandler *compHandler = new CompoundHandler(this); - compHandler->startCompound(attrib); - m_compounds.append(compHandler); -} - -void MainHandler::insertMemberById(const QString &id,IMember *h) -{ - m_memberDict.insert(id,h); -} - -void MainHandler::insertMemberByName(const QString &name,IMember *h) -{ - QList<IMember> *ml = m_memberNameDict[name]; - if (ml) - { - ml->append(h); - } - else - { - ml = new QList<IMember>; - ml->append(h); - m_memberNameDict.insert(name,ml); - } -} - -void MainHandler::initialize() -{ - QListIterator<ICompound> mci(m_compounds); - CompoundHandler *compHandler; - for (;(compHandler=(CompoundHandler *)mci.current());++mci) - { - compHandler->initialize(this); - m_compoundNameDict.insert(compHandler->name(),compHandler); - m_compoundDict.insert(compHandler->id(),compHandler); - } - - // for each member - QDictIterator< QList<IMember> > mndi(m_memberNameDict); - QList<IMember> *ml; - for (;(ml=mndi.current());++mndi) - { - QListIterator<IMember> mli(*ml); - IMember *mem; - for (;(mem=mli.current());++mli) - { - ((MemberHandler*)mem)->initialize(this); - } - } - -} - -class ErrorHandler : public QXmlErrorHandler -{ - public: - virtual ~ErrorHandler() {} - bool warning( const QXmlParseException & ) - { - return FALSE; - } - bool error( const QXmlParseException & ) - { - return FALSE; - } - bool fatalError( const QXmlParseException &exception ) - { - fprintf(stderr,"Fatal error at line %d column %d: %s\n", - exception.lineNumber(),exception.columnNumber(), - exception.message().data()); - return FALSE; - } - QString errorString() { return ""; } - - private: - QString errorMsg; -}; - -IDoxygen *createObjectModelFromXML(const char * xmlFileName) -{ - QFile xmlFile(xmlFileName); - MainHandler * handler = new MainHandler; - ErrorHandler errorHandler; - QXmlInputSource source( xmlFile ); - QXmlSimpleReader reader; - reader.setContentHandler( handler ); - reader.setErrorHandler( &errorHandler ); - reader.parse( source ); - handler->initialize(); - return handler; -} - diff --git a/addon/xmlparse/mainhandler.h b/addon/xmlparse/mainhandler.h deleted file mode 100644 index c5f945f..0000000 --- a/addon/xmlparse/mainhandler.h +++ /dev/null @@ -1,64 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _MAINHANDLER_H -#define _MAINHANDLER_H - -#include <qlist.h> -#include "basehandler.h" -#include "compoundhandler.h" -#include "doxmlintf.h" - -class MainHandler : public IDoxygen, public BaseHandler<MainHandler> -{ - public: - virtual void startCompound(const QXmlAttributes& attrib); - MainHandler(); - virtual ~MainHandler(); - - QListIterator<ICompound> getCompoundIterator() const - { - return m_compounds; - } - ICompound *getCompoundById(const QString &id) const - { - return m_compoundDict[id]; - } - virtual ICompound *getCompoundByName(const QString &name) const - { - return name.isEmpty() ? 0 : m_compoundNameDict[name]; - } - virtual IMember *getMemberById(const QString &id) const - { - return m_memberDict[id]; - } - virtual QList<IMember> *getMemberByName(const QString &name) const - { - return m_memberNameDict[name]; - } - void insertMemberById(const QString &id,IMember *h); - void insertMemberByName(const QString &name,IMember *h); - - void initialize(); - - private: - QList<ICompound> m_compounds; - QDict<ICompound> m_compoundDict; - QDict<ICompound> m_compoundNameDict; - QDict<IMember> m_memberDict; - QDict<QList<IMember> > m_memberNameDict; -}; - -#endif diff --git a/addon/xmlparse/memberhandler.cpp b/addon/xmlparse/memberhandler.cpp deleted file mode 100644 index 0fbf5c1..0000000 --- a/addon/xmlparse/memberhandler.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/****************************************************************************** - * - * $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 "memberhandler.h" -#include "sectionhandler.h" -#include "dochandler.h" -#include "mainhandler.h" - -MemberHandler::MemberHandler(IBaseHandler *parent) - : m_parent(parent), m_brief(0), m_detailed(0) -{ - addEndHandler("memberdef",this,&MemberHandler::endMember); - - addStartHandler("type"); - addEndHandler("type",this,&MemberHandler::endType); - - addStartHandler("name"); - addEndHandler("name",this,&MemberHandler::endName); - - addStartHandler("param",this,&MemberHandler::startParam); - - addStartHandler("briefdescription",this,&MemberHandler::startBriefDesc); - - addStartHandler("detaileddescription",this,&MemberHandler::startDetailedDesc); - - addStartHandler("location",this,&MemberHandler::startLocation); - addEndHandler("location"); - - addStartHandler("references",this,&MemberHandler::startReferences); - addEndHandler("references",this,&MemberHandler::endReferences); - - addStartHandler("referencedby",this,&MemberHandler::startReferencedBy); - addEndHandler("referencedby",this,&MemberHandler::endReferencedBy); - - m_params.setAutoDelete(TRUE); - m_references.setAutoDelete(TRUE); - m_referencedBy.setAutoDelete(TRUE); - -} - -MemberHandler::~MemberHandler() -{ - delete m_brief; - delete m_detailed; -} - -void MemberHandler::startMember(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - m_kind = attrib.value("kind"); - m_id = attrib.value("id"); - m_protection = attrib.value("prot"); - m_virtualness = attrib.value("virtualness"); - printf("member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n", - m_kind.data(),m_id.data(),m_protection.data(),m_virtualness.data()); -} - -void MemberHandler::startBriefDesc(const QXmlAttributes& attrib) -{ - DocHandler *docHandler = new DocHandler(this); - docHandler->startDoc(attrib); - m_brief = docHandler; -} - -void MemberHandler::startDetailedDesc(const QXmlAttributes& attrib) -{ - DocHandler *docHandler = new DocHandler(this); - docHandler->startDoc(attrib); - m_detailed = docHandler; -} - -void MemberHandler::startLocation(const QXmlAttributes& attrib) -{ - m_defFile = attrib.value("file"); - m_defLine = attrib.value("line").toInt(); -} - -void MemberHandler::startReferences(const QXmlAttributes& attrib) -{ - MemberReference *mr = new MemberReference; - mr->m_memId = attrib.value("id"); - mr->m_line = attrib.value("line").toInt(); - m_references.append(mr); - m_curString=""; -} - -void MemberHandler::endReferences() -{ - m_references.getLast()->m_name = m_curString; -} - -void MemberHandler::startReferencedBy(const QXmlAttributes& attrib) -{ - MemberReference *mr = new MemberReference; - mr->m_memId = attrib.value("id"); - mr->m_line = attrib.value("line").toInt(); - m_referencedBy.append(mr); - m_curString=""; -} - -void MemberHandler::endReferencedBy() -{ - m_referencedBy.getLast()->m_name = m_curString; -} - -void MemberHandler::endMember() -{ - m_parent->setDelegate(0); -} - -void MemberHandler::endType() -{ - m_type = m_curString.stripWhiteSpace(); - printf("member type=`%s'\n",m_type.data()); -} - -void MemberHandler::endName() -{ - m_name = m_curString.stripWhiteSpace(); - printf("member name=`%s'\n",m_name.data()); -} - -void MemberHandler::startParam(const QXmlAttributes& attrib) -{ - ParamHandler *paramHandler = new ParamHandler(this); - paramHandler->startParam(attrib); - m_params.append(paramHandler); -} - -void MemberHandler::initialize(MainHandler *mh) -{ - QListIterator<MemberReference> mli(m_references); - MemberReference *mr; - for (;(mr=mli.current());++mli) - { - mr->initialize(mh); - } -} - -void MemberHandler::MemberReference::initialize(MainHandler *mh) -{ - m_mainHandler = mh; -} - -IMember *MemberHandler::MemberReference::getMember() const -{ - return m_mainHandler->getMemberById(m_memId); -} diff --git a/addon/xmlparse/memberhandler.h b/addon/xmlparse/memberhandler.h deleted file mode 100644 index ccb4a57..0000000 --- a/addon/xmlparse/memberhandler.h +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _MEMBERHANDLER_H -#define _MEMBERHANDLER_H - -#include <qstring.h> -#include <qlist.h> -#include <qxml.h> - -#include "basehandler.h" -#include "paramhandler.h" -#include "doxmlintf.h" - -class DocHandler; -class MainHandler; - -class MemberHandler : public IMember, public BaseHandler<MemberHandler> -{ - public: - virtual void startMember(const QXmlAttributes& attrib); - virtual void endMember(); - virtual void startParam(const QXmlAttributes& attrib); - virtual void endType(); - virtual void endName(); - virtual void startBriefDesc(const QXmlAttributes& attrib); - virtual void startDetailedDesc(const QXmlAttributes& attrib); - virtual void startLocation(const QXmlAttributes& attrib); - virtual void startReferences(const QXmlAttributes& attrib); - virtual void endReferences(); - virtual void startReferencedBy(const QXmlAttributes& attrib); - virtual void endReferencedBy(); - - MemberHandler(IBaseHandler *parent); - virtual ~MemberHandler(); - - // IMember - virtual QString kind() const { return m_kind; } - virtual QString id() const { return m_id; } - virtual QString protection() const { return m_protection; } - virtual QString virtualness() const { return m_virtualness; } - virtual QString type() const { return m_type; } - virtual QString name() const { return m_name; } - virtual QListIterator<IParam> getParamIterator() const { return m_params; } - - void initialize(MainHandler *m); - - private: - struct MemberReference : public IMemberReference - { - virtual ~MemberReference() {} - virtual IMember *getMember() const; - virtual QString getMemberName() const { return m_name; } - virtual int getLineNumber() const { return m_line; } - void initialize(MainHandler *m); - - QString m_memId; - QString m_name; - int m_line; - MainHandler *m_mainHandler; - }; - - IBaseHandler *m_parent; - QString m_kind; - QString m_id; - QString m_protection; - QString m_virtualness; - QString m_type; - QString m_name; - DocHandler *m_brief; - DocHandler *m_detailed; - QList<IParam> m_params; - QList<MemberReference> m_references; - QList<MemberReference> m_referencedBy; - QString m_defFile; - int m_defLine; -}; - -#endif diff --git a/addon/xmlparse/paramhandler.cpp b/addon/xmlparse/paramhandler.cpp deleted file mode 100644 index a800195..0000000 --- a/addon/xmlparse/paramhandler.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************** - * - * $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 "paramhandler.h" -#include "memberhandler.h" - -ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) -{ - addEndHandler("param",this,&ParamHandler::endParam); - - addStartHandler("type"); - addEndHandler("type",this,&ParamHandler::endType); - - addStartHandler("declname"); - addEndHandler("declname",this,&ParamHandler::endDeclName); - - addStartHandler("defname"); - addEndHandler("defname",this,&ParamHandler::endDefName); - - addStartHandler("array"); - addEndHandler("array",this,&ParamHandler::endArray); - - addStartHandler("attrib"); - addEndHandler("attrib",this,&ParamHandler::endAttrib); - - addStartHandler("defval"); - addEndHandler("defval",this,&ParamHandler::endDefVal); -} - -ParamHandler::~ParamHandler() -{ -} - -void ParamHandler::startParam(const QXmlAttributes& /*attrib*/) -{ - m_parent->setDelegate(this); - printf("param\n"); -} - -void ParamHandler::endParam() -{ - m_parent->setDelegate(0); -} - -void ParamHandler::endType() -{ - m_type = m_curString.stripWhiteSpace(); - printf("param type=`%s'\n",m_type.data()); -} - -void ParamHandler::endDeclName() -{ - m_declName = m_curString.stripWhiteSpace(); - printf("member declName=`%s'\n",m_declName.data()); -} - -void ParamHandler::endDefName() -{ - m_defName = m_curString.stripWhiteSpace(); - printf("member defName=`%s'\n",m_defName.data()); -} - -void ParamHandler::endAttrib() -{ - m_attrib = m_curString.stripWhiteSpace(); - printf("member attrib=`%s'\n",m_attrib.data()); -} - -void ParamHandler::endArray() -{ - m_array = m_curString.stripWhiteSpace(); - printf("member array=`%s'\n",m_array.data()); -} - -void ParamHandler::endDefVal() -{ - m_defVal = m_curString.stripWhiteSpace(); - printf("member defVal=`%s'\n",m_defVal.data()); -} - - - diff --git a/addon/xmlparse/paramhandler.h b/addon/xmlparse/paramhandler.h deleted file mode 100644 index 38e5e03..0000000 --- a/addon/xmlparse/paramhandler.h +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _PARAMHANDLER_H -#define _PARAMHANDLER_H - -#include <qstring.h> -#include <qlist.h> -#include <qxml.h> - -#include "basehandler.h" -#include "doxmlintf.h" - -class ParamHandler : public IParam, public BaseHandler<ParamHandler> -{ - public: - virtual void startParam(const QXmlAttributes& attrib); - virtual void endParam(); - virtual void endType(); - virtual void endDeclName(); - virtual void endDefName(); - virtual void endAttrib(); - virtual void endArray(); - virtual void endDefVal(); - - ParamHandler(IBaseHandler *parent); - virtual ~ParamHandler(); - - // IParam - virtual QString type() const { return m_type; } - virtual QString declarationName() const { return m_declName; } - virtual QString definitionName() const { return m_defName; } - virtual QString attrib() const { return m_attrib; } - virtual QString arraySpecifier() const { return m_array; } - virtual QString defaultValue() const { return m_defVal; } - - private: - IBaseHandler *m_parent; - QString m_type; - QString m_declName; - QString m_defName; - QString m_attrib; - QString m_array; - QString m_defVal; -}; - -#endif diff --git a/addon/xmlparse/sectionhandler.cpp b/addon/xmlparse/sectionhandler.cpp deleted file mode 100644 index 0fc3446..0000000 --- a/addon/xmlparse/sectionhandler.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/****************************************************************************** - * - * $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 "mainhandler.h" -#include "compoundhandler.h" -#include "sectionhandler.h" - -SectionHandler::SectionHandler(IBaseHandler *parent) : m_parent(parent) -{ - m_members.setAutoDelete(TRUE); - addEndHandler("sectiondef",this,&SectionHandler::endSection); - addStartHandler("memberdef",this,&SectionHandler::startMember); -} - -SectionHandler::~SectionHandler() -{ -} - -void SectionHandler::startSection(const QXmlAttributes& attrib) -{ - m_parent->setDelegate(this); - m_kind = attrib.value("kind"); - printf("section kind=`%s'\n",m_kind.data()); -} - -void SectionHandler::endSection() -{ - m_parent->setDelegate(0); -} - -void SectionHandler::startMember(const QXmlAttributes& attrib) -{ - MemberHandler *memHandler = new MemberHandler(this); - memHandler->startMember(attrib); - m_members.append(memHandler); -} - -void SectionHandler::initialize(MainHandler *m) -{ - QListIterator<IMember> mli(m_members); - MemberHandler *mh; - for (;(mh=(MemberHandler *)mli.current());++mli) - { - m->insertMemberById(mh->name(),mh); - m->insertMemberByName(mh->name(),mh); - } -} - - diff --git a/addon/xmlparse/sectionhandler.h b/addon/xmlparse/sectionhandler.h deleted file mode 100644 index 46cb422..0000000 --- a/addon/xmlparse/sectionhandler.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * - * $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. - * - */ - -#ifndef _SECTIONHANDLER_H -#define _SECTIONHANDLER_H - -#include <qstring.h> -#include <qlist.h> -#include <qxml.h> - -#include "basehandler.h" -#include "memberhandler.h" -#include "doxmlintf.h" - -class MainHandler; - -class SectionHandler : public ISection, public BaseHandler<SectionHandler> -{ - public: - virtual void startMember(const QXmlAttributes& attrib); - virtual void startSection(const QXmlAttributes& attrib); - virtual void endSection(); - - SectionHandler(IBaseHandler *parent); - virtual ~SectionHandler(); - - // ISection - virtual QString kind() const { return m_kind; } - virtual QListIterator<IMember> getMemberIterator() const { return m_members; } - - void initialize(MainHandler *m); - - private: - IBaseHandler *m_parent; - QString m_kind; - QList<IMember> m_members; -}; - -#endif diff --git a/addon/xmlparse/xmlparse.pro.in b/addon/xmlparse/xmlparse.pro.in deleted file mode 100644 index 9e3b6aa..0000000 --- a/addon/xmlparse/xmlparse.pro.in +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = app.t -CONFIG = console warn_on $extraopt -HEADERS = basehandler.h mainhandler.h \ - compoundhandler.h sectionhandler.h \ - memberhandler.h paramhandler.h \ - dochandler.h -SOURCES = main.cpp mainhandler.cpp \ - compoundhandler.cpp sectionhandler.cpp \ - memberhandler.cpp paramhandler.cpp \ - dochandler.cpp -DEPENDPATH = ../../src -unix:LIBS += -L../../lib -ldoxycfg -lqtools -win32:INCLUDEPATH += . -win32-mingw:LIBS += -L../../lib -ldoxycfg -lqtools -win32-msvc:LIBS += qtools.lib doxycfg.lib shell32.lib -win32-msvc:TMAKE_LFLAGS += /LIBPATH:..\..\lib -win32-borland:LIBS += qtools.lib doxycfg.lib shell32.lib -win32-borland:TMAKE_LFLAGS += -L..\..\lib -win32:TMAKE_CXXFLAGS += -DQT_NODLL -INCLUDEPATH += ../../qtools ../../src -DESTDIR = -TARGET = xmlparse -unix:TARGETDEPS = ../../lib/libdoxycfg.a -win32:TARGETDEPS = ../../lib/doxycfg.lib -OBJECTS_DIR = obj - |