diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-12-29 18:30:48 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-12-29 18:30:48 (GMT) |
commit | ff11b7d98ad7d24770afd151aa6b439adc7506d2 (patch) | |
tree | 048517043e4c90dcc686bc038b480825fe32886c /addon | |
parent | 414d7b3bbfad8ec16237c3708af188ecaee62886 (diff) | |
download | Doxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.zip Doxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.tar.gz Doxygen-ff11b7d98ad7d24770afd151aa6b439adc7506d2.tar.bz2 |
Release-1.2.13
Diffstat (limited to 'addon')
30 files changed, 2408 insertions, 632 deletions
diff --git a/addon/xmlparse/Doxyfile b/addon/doxmlparser/Doxyfile index c711577..6225af2 100644 --- a/addon/xmlparse/Doxyfile +++ b/addon/doxmlparser/Doxyfile @@ -1,26 +1,25 @@ -# Doxyfile 1.2.8-20010715 +# Doxyfile 1.2.12-20011209 #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = xmlparse +PROJECT_NAME = doxmlparser PROJECT_NUMBER = OUTPUT_DIRECTORY = doc OUTPUT_LANGUAGE = English EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = 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 @@ -33,18 +32,18 @@ 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 = +ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 OPTIMIZE_OUTPUT_FOR_C = NO SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -QUIET = NO +QUIET = YES WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_FORMAT = @@ -52,17 +51,25 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = . -FILE_PATTERNS = *.h *.cpp +INPUT = include +FILE_PATTERNS = *.h RECURSIVE = NO EXCLUDE = EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +#--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO @@ -71,7 +78,7 @@ IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -GENERATE_HTML = NO +GENERATE_HTML = YES HTML_OUTPUT = HTML_HEADER = HTML_FOOTER = @@ -118,6 +125,10 @@ MAN_LINKS = NO #--------------------------------------------------------------------------- GENERATE_XML = YES #--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES @@ -128,6 +139,7 @@ INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- @@ -138,13 +150,17 @@ PERL_PATH = #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = YES +TEMPLATE_RELATIONS = YES +HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES GRAPHICAL_HIERARCHY = YES DOT_PATH = +DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1280 MAX_DOT_GRAPH_HEIGHT = 1024 GENERATE_LEGEND = YES diff --git a/addon/doxmlparser/doxygen.dtd b/addon/doxmlparser/doxygen.dtd new file mode 100644 index 0000000..5b293d0 --- /dev/null +++ b/addon/doxmlparser/doxygen.dtd @@ -0,0 +1,123 @@ +<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> +<!-- NOTE: THIS DTD IS NOT UP TO DATE!!! DO NOT DEPEND ON IT --> +<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> + +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- DTD describing the grammar used in doxygen's XML output --> + +<!-- standard character entities --> +<!ENTITY lt "&#60;"> +<!ENTITY gt ">"> +<!ENTITY amp "&#38;"> +<!ENTITY apos "'"> +<!ENTITY quot """> + +<!-- required attributes for compounds --> +<!ENTITY % compound-req.att + 'id ID #REQUIRED + type (group|file|namespace| + class|struct|union| + interface|dispinterface| + valuetype|library) #REQUIRED' +> +<!-- required attributes for references --> +<!ENTITY % ref-req.att 'idref IDREF #REQUIRED' +> +<!-- required attributes for inheritance relations --> +<!ENTITY % inheritcompref-req.att + '%ref-req.att; + prot (public|protected|private) #REQUIRED + virt (non-virtual|virtual) #REQUIRED' +> + +<!-- required attributes for member sections --> +<!ENTITY % sec-req.att 'type (user + |public-type + |public-func + |public-attrib + |public-slot + |public-static-func + |public-static-attrib + |protected-type + |protected-func + |protected-attrib + |protected-slot + |protected-static-func + |protected-static-attrib + |private-type + |private-func + |private-attrib + |private-slot + |private-static-func + |private-static-attrib + |signal + |friend + |related + |define|prototype|typedef|enum|func|var + |dcop-func + |property + ) #REQUIRED + ' +> +<!-- required attributes for members --> +<!ENTITY % mem-req.att 'id ID #REQUIRED'> + +<!-- optional attributes for function --> +<!ENTITY % func-opt.att 'virt (virtual|pure-virtual) #IMPLIED'> + +<!-- elements --> +<!ELEMENT doxygen (compounddef)*> +<!ELEMENT compounddef (compoundname, + basecompoundref*, + derivedcompoundref*, + sectiondef*, + briefdescription, + detaileddescription, + inheritancegraph?, + collaborationgraph?, + sourcecode? + ) +> +<!ATTLIST compounddef %compound-req.att;> +<!ELEMENT compoundref (#PCDATA)> +<!ATTLIST compoundref %ref-req.att;> +<!ELEMENT memberref (#PCDATA)> +<!ATTLIST memberref %ref-req.att;> +<!ELEMENT basecompoundref EMPTY> +<!ATTLIST basecompoundref %inheritcompref-req.att;> +<!ELEMENT derivedcompoundref EMPTY> +<!ATTLIST derivedcompoundref %inheritcompref-req.att;> +<!ELEMENT sectionlist (sectiondef)+> +<!ELEMENT sectiondef (memberlist)> +<!ATTLIST sectiondef %sec-req.att;> +<!ELEMENT memberlist (functiondef|variabledef|typedef|definedef|enumdef)+> +<!ELEMENT functiondef (type?,name,paramlist)> +<!ATTLIST functiondef %mem-req.att; %func-opt.att;> +<!ELEMENT variabledef (type,name,array?,initializer?)> +<!ATTLIST variabledef %mem-req.att;> +<!ELEMENT typedef (type,name)> +<!ATTLIST typedef %mem-req.att;> +<!ELEMENT definedef (name,defparamlist?,initializer?)> +<!ATTLIST definedef %mem-req.att;> +<!ELEMENT enumdef (name,enumvaluelist)> +<!ATTLIST enumdef %mem-req.att;> +<!ELEMENT slotdef (type,name,paramlist)> +<!ATTLIST slotdef %mem-req.att;> +<!ELEMENT signaldef (type,name,paramlist)> +<!ATTLIST signaldef %mem-req.att;> +<!ELEMENT paramlist (param)*> +<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)> +<!ELEMENT defparamlist (defarg)*> +<!ELEMENT defarg (#PCDATA)> +<!ELEMENT enumvaluelist (enumvalue)*> +<!ELEMENT enumvalue (name,initializer?)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT compoundname (#PCDATA)> +<!ELEMENT declname (#PCDATA)> +<!ELEMENT defname (#PCDATA)> +<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*> +<!ELEMENT defval (#PCDATA|memberref|compoundref)*> +<!ELEMENT initializer (#PCDATA|memberref|compoundref)*> +<!ELEMENT array (#PCDATA)> +<!ELEMENT attributes (#PCDATA)> + diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h new file mode 100644 index 0000000..ec2950c --- /dev/null +++ b/addon/doxmlparser/include/doxmlintf.h @@ -0,0 +1,422 @@ +#ifndef _DOXMLINTF_H +#define _DOXMLINTF_H + +#include <qstring.h> + +class IMember; +class IDocIterator; + +class ILinkedText +{ + public: + enum Kind { Kind_Text, Kind_Ref }; + virtual Kind kind() const = 0; +}; + +class ILT_Text : public ILinkedText +{ + public: + virtual QString text() const = 0; +}; + +class ILT_Ref : public ILinkedText +{ + public: + virtual QString id() const = 0; + virtual QString external() const = 0; + virtual QString text() const = 0; +}; + +class ILinkedTextIterator +{ + public: + virtual ILinkedText *toFirst() = 0; + virtual ILinkedText *toLast() = 0; + virtual ILinkedText *toNext() = 0; + virtual ILinkedText *toPrev() = 0; + virtual ILinkedText *current() const = 0; + virtual void release() = 0; +}; + +class IParam +{ + public: + virtual ILinkedTextIterator *type() const = 0; + virtual QString declarationName() const = 0; + virtual QString definitionName() const = 0; + virtual QString attrib() const = 0; + virtual QString arraySpecifier() const = 0; + virtual ILinkedTextIterator *defaultValue() const = 0; +}; + +class IParamIterator +{ + public: + virtual IParam *toFirst() = 0; + virtual IParam *toLast() = 0; + virtual IParam *toNext() = 0; + virtual IParam *toPrev() = 0; + virtual IParam *current() const = 0; + virtual void release() = 0; +}; + +class IMemberReference +{ + public: + virtual IMember *member() const = 0; + virtual QString memberName() const = 0; +}; + +class IMemberReferenceIterator +{ + public: + virtual IMemberReference *toFirst() = 0; + virtual IMemberReference *toLast() = 0; + virtual IMemberReference *toNext() = 0; + virtual IMemberReference *toPrev() = 0; + virtual IMemberReference *current() const = 0; + virtual void release() = 0; +}; + +class IEnumValue +{ + public: + virtual QString name() const = 0; + virtual QString initializer() const = 0; +}; + +class IEnumValueIterator +{ + public: + virtual IEnumValue *toFirst() = 0; + virtual IEnumValue *toLast() = 0; + virtual IEnumValue *toNext() = 0; + virtual IEnumValue *toPrev() = 0; + virtual IEnumValue *current() const = 0; + virtual void release() = 0; +}; + +class IDoc +{ + public: + enum Kind + { + Para, // 0 -> IDocPara + Text, // 1 -> IDocText + MarkupModifier, // 2 -> IDocMarkupModifier + ItemizedList, // 3 -> IDocList + OrderedList, // 4 -> IDocList + ListItem, // 5 -> IDocListItem + ParameterList, // 6 -> IDocParameterList + Parameter, // 7 -> IDocParameter + SimpleSect, // 8 -> IDocSimpleSect + Title, // 9 -> IDocTitle + Ref, // 10 -> IDocRef + VariableList, // 11 -> IDocVariableList + VariableListEntry, // 12 -> IDocVariableListEntry + HRuler, // 13 -> IDocHRuler + LineBreak, // 14 -> IDocLineBreak + ULink, // 15 -> IDocULink + EMail, // 16 -> IDocEMail + Link, // 17 -> IDocLink + ProgramListing, // 18 -> IDocProgramListing + CodeLine, // 19 -> IDocCodeLine + Highlight, // 20 -> IDocHighlight + Anchor, // 21 -> IDocAnchor + Formula, // 22 -> IDocFormula + Image, // 23 -> IDocImage + DotFile, // 24 -> IDocDotFile + IndexEntry, // 25 -> IDocIndexEntry + Table, // 26 -> IDocTable + Row, // 27 -> IDocRow + Entry, // 28 -> IDocEntry + Section, // 29 -> IDocSection + Root // 30 -> IDocRoot + }; + virtual Kind kind() const = 0; +}; + +class IDocMarkup : public IDoc +{ + public: + enum Markup + { + Normal = 0x00, + Bold = 0x01, + Emphasis = 0x02, + ComputerOutput = 0x04, + Subscript = 0x08, + Superscript = 0x10, + SmallFont = 0x20, + Center = 0x40 + }; + +}; + +class IDocPara : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocText : public IDocMarkup +{ + public: + virtual QString text() const = 0; + virtual int markup() const = 0; +}; + +class IDocMarkupModifier : public IDoc +{ +}; + +class IDocList : public IDoc +{ +}; + +class IDocListItem : public IDoc +{ +}; + +class IDocParameterList : public IDoc +{ +}; + +class IDocParameter : public IDoc +{ +}; + +class IDocSimpleSect : public IDoc +{ +}; + +class IDocTitle : public IDoc +{ + public: + virtual IDocIterator *title() const = 0; +}; + +class IDocRef : public IDoc +{ +}; + +class IDocVariableList : public IDoc +{ +}; + +class IDocVariableListEntry : public IDoc +{ +}; + +class IDocHRuler : public IDoc +{ +}; + +class IDocLineBreak : public IDoc +{ +}; + +class IDocULink : public IDoc +{ +}; + +class IDocEMail : public IDoc +{ +}; + +class IDocLink : public IDoc +{ +}; + +class IDocProgramListing : public IDoc +{ +}; + +class IDocCodeLine : public IDoc +{ +}; + +class IDocHighlight : public IDoc +{ +}; + +class IDocAnchor : public IDoc +{ +}; + +class IDocFormula : public IDoc +{ +}; + +class IDocImage : public IDoc +{ +}; + +class IDocDotFile : public IDoc +{ +}; + +class IDocIndexEntry : public IDoc +{ +}; + +class IDocTable : public IDoc +{ +}; + +class IDocRow : public IDoc +{ +}; + +class IDocEntry : public IDoc +{ +}; + +class IDocSection : public IDoc +{ + public: + virtual QString id() const = 0; + virtual int level() const = 0; + virtual IDocIterator *title() const = 0; +}; + +class IDocRoot : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocIterator +{ + public: + virtual IDoc *toFirst() = 0; + virtual IDoc *toLast() = 0; + virtual IDoc *toNext() = 0; + virtual IDoc *toPrev() = 0; + virtual IDoc *current() const = 0; + virtual void release() = 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 ILinkedTextIterator *type() const = 0; + virtual QString name() const = 0; + virtual bool isConst() const = 0; + virtual bool isVolatile() const = 0; + virtual IParamIterator *params() const = 0; + virtual ILinkedTextIterator *initializer() const = 0; + virtual ILinkedTextIterator *exceptions() const = 0; + virtual IMemberReferenceIterator *references() const = 0; + virtual IMemberReferenceIterator *referencedBy() const = 0; + virtual int bodyStart() const = 0; + virtual int bodyEnd() const = 0; + virtual QString definitionFile() const = 0; + virtual int definitionLine() const = 0; + virtual IMemberReference *reimplements() const = 0; + virtual IMemberReferenceIterator *reimplementedBy() const = 0; + virtual IEnumValueIterator *enumValues() const = 0; + virtual IDocRoot *briefDescription() const = 0; + virtual IDocRoot *detailedDescription() const = 0; +}; + +class IMemberIterator +{ + public: + virtual IMember *toFirst() = 0; + virtual IMember *toLast() = 0; + virtual IMember *toNext() = 0; + virtual IMember *toPrev() = 0; + virtual IMember *current() const = 0; + virtual void release() = 0; +}; + +class ISection +{ + public: + virtual QString kind() const = 0; + virtual IMemberIterator *members() const = 0; +}; + +class ISectionIterator +{ + public: + virtual ISection *toFirst() = 0; + virtual ISection *toLast() = 0; + virtual ISection *toNext() = 0; + virtual ISection *toPrev() = 0; + virtual ISection *current() const = 0; + virtual void release() = 0; +}; + +class ICompound +{ + public: + virtual QString name() const = 0; + virtual QString id() const = 0; + virtual QString kind() const = 0; + virtual ISectionIterator *sections() const = 0; + virtual IDocRoot *briefDescription() const = 0; + virtual IDocRoot *detailedDescription() const = 0; +}; + +class ICompoundIterator +{ + public: + virtual ICompound *toFirst() = 0; + virtual ICompound *toLast() = 0; + virtual ICompound *toNext() = 0; + virtual ICompound *toPrev() = 0; + virtual ICompound *current() const = 0; + virtual void release() = 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 ICompoundIterator *compounds() 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 *compoundById(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 *compoundByName(const QString &name) const = 0; + + /*! Returns an interface to a member given its id. + * @param id The member id. + */ + virtual IMember *memberById(const QString &id) const = 0; + + /*! Returns a list of all members with a certain name. + * @param name The name of the member. + */ + virtual IMemberIterator *memberByName(const QString &name) const = 0; + + /*! Releases the memory for the object hierarchy obtained by + * createdObjecModelFromXML(). First release all iterators before calling + * this function. + */ + virtual void release() = 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/doxmlparser/src/Makefile.in b/addon/doxmlparser/src/Makefile.in new file mode 100644 index 0000000..049f969 --- /dev/null +++ b/addon/doxmlparser/src/Makefile.in @@ -0,0 +1,13 @@ +all clean depend: Makefile.doxmlparser + $(MAKE) -f Makefile.doxmlparser $@ + +distclean: clean + $(RM) -rf Makefile.doxmlparser doxmlparser.pro Makefile obj + +tmake: + $(ENV) $(PERL) $(TMAKE) doxmlparser.pro >Makefile.doxmlparser + +Makefile.doxmlparser: doxmlparser.pro + $(ENV) $(PERL) $(TMAKE) doxmlparser.pro >Makefile.doxmlparser + +install: diff --git a/addon/xmlparse/basehandler.h b/addon/doxmlparser/src/basehandler.h index 33b8831..d62cf74 100644 --- a/addon/xmlparse/basehandler.h +++ b/addon/doxmlparser/src/basehandler.h @@ -202,6 +202,9 @@ template<class T> class BaseHandler : public IBaseHandler, return TRUE; } + /*! called when a number of characters are received by the parser. + * \param ch the characters. + */ virtual bool characters ( const QString & ch ) { if (m_delegateHandler) diff --git a/addon/doxmlparser/src/baseiterator.h b/addon/doxmlparser/src/baseiterator.h new file mode 100644 index 0000000..52a4c4e --- /dev/null +++ b/addon/doxmlparser/src/baseiterator.h @@ -0,0 +1,35 @@ +/****************************************************************************** + * + * $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 BASEITERATOR_H +#define BASEITERATOR_H + +#include <qlist.h> +#include <doxmlintf.h> + +template<class Intf,class ElemIntf,class ElemImpl> class BaseIterator : + public Intf, public QListIterator<ElemImpl> +{ + public: + BaseIterator(const QList<ElemImpl> &list) : QListIterator<ElemImpl>(list) {} + virtual ~BaseIterator() {} + virtual ElemIntf *toFirst() { return QListIterator<ElemImpl>::toFirst(); } + virtual ElemIntf *toLast() { return QListIterator<ElemImpl>::toLast(); } + virtual ElemIntf *toNext() { return QListIterator<ElemImpl>::operator++(); } + virtual ElemIntf *toPrev() { return QListIterator<ElemImpl>::operator--(); } + virtual ElemIntf *current() const { return QListIterator<ElemImpl>::current(); } + virtual void release() { delete this; } +}; + +#endif diff --git a/addon/xmlparse/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index 0b420bf..0b420bf 100644 --- a/addon/xmlparse/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp diff --git a/addon/xmlparse/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 51508aa..99db5d8 100644 --- a/addon/xmlparse/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -18,15 +18,23 @@ #include <qstring.h> #include <qlist.h> #include <qxml.h> +#include <doxmlintf.h> #include "basehandler.h" +#include "baseiterator.h" #include "sectionhandler.h" -#include "doxmlintf.h" class MainHandler; class DocHandler; class ProgramListingHandler; +class CompoundIterator : public BaseIterator<ICompoundIterator,ICompound,ICompound> +{ + public: + CompoundIterator(const QList<ICompound> &list) : + BaseIterator<ICompoundIterator,ICompound,ICompound>(list) {} +}; + class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> { public: @@ -43,13 +51,19 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> CompoundHandler(IBaseHandler *parent); virtual ~CompoundHandler(); + void initialize(MainHandler *m); - // ICompound + // ICompound implementation 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); + ISectionIterator *sections() const + { return new SectionIterator(m_sections); } + virtual IDocRoot *briefDescription() const + { return m_brief; } + virtual IDocRoot *detailedDescription() const + { return m_detailed; } + private: struct SuperClass diff --git a/addon/xmlparse/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 80df132..3350cf4 100644 --- a/addon/xmlparse/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -58,8 +58,8 @@ static TypeNameMapper g_typeMapper; // MarkupHandler //---------------------------------------------------------------------- -MarkupHandler::MarkupHandler(QList<DocNode> &children,QString &curString) - : m_children(children), m_curString(curString), m_curMarkup(DocNode::Normal) +MarkupHandler::MarkupHandler(QList<IDoc> &children,QString &curString) + : m_children(children), m_curString(curString), m_curMarkup(IDocMarkup::Normal) { addStartHandler("bold",this,&MarkupHandler::startBold); addEndHandler("bold",this,&MarkupHandler::endBold); @@ -100,99 +100,99 @@ void MarkupHandler::addTextNode() void MarkupHandler::startBold(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Bold,TRUE)); - m_curMarkup |= DocNode::Bold; + m_children.append(new MarkupModifierNode(IDocMarkup::Bold,TRUE)); + m_curMarkup |= IDocMarkup::Bold; } void MarkupHandler::endBold() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Bold,FALSE)); - m_curMarkup &= ~DocNode::Bold; + m_children.append(new MarkupModifierNode(IDocMarkup::Bold,FALSE)); + m_curMarkup &= ~IDocMarkup::Bold; } void MarkupHandler::startEmphasis(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Emphasis,TRUE)); - m_curMarkup |= DocNode::Emphasis; + m_children.append(new MarkupModifierNode(IDocMarkup::Emphasis,TRUE)); + m_curMarkup |= IDocMarkup::Emphasis; } void MarkupHandler::endEmphasis() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Emphasis,FALSE)); - m_curMarkup &= ~DocNode::Emphasis; + m_children.append(new MarkupModifierNode(IDocMarkup::Emphasis,FALSE)); + m_curMarkup &= ~IDocMarkup::Emphasis; } void MarkupHandler::startComputerOutput(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,TRUE)); - m_curMarkup |= DocNode::ComputerOutput; + m_children.append(new MarkupModifierNode(IDocMarkup::ComputerOutput,TRUE)); + m_curMarkup |= IDocMarkup::ComputerOutput; } void MarkupHandler::endComputerOutput() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,FALSE)); - m_curMarkup &= ~DocNode::ComputerOutput; + m_children.append(new MarkupModifierNode(IDocMarkup::ComputerOutput,FALSE)); + m_curMarkup &= ~IDocMarkup::ComputerOutput; } void MarkupHandler::startCenter(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Center,TRUE)); - m_curMarkup |= DocNode::Center; + m_children.append(new MarkupModifierNode(IDocMarkup::Center,TRUE)); + m_curMarkup |= IDocMarkup::Center; } void MarkupHandler::endCenter() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Center,FALSE)); - m_curMarkup &= ~DocNode::Center; + m_children.append(new MarkupModifierNode(IDocMarkup::Center,FALSE)); + m_curMarkup &= ~IDocMarkup::Center; } void MarkupHandler::startSmallFont(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::SmallFont,TRUE)); - m_curMarkup |= DocNode::SmallFont; + m_children.append(new MarkupModifierNode(IDocMarkup::SmallFont,TRUE)); + m_curMarkup |= IDocMarkup::SmallFont; } void MarkupHandler::endSmallFont() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::SmallFont,FALSE)); - m_curMarkup &= ~DocNode::SmallFont; + m_children.append(new MarkupModifierNode(IDocMarkup::SmallFont,FALSE)); + m_curMarkup &= ~IDocMarkup::SmallFont; } void MarkupHandler::startSubscript(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Subscript,TRUE)); - m_curMarkup |= DocNode::Subscript; + m_children.append(new MarkupModifierNode(IDocMarkup::Subscript,TRUE)); + m_curMarkup |= IDocMarkup::Subscript; } void MarkupHandler::endSubscript() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Subscript,FALSE)); - m_curMarkup &= ~DocNode::Subscript; + m_children.append(new MarkupModifierNode(IDocMarkup::Subscript,FALSE)); + m_curMarkup &= ~IDocMarkup::Subscript; } void MarkupHandler::startSuperscript(const QXmlAttributes & /*attrib*/) { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Superscript,TRUE)); - m_curMarkup |= DocNode::Superscript; + m_children.append(new MarkupModifierNode(IDocMarkup::Superscript,TRUE)); + m_curMarkup |= IDocMarkup::Superscript; } void MarkupHandler::endSuperscript() { addTextNode(); - m_children.append(new MarkupModifierNode(DocNode::Superscript,FALSE)); - m_curMarkup &= ~DocNode::Superscript; + m_children.append(new MarkupModifierNode(IDocMarkup::Superscript,FALSE)); + m_curMarkup &= ~IDocMarkup::Superscript; } //---------------------------------------------------------------------- @@ -200,7 +200,7 @@ void MarkupHandler::endSuperscript() //---------------------------------------------------------------------- ListItemHandler::ListItemHandler(IBaseHandler *parent) - : DocNode(ListItem), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); @@ -236,8 +236,8 @@ void ListItemHandler::startParagraph(const QXmlAttributes& attrib) // ListHandler //---------------------------------------------------------------------- -ListHandler::ListHandler(NodeKind k,IBaseHandler *parent) - : DocNode(k), m_parent(parent) +ListHandler::ListHandler(Kind k,IBaseHandler *parent) + : m_parent(parent), m_kind(k) { m_children.setAutoDelete(TRUE); const char *endListName=0; @@ -277,7 +277,7 @@ void ListHandler::startListItem(const QXmlAttributes& attrib) // ParameterHandler //---------------------------------------------------------------------- -ParameterHandler::ParameterHandler(IBaseHandler *parent) : DocNode(Parameter), +ParameterHandler::ParameterHandler(IBaseHandler *parent) : m_parent(parent), m_description(0) { addEndHandler("parametername",this,&ParameterHandler::endParameterName); @@ -325,7 +325,7 @@ void ParameterHandler::startParagraph(const QXmlAttributes& attrib) //---------------------------------------------------------------------- ParameterListHandler::ParameterListHandler(IBaseHandler *parent) - : DocNode(ParameterList), m_parent(parent) + : m_parent(parent) { addEndHandler("parameterlist",this,&ParameterListHandler::endParameterList); addStartHandler("parametername",this,&ParameterListHandler::startParameterName); @@ -377,7 +377,7 @@ void ParameterListHandler::startParameterDescription(const QXmlAttributes& attri //---------------------------------------------------------------------- LinkHandler::LinkHandler(IBaseHandler *parent) - : DocNode(Link), m_parent(parent) + : m_parent(parent) { addEndHandler("link",this,&LinkHandler::endLink); } @@ -407,7 +407,7 @@ void LinkHandler::endLink() //---------------------------------------------------------------------- EMailHandler::EMailHandler(IBaseHandler *parent) - : DocNode(EMail), m_parent(parent) + : m_parent(parent) { addEndHandler("email",this,&EMailHandler::endEMail); } @@ -436,7 +436,7 @@ void EMailHandler::endEMail() //---------------------------------------------------------------------- ULinkHandler::ULinkHandler(IBaseHandler *parent) - : DocNode(ULink), m_parent(parent) + : m_parent(parent) { addEndHandler("ulink",this,&ULinkHandler::endULink); } @@ -466,7 +466,7 @@ void ULinkHandler::endULink() //---------------------------------------------------------------------- LineBreakHandler::LineBreakHandler(IBaseHandler *parent) - : DocNode(LineBreak), m_parent(parent) + : m_parent(parent) { addEndHandler("linebreak",this,&LineBreakHandler::endLineBreak); } @@ -492,7 +492,7 @@ void LineBreakHandler::endLineBreak() //---------------------------------------------------------------------- HRulerHandler::HRulerHandler(IBaseHandler *parent) - : DocNode(HRuler), m_parent(parent) + : m_parent(parent) { addEndHandler("hruler",this,&HRulerHandler::endHRuler); } @@ -518,7 +518,7 @@ void HRulerHandler::endHRuler() //---------------------------------------------------------------------- RefHandler::RefHandler(IBaseHandler *parent) - : DocNode(Ref), m_parent(parent) + : m_parent(parent) { addEndHandler("ref",this,&RefHandler::endRef); } @@ -549,7 +549,7 @@ void RefHandler::endRef() //---------------------------------------------------------------------- TitleHandler::TitleHandler(IBaseHandler *parent) - : DocNode(Title), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); m_markupHandler = new MarkupHandler(m_children,m_curString); @@ -595,12 +595,17 @@ void TitleHandler::startRef(const QXmlAttributes& attrib) m_children.append(ref); } +IDocIterator *TitleHandler::title() const +{ + return new TitleIterator(*this); +} + //---------------------------------------------------------------------- // SimpleSectHandler //---------------------------------------------------------------------- SimpleSectHandler::SimpleSectHandler(IBaseHandler *parent) - : DocNode(Para), m_parent(parent), m_paragraph(0), m_title(0) + : m_parent(parent), m_paragraph(0), m_title(0) { addStartHandler("title",this,&SimpleSectHandler::startTitle); addStartHandler("para",this,&SimpleSectHandler::startParagraph); @@ -643,7 +648,7 @@ void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib) //---------------------------------------------------------------------- VariableListEntryHandler::VariableListEntryHandler(IBaseHandler *parent) - : DocNode(VariableListEntry), m_parent(parent), m_description(0) + : m_parent(parent), m_description(0) { addStartHandler("term",this,&VariableListEntryHandler::startTerm); addEndHandler("term",this,&VariableListEntryHandler::endTerm); @@ -706,7 +711,7 @@ void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib) //---------------------------------------------------------------------- VariableListHandler::VariableListHandler(IBaseHandler *parent) - : DocNode(VariableList), m_parent(parent) + : m_parent(parent) { m_entries.setAutoDelete(TRUE); addStartHandler("varlistentry",this,&VariableListHandler::startVarListEntry); @@ -749,7 +754,7 @@ void VariableListHandler::startListItem(const QXmlAttributes& attrib) //---------------------------------------------------------------------- HighlightHandler::HighlightHandler(IBaseHandler *parent) - : DocNode(Highlight), m_parent(parent) + : m_parent(parent) { addEndHandler("highlight",this,&HighlightHandler::endHighlight); } @@ -777,7 +782,7 @@ void HighlightHandler::endHighlight() //---------------------------------------------------------------------- CodeLineHandler::CodeLineHandler(IBaseHandler *parent) - : DocNode(CodeLine), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); addEndHandler("codeline",this,&CodeLineHandler::endCodeLine); @@ -837,7 +842,7 @@ void CodeLineHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,DocNode::Normal)); + m_children.append(new TextNode(m_curString,IDocMarkup::Normal)); printf("addTextNode() text=\"%s\"\n", m_curString.data()); m_curString=""; @@ -849,7 +854,7 @@ void CodeLineHandler::addTextNode() //---------------------------------------------------------------------- ProgramListingHandler::ProgramListingHandler(IBaseHandler *parent) - : DocNode(ProgramListing), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); m_hasLineNumber=FALSE; @@ -905,7 +910,7 @@ void ProgramListingHandler::startCodeLine(const QXmlAttributes& attrib) //---------------------------------------------------------------------- FormulaHandler::FormulaHandler(IBaseHandler *parent) - : DocNode(Formula), m_parent(parent) + : m_parent(parent) { addEndHandler("formula",this,&FormulaHandler::endFormula); } @@ -933,7 +938,7 @@ void FormulaHandler::endFormula() //---------------------------------------------------------------------- ImageHandler::ImageHandler(IBaseHandler *parent) - : DocNode(Image), m_parent(parent) + : m_parent(parent) { addEndHandler("image",this,&ImageHandler::endImage); } @@ -961,7 +966,7 @@ void ImageHandler::endImage() //---------------------------------------------------------------------- DotFileHandler::DotFileHandler(IBaseHandler *parent) - : DocNode(DotFile), m_parent(parent) + : m_parent(parent) { addEndHandler("image",this,&DotFileHandler::endDotFile); } @@ -989,7 +994,7 @@ void DotFileHandler::endDotFile() //---------------------------------------------------------------------- IndexEntryHandler::IndexEntryHandler(IBaseHandler *parent) - : DocNode(IndexEntry), m_parent(parent) + : m_parent(parent) { addEndHandler("indexentry",this,&IndexEntryHandler::endIndexEntry); addStartHandler("primaryie",this,&IndexEntryHandler::startPrimaryIE); @@ -1040,7 +1045,7 @@ void IndexEntryHandler::endSecondaryIE() //---------------------------------------------------------------------- EntryHandler::EntryHandler(IBaseHandler *parent) - : DocNode(Entry), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); addEndHandler("entry",this,&EntryHandler::endEntry); @@ -1073,7 +1078,7 @@ void EntryHandler::startParagraph(const QXmlAttributes& attrib) //---------------------------------------------------------------------- RowHandler::RowHandler(IBaseHandler *parent) - : DocNode(Row), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); addEndHandler("row",this,&RowHandler::endRow); @@ -1106,7 +1111,7 @@ void RowHandler::startEntry(const QXmlAttributes& attrib) //---------------------------------------------------------------------- TableHandler::TableHandler(IBaseHandler *parent) - : DocNode(Table), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); addEndHandler("table",this,&TableHandler::endTable); @@ -1141,7 +1146,7 @@ void TableHandler::startRow(const QXmlAttributes& attrib) //---------------------------------------------------------------------- ParagraphHandler::ParagraphHandler(IBaseHandler *parent) - : DocNode(Para), m_parent(parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); @@ -1334,6 +1339,70 @@ void ParagraphHandler::addTextNode() } } +IDocIterator *ParagraphHandler::contents() const +{ + return new ParagraphIterator(*this); +} + +//---------------------------------------------------------------------- +// DocSectionHandler +//---------------------------------------------------------------------- + +DocSectionHandler::DocSectionHandler(IBaseHandler *parent,int level) + : m_parent(parent), m_level(level) +{ + m_children.setAutoDelete(TRUE); + m_markupHandler = new MarkupHandler(m_children,m_curString); + setFallBackHandler(m_markupHandler); + addStartHandler("ref",this,&DocSectionHandler::startRef); + QString sectionKey; + sectionKey.sprintf("sect%d",level); + addEndHandler(sectionKey,this,&DocSectionHandler::endDocSection); +} + +DocSectionHandler::~DocSectionHandler() +{ + delete m_markupHandler; +} + +void DocSectionHandler::startDocSection(const QXmlAttributes& attrib) +{ + m_parent->setDelegate(this); + printf("Start docsection\n"); + m_id = attrib.value("id"); + m_curString=""; +} + +void DocSectionHandler::endDocSection() +{ + addTextNode(); + m_parent->setDelegate(0); + printf("End docsection\n"); +} + +void DocSectionHandler::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 DocSectionHandler::startRef(const QXmlAttributes& attrib) +{ + RefHandler *ref = new RefHandler(this); + ref->startRef(attrib); + m_children.append(ref); +} + +IDocIterator *DocSectionHandler::title() const +{ + return new DocSectionIterator(*this); +} + //---------------------------------------------------------------------- // DocHandler //---------------------------------------------------------------------- @@ -1346,6 +1415,10 @@ DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) addEndHandler("detaileddescription",this,&DocHandler::endDoc); addStartHandler("para",this,&DocHandler::startParagraph); + addStartHandler("sect1",this,&DocHandler::startSect1); + addStartHandler("sect2",this,&DocHandler::startSect2); + addStartHandler("sect3",this,&DocHandler::startSect3); + addStartHandler("title",this,&DocHandler::startTitle); } DocHandler::~DocHandler() @@ -1371,3 +1444,36 @@ void DocHandler::startParagraph(const QXmlAttributes& attrib) m_children.append(parHandler); } +void DocHandler::startSect1(const QXmlAttributes& attrib) +{ + DocSectionHandler *secHandler = new DocSectionHandler(this,1); + secHandler->startDocSection(attrib); + m_children.append(secHandler); +} + +void DocHandler::startSect2(const QXmlAttributes& attrib) +{ + DocSectionHandler *secHandler = new DocSectionHandler(this,2); + secHandler->startDocSection(attrib); + m_children.append(secHandler); +} + +void DocHandler::startSect3(const QXmlAttributes& attrib) +{ + DocSectionHandler *secHandler = new DocSectionHandler(this,3); + secHandler->startDocSection(attrib); + m_children.append(secHandler); +} + +void DocHandler::startTitle(const QXmlAttributes& attrib) +{ + TitleHandler *titleHandler = new TitleHandler(this); + titleHandler->startTitle(attrib); + m_children.append(titleHandler); +} + +IDocIterator *DocHandler::contents() const +{ + return new DocIterator(*this); +} + diff --git a/addon/xmlparse/dochandler.h b/addon/doxmlparser/src/dochandler.h index 1c599ca..3425288 100644 --- a/addon/xmlparse/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -20,79 +20,29 @@ #include <qlist.h> #include <qxml.h> +#include <doxmlintf.h> #include "basehandler.h" +#include "baseiterator.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 +class TextNode : public IDocText { public: TextNode(const QString &t,int markup) - : DocNode(Text), m_text(t), m_markup(markup) {} + : m_text(t), m_markup(markup) {} + virtual ~TextNode() {} + + // IDocText + virtual Kind kind() const { return Text; } + virtual QString text() const { return m_text; } + virtual int markup() const { return m_markup; } private: QString m_text; @@ -104,12 +54,16 @@ class TextNode : public DocNode /*! \brief Node representing a change in the markup style. * */ -class MarkupModifierNode : public DocNode +class MarkupModifierNode : public IDocMarkupModifier { public: MarkupModifierNode(int markup,bool enabled) - : DocNode(MarkupModifier), m_markup(markup), m_enabled(enabled) {} + : m_markup(markup), m_enabled(enabled) {} + virtual ~MarkupModifierNode() {} + // IDocMarkupModifier + virtual Kind kind() const { return MarkupModifier; } + private: int m_markup; bool m_enabled; @@ -124,7 +78,7 @@ class MarkupModifierNode : public DocNode class MarkupHandler : public BaseFallBackHandler<MarkupHandler> { public: - MarkupHandler(QList<DocNode> &children,QString &curString); + MarkupHandler(QList<IDoc> &children,QString &curString); virtual ~MarkupHandler(); int markup() const { return m_curMarkup; } @@ -147,7 +101,7 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> private: void addTextNode(); - QList<DocNode> &m_children; + QList<IDoc> &m_children; QString &m_curString; int m_curMarkup; }; @@ -158,7 +112,7 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> /*! \brief Node representing a list item. * */ -class ListItemHandler : public DocNode, public BaseHandler<ListItemHandler> +class ListItemHandler : public IDocListItem, public BaseHandler<ListItemHandler> { public: ListItemHandler(IBaseHandler *parent); @@ -167,9 +121,12 @@ class ListItemHandler : public DocNode, public BaseHandler<ListItemHandler> virtual void endListItem(); virtual void startParagraph(const QXmlAttributes& attrib); + // IDocItem + virtual Kind kind() const { return ListItem; } + private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; }; @@ -178,18 +135,22 @@ class ListItemHandler : public DocNode, public BaseHandler<ListItemHandler> /*! \brief Node representing list of items. * */ -class ListHandler : public DocNode, public BaseHandler<ListHandler> +class ListHandler : public IDocList, public BaseHandler<ListHandler> { public: - ListHandler(NodeKind k,IBaseHandler *parent); + ListHandler(Kind k,IBaseHandler *parent); virtual ~ListHandler(); virtual void startList(const QXmlAttributes& attrib); virtual void endList(); virtual void startListItem(const QXmlAttributes& attrib); + // IDocList + virtual Kind kind() const { return m_kind; } + private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; + Kind m_kind; }; @@ -198,7 +159,7 @@ class ListHandler : public DocNode, public BaseHandler<ListHandler> /*! \brief Node representing a parameter. * */ -class ParameterHandler : public DocNode, +class ParameterHandler : public IDocParameter, public BaseHandler<ParameterHandler> { public: @@ -210,6 +171,9 @@ class ParameterHandler : public DocNode, virtual void endParameterDescription(); virtual void startParagraph(const QXmlAttributes& attrib); + // IDocParameter + virtual Kind kind() const { return Parameter; } + private: IBaseHandler *m_parent; QString m_name; @@ -222,7 +186,7 @@ class ParameterHandler : public DocNode, /* \brief Node representing a parameter list. * */ -class ParameterListHandler : public DocNode, +class ParameterListHandler : public IDocParameter, public BaseHandler<ParameterListHandler> { public: @@ -234,6 +198,9 @@ class ParameterListHandler : public DocNode, virtual void startParameterName(const QXmlAttributes& attrib); virtual void startParameterDescription(const QXmlAttributes& attrib); + // IDocParameterList + virtual Kind kind() const { return ParameterList; } + private: IBaseHandler *m_parent; QList<ParameterHandler> m_parameters; @@ -246,7 +213,7 @@ class ParameterListHandler : public DocNode, /* \brief Node representing a horizontal ruler * */ -class LineBreakHandler : public DocNode, public BaseHandler<LineBreakHandler> +class LineBreakHandler : public IDocLineBreak, public BaseHandler<LineBreakHandler> { public: LineBreakHandler(IBaseHandler *parent); @@ -255,6 +222,9 @@ class LineBreakHandler : public DocNode, public BaseHandler<LineBreakHandler> void startLineBreak(const QXmlAttributes& attrib); void endLineBreak(); + // IDocLineBreak + virtual Kind kind() const { return LineBreak; } + private: IBaseHandler *m_parent; }; @@ -264,7 +234,7 @@ class LineBreakHandler : public DocNode, public BaseHandler<LineBreakHandler> /* \brief Node representing a link to section * */ -class LinkHandler : public DocNode, public BaseHandler<LinkHandler> +class LinkHandler : public IDocLink, public BaseHandler<LinkHandler> { public: LinkHandler(IBaseHandler *parent); @@ -273,6 +243,9 @@ class LinkHandler : public DocNode, public BaseHandler<LinkHandler> void startLink(const QXmlAttributes& attrib); void endLink(); + // IDocLink + virtual Kind kind() const { return Link; } + private: IBaseHandler *m_parent; QString m_ref; @@ -285,7 +258,7 @@ class LinkHandler : public DocNode, public BaseHandler<LinkHandler> /* \brief Node representing a link to an email address * */ -class EMailHandler : public DocNode, public BaseHandler<EMailHandler> +class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler> { public: EMailHandler(IBaseHandler *parent); @@ -294,6 +267,9 @@ class EMailHandler : public DocNode, public BaseHandler<EMailHandler> void startEMail(const QXmlAttributes& attrib); void endEMail(); + // IDocEMail + virtual Kind kind() const { return EMail; } + private: IBaseHandler *m_parent; QString m_address; @@ -305,7 +281,7 @@ class EMailHandler : public DocNode, public BaseHandler<EMailHandler> /* \brief Node representing a link to an URL * */ -class ULinkHandler : public DocNode, public BaseHandler<ULinkHandler> +class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler> { public: ULinkHandler(IBaseHandler *parent); @@ -314,6 +290,9 @@ class ULinkHandler : public DocNode, public BaseHandler<ULinkHandler> void startULink(const QXmlAttributes& attrib); void endULink(); + // IDocULink + virtual Kind kind() const { return ULink; } + private: IBaseHandler *m_parent; QString m_url; @@ -325,7 +304,7 @@ class ULinkHandler : public DocNode, public BaseHandler<ULinkHandler> /* \brief Node representing a horizontal ruler * */ -class HRulerHandler : public DocNode, public BaseHandler<HRulerHandler> +class HRulerHandler : public IDocHRuler, public BaseHandler<HRulerHandler> { public: HRulerHandler(IBaseHandler *parent); @@ -334,6 +313,9 @@ class HRulerHandler : public DocNode, public BaseHandler<HRulerHandler> void startHRuler(const QXmlAttributes& attrib); void endHRuler(); + // IDocHRuler + virtual Kind kind() const { return HRuler; } + private: IBaseHandler *m_parent; }; @@ -343,13 +325,17 @@ class HRulerHandler : public DocNode, public BaseHandler<HRulerHandler> /* \brief Node representing a reference to another item * */ -class RefHandler : public DocNode, public BaseHandler<RefHandler> +class RefHandler : public IDocRef, public BaseHandler<RefHandler> { public: RefHandler(IBaseHandler *parent); virtual ~RefHandler(); void startRef(const QXmlAttributes& attrib); void endRef(); + + // IDocRef + virtual Kind kind() const { return Ref; } + private: IBaseHandler *m_parent; QString m_refId; @@ -366,8 +352,9 @@ class RefHandler : public DocNode, public BaseHandler<RefHandler> // children handled by MarkupHandler: // bold, computeroutput, emphasis, center, // small, subscript, superscript. -class TitleHandler : public DocNode, public BaseHandler<TitleHandler> +class TitleHandler : public IDocTitle, public BaseHandler<TitleHandler> { + friend class TitleIterator; public: TitleHandler(IBaseHandler *parent); virtual ~TitleHandler(); @@ -375,19 +362,31 @@ class TitleHandler : public DocNode, public BaseHandler<TitleHandler> virtual void endTitle(); virtual void startRef(const QXmlAttributes& attrib); void addTextNode(); + + // IDocTitle + virtual Kind kind() const { return Title; } + virtual IDocIterator *title() const; + private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; MarkupHandler *m_markupHandler; }; +class TitleIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + TitleIterator(const TitleHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /* \brief Node representing a simple section with an unnumbered header. * */ // children: title, para -class SimpleSectHandler : public DocNode, +class SimpleSectHandler : public IDocSimpleSect, public BaseHandler<SimpleSectHandler> { public: @@ -406,6 +405,9 @@ class SimpleSectHandler : public DocNode, virtual void startTitle(const QXmlAttributes& attrib); virtual void startParagraph(const QXmlAttributes& attrib); + // IDocSimpleSect + virtual Kind kind() const { return SimpleSect; } + private: IBaseHandler *m_parent; ParagraphHandler *m_paragraph; @@ -418,7 +420,7 @@ class SimpleSectHandler : public DocNode, /* \brief Node representing an named item of a VariableList. * */ -class VariableListEntryHandler : public DocNode, public BaseHandler<VariableListEntryHandler> +class VariableListEntryHandler : public IDocVariableListEntry, public BaseHandler<VariableListEntryHandler> { public: virtual void startVarListEntry(const QXmlAttributes& attrib); @@ -432,6 +434,9 @@ class VariableListEntryHandler : public DocNode, public BaseHandler<VariableList VariableListEntryHandler(IBaseHandler *parent); virtual ~VariableListEntryHandler(); + // IDocVariableListEntry + virtual Kind kind() const { return VariableListEntry; } + private: IBaseHandler *m_parent; QString m_term; @@ -444,7 +449,7 @@ class VariableListEntryHandler : public DocNode, public BaseHandler<VariableList * */ // children: varlistentry, listitem -class VariableListHandler : public DocNode, public BaseHandler<VariableListHandler> +class VariableListHandler : public IDocVariableList, public BaseHandler<VariableListHandler> { public: virtual void startVariableList(const QXmlAttributes& attrib); @@ -455,6 +460,9 @@ class VariableListHandler : public DocNode, public BaseHandler<VariableListHandl VariableListHandler(IBaseHandler *parent); virtual ~VariableListHandler(); + // IDocVariableList + virtual Kind kind() const { return VariableList; } + private: IBaseHandler *m_parent; QList<VariableListEntryHandler> m_entries; @@ -467,7 +475,7 @@ class VariableListHandler : public DocNode, public BaseHandler<VariableListHandl * */ // children: - -class HighlightHandler : public DocNode, public BaseHandler<HighlightHandler> +class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandler> { public: HighlightHandler(IBaseHandler *parent); @@ -475,6 +483,9 @@ class HighlightHandler : public DocNode, public BaseHandler<HighlightHandler> void startHighlight(const QXmlAttributes& attrib); void endHighlight(); + // IDocHighlight + virtual Kind kind() const { return Highlight; } + private: IBaseHandler *m_parent; QString m_class; @@ -487,7 +498,7 @@ class HighlightHandler : public DocNode, public BaseHandler<HighlightHandler> * */ // children: linenumber, highlight, anchor, ref -class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> +class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> { public: @@ -501,13 +512,16 @@ class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> CodeLineHandler(IBaseHandler *parent); virtual ~CodeLineHandler(); + // IDocCodeLine + virtual Kind kind() const { return CodeLine; } + private: void addTextNode(); IBaseHandler *m_parent; int m_lineNumber; QString m_refId; - QList<DocNode> m_children; + QList<IDoc> m_children; }; //----------------------------------------------------------------------------- @@ -516,7 +530,7 @@ class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> * */ // children: codeline, linenumber -class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingHandler> +class ProgramListingHandler : public IDocProgramListing, public BaseHandler<ProgramListingHandler> { public: virtual void startProgramListing(const QXmlAttributes& attrib); @@ -526,6 +540,10 @@ class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingH ProgramListingHandler(IBaseHandler *parent); virtual ~ProgramListingHandler(); + + // IDocProgramListing + virtual Kind kind() const { return ProgramListing; } + private: IBaseHandler *m_parent; QList<CodeLineHandler> m_children; @@ -538,7 +556,7 @@ class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingH * */ // children: - -class FormulaHandler : public DocNode, public BaseHandler<FormulaHandler> +class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler> { public: FormulaHandler(IBaseHandler *parent); @@ -546,6 +564,9 @@ class FormulaHandler : public DocNode, public BaseHandler<FormulaHandler> void startFormula(const QXmlAttributes& attrib); void endFormula(); + // IDocFormula + virtual Kind kind() const { return Formula; } + private: IBaseHandler *m_parent; QString m_id; @@ -558,7 +579,7 @@ class FormulaHandler : public DocNode, public BaseHandler<FormulaHandler> * */ // children: - -class ImageHandler : public DocNode, public BaseHandler<ImageHandler> +class ImageHandler : public IDocImage, public BaseHandler<ImageHandler> { public: ImageHandler(IBaseHandler *parent); @@ -566,6 +587,9 @@ class ImageHandler : public DocNode, public BaseHandler<ImageHandler> void startImage(const QXmlAttributes& attrib); void endImage(); + // IDocImage + virtual Kind kind() const { return Image; } + private: IBaseHandler *m_parent; QString m_name; @@ -578,7 +602,7 @@ class ImageHandler : public DocNode, public BaseHandler<ImageHandler> * */ // children: - -class DotFileHandler : public DocNode, public BaseHandler<DotFileHandler> +class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler> { public: DotFileHandler(IBaseHandler *parent); @@ -586,6 +610,9 @@ class DotFileHandler : public DocNode, public BaseHandler<DotFileHandler> void startDotFile(const QXmlAttributes& attrib); void endDotFile(); + // IDocDotFile + virtual Kind kind() const { return DotFile; } + private: IBaseHandler *m_parent; QString m_name; @@ -598,7 +625,7 @@ class DotFileHandler : public DocNode, public BaseHandler<DotFileHandler> * */ // children: - -class IndexEntryHandler : public DocNode, public BaseHandler<IndexEntryHandler> +class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHandler> { public: IndexEntryHandler(IBaseHandler *parent); @@ -610,6 +637,9 @@ class IndexEntryHandler : public DocNode, public BaseHandler<IndexEntryHandler> void startSecondaryIE(const QXmlAttributes& attrib); void endSecondaryIE(); + // IDocIndexEntry + virtual Kind kind() const { return IndexEntry; } + private: IBaseHandler *m_parent; QString m_primary; @@ -622,7 +652,7 @@ class IndexEntryHandler : public DocNode, public BaseHandler<IndexEntryHandler> * */ // children: para -class EntryHandler : public DocNode, public BaseHandler<EntryHandler> +class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> { public: EntryHandler(IBaseHandler *parent); @@ -631,9 +661,12 @@ class EntryHandler : public DocNode, public BaseHandler<EntryHandler> void endEntry(); void startParagraph(const QXmlAttributes& attrib); + // IDocEntry + virtual Kind kind() const { return Entry; } + private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; }; //----------------------------------------------------------------------------- @@ -642,7 +675,7 @@ class EntryHandler : public DocNode, public BaseHandler<EntryHandler> * */ // children: entry -class RowHandler : public DocNode, public BaseHandler<RowHandler> +class RowHandler : public IDocRow, public BaseHandler<RowHandler> { public: RowHandler(IBaseHandler *parent); @@ -651,6 +684,9 @@ class RowHandler : public DocNode, public BaseHandler<RowHandler> void endRow(); void startEntry(const QXmlAttributes& attrib); + // IDocRow + virtual Kind kind() const { return Row; } + private: IBaseHandler *m_parent; QList<EntryHandler> m_children; @@ -662,7 +698,7 @@ class RowHandler : public DocNode, public BaseHandler<RowHandler> * */ // children: row -class TableHandler : public DocNode, public BaseHandler<TableHandler> +class TableHandler : public IDocTable, public BaseHandler<TableHandler> { public: TableHandler(IBaseHandler *parent); @@ -671,6 +707,9 @@ class TableHandler : public DocNode, public BaseHandler<TableHandler> void endTable(); void startRow(const QXmlAttributes& attrib); + // IDocTable + virtual Kind kind() const { return Table; } + private: IBaseHandler *m_parent; QList<RowHandler> m_children; @@ -691,8 +730,11 @@ class TableHandler : public DocNode, public BaseHandler<TableHandler> // bold, computeroutput, emphasis, center, // small, subscript, superscript. // -class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> +class ParagraphHandler : public IDocPara, + public BaseHandler<ParagraphHandler> { + friend class ParagraphIterator; + public: virtual void startParagraph(const QXmlAttributes& attrib); virtual void endParagraph(); @@ -717,33 +759,101 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> ParagraphHandler(IBaseHandler *parent); virtual ~ParagraphHandler(); + // IDocPara + virtual Kind kind() const { return Para; } + virtual IDocIterator *contents() const; + private: void addTextNode(); IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; MarkupHandler *m_markupHandler; }; +class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + ParagraphIterator(const ParagraphHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + + +//----------------------------------------------------------------------------- + +/*! \brief Node representing a section. + * + */ +// children: text, ref +// children handled by MarkupHandler: +// bold, computeroutput, emphasis, center, +// small, subscript, superscript. +class DocSectionHandler : public IDocSection, public BaseHandler<DocSectionHandler> +{ + friend class DocSectionIterator; + public: + DocSectionHandler(IBaseHandler *parent,int level); + virtual ~DocSectionHandler(); + virtual void startDocSection(const QXmlAttributes& attrib); + virtual void endDocSection(); + virtual void startRef(const QXmlAttributes& attrib); + void addTextNode(); + + // IDocSection + virtual Kind kind() const { return Section; } + virtual QString id() const { return m_id; } + virtual int level() const { return m_level; } + virtual IDocIterator *title() const; + + private: + IBaseHandler *m_parent; + QList<IDoc> m_children; + MarkupHandler *m_markupHandler; + QString m_id; + int m_level; +}; + +class DocSectionIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + DocSectionIterator(const DocSectionHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /*! \brief Node representing a documentation block. * */ -// children: para -// TODO: title, sect1, sect2, sect3 -class DocHandler : public BaseHandler<DocHandler> +// children: para, title, sect1, sect2, sect3 +class DocHandler : public IDocRoot, public BaseHandler<DocHandler> { + friend class DocIterator; public: virtual void startDoc(const QXmlAttributes& attrib); virtual void endDoc(); virtual void startParagraph(const QXmlAttributes& attrib); + virtual void startSect1(const QXmlAttributes& attrib); + virtual void startSect2(const QXmlAttributes& attrib); + virtual void startSect3(const QXmlAttributes& attrib); + virtual void startTitle(const QXmlAttributes& attrib); DocHandler(IBaseHandler *parent); virtual ~DocHandler(); + // IDocRoot + virtual Kind kind() const { return Root; } + virtual IDocIterator *contents() const; + private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<IDoc> m_children; +}; + +class DocIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + DocIterator(const DocHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} }; #endif diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h new file mode 100644 index 0000000..ec2950c --- /dev/null +++ b/addon/doxmlparser/src/doxmlintf.h @@ -0,0 +1,422 @@ +#ifndef _DOXMLINTF_H +#define _DOXMLINTF_H + +#include <qstring.h> + +class IMember; +class IDocIterator; + +class ILinkedText +{ + public: + enum Kind { Kind_Text, Kind_Ref }; + virtual Kind kind() const = 0; +}; + +class ILT_Text : public ILinkedText +{ + public: + virtual QString text() const = 0; +}; + +class ILT_Ref : public ILinkedText +{ + public: + virtual QString id() const = 0; + virtual QString external() const = 0; + virtual QString text() const = 0; +}; + +class ILinkedTextIterator +{ + public: + virtual ILinkedText *toFirst() = 0; + virtual ILinkedText *toLast() = 0; + virtual ILinkedText *toNext() = 0; + virtual ILinkedText *toPrev() = 0; + virtual ILinkedText *current() const = 0; + virtual void release() = 0; +}; + +class IParam +{ + public: + virtual ILinkedTextIterator *type() const = 0; + virtual QString declarationName() const = 0; + virtual QString definitionName() const = 0; + virtual QString attrib() const = 0; + virtual QString arraySpecifier() const = 0; + virtual ILinkedTextIterator *defaultValue() const = 0; +}; + +class IParamIterator +{ + public: + virtual IParam *toFirst() = 0; + virtual IParam *toLast() = 0; + virtual IParam *toNext() = 0; + virtual IParam *toPrev() = 0; + virtual IParam *current() const = 0; + virtual void release() = 0; +}; + +class IMemberReference +{ + public: + virtual IMember *member() const = 0; + virtual QString memberName() const = 0; +}; + +class IMemberReferenceIterator +{ + public: + virtual IMemberReference *toFirst() = 0; + virtual IMemberReference *toLast() = 0; + virtual IMemberReference *toNext() = 0; + virtual IMemberReference *toPrev() = 0; + virtual IMemberReference *current() const = 0; + virtual void release() = 0; +}; + +class IEnumValue +{ + public: + virtual QString name() const = 0; + virtual QString initializer() const = 0; +}; + +class IEnumValueIterator +{ + public: + virtual IEnumValue *toFirst() = 0; + virtual IEnumValue *toLast() = 0; + virtual IEnumValue *toNext() = 0; + virtual IEnumValue *toPrev() = 0; + virtual IEnumValue *current() const = 0; + virtual void release() = 0; +}; + +class IDoc +{ + public: + enum Kind + { + Para, // 0 -> IDocPara + Text, // 1 -> IDocText + MarkupModifier, // 2 -> IDocMarkupModifier + ItemizedList, // 3 -> IDocList + OrderedList, // 4 -> IDocList + ListItem, // 5 -> IDocListItem + ParameterList, // 6 -> IDocParameterList + Parameter, // 7 -> IDocParameter + SimpleSect, // 8 -> IDocSimpleSect + Title, // 9 -> IDocTitle + Ref, // 10 -> IDocRef + VariableList, // 11 -> IDocVariableList + VariableListEntry, // 12 -> IDocVariableListEntry + HRuler, // 13 -> IDocHRuler + LineBreak, // 14 -> IDocLineBreak + ULink, // 15 -> IDocULink + EMail, // 16 -> IDocEMail + Link, // 17 -> IDocLink + ProgramListing, // 18 -> IDocProgramListing + CodeLine, // 19 -> IDocCodeLine + Highlight, // 20 -> IDocHighlight + Anchor, // 21 -> IDocAnchor + Formula, // 22 -> IDocFormula + Image, // 23 -> IDocImage + DotFile, // 24 -> IDocDotFile + IndexEntry, // 25 -> IDocIndexEntry + Table, // 26 -> IDocTable + Row, // 27 -> IDocRow + Entry, // 28 -> IDocEntry + Section, // 29 -> IDocSection + Root // 30 -> IDocRoot + }; + virtual Kind kind() const = 0; +}; + +class IDocMarkup : public IDoc +{ + public: + enum Markup + { + Normal = 0x00, + Bold = 0x01, + Emphasis = 0x02, + ComputerOutput = 0x04, + Subscript = 0x08, + Superscript = 0x10, + SmallFont = 0x20, + Center = 0x40 + }; + +}; + +class IDocPara : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocText : public IDocMarkup +{ + public: + virtual QString text() const = 0; + virtual int markup() const = 0; +}; + +class IDocMarkupModifier : public IDoc +{ +}; + +class IDocList : public IDoc +{ +}; + +class IDocListItem : public IDoc +{ +}; + +class IDocParameterList : public IDoc +{ +}; + +class IDocParameter : public IDoc +{ +}; + +class IDocSimpleSect : public IDoc +{ +}; + +class IDocTitle : public IDoc +{ + public: + virtual IDocIterator *title() const = 0; +}; + +class IDocRef : public IDoc +{ +}; + +class IDocVariableList : public IDoc +{ +}; + +class IDocVariableListEntry : public IDoc +{ +}; + +class IDocHRuler : public IDoc +{ +}; + +class IDocLineBreak : public IDoc +{ +}; + +class IDocULink : public IDoc +{ +}; + +class IDocEMail : public IDoc +{ +}; + +class IDocLink : public IDoc +{ +}; + +class IDocProgramListing : public IDoc +{ +}; + +class IDocCodeLine : public IDoc +{ +}; + +class IDocHighlight : public IDoc +{ +}; + +class IDocAnchor : public IDoc +{ +}; + +class IDocFormula : public IDoc +{ +}; + +class IDocImage : public IDoc +{ +}; + +class IDocDotFile : public IDoc +{ +}; + +class IDocIndexEntry : public IDoc +{ +}; + +class IDocTable : public IDoc +{ +}; + +class IDocRow : public IDoc +{ +}; + +class IDocEntry : public IDoc +{ +}; + +class IDocSection : public IDoc +{ + public: + virtual QString id() const = 0; + virtual int level() const = 0; + virtual IDocIterator *title() const = 0; +}; + +class IDocRoot : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocIterator +{ + public: + virtual IDoc *toFirst() = 0; + virtual IDoc *toLast() = 0; + virtual IDoc *toNext() = 0; + virtual IDoc *toPrev() = 0; + virtual IDoc *current() const = 0; + virtual void release() = 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 ILinkedTextIterator *type() const = 0; + virtual QString name() const = 0; + virtual bool isConst() const = 0; + virtual bool isVolatile() const = 0; + virtual IParamIterator *params() const = 0; + virtual ILinkedTextIterator *initializer() const = 0; + virtual ILinkedTextIterator *exceptions() const = 0; + virtual IMemberReferenceIterator *references() const = 0; + virtual IMemberReferenceIterator *referencedBy() const = 0; + virtual int bodyStart() const = 0; + virtual int bodyEnd() const = 0; + virtual QString definitionFile() const = 0; + virtual int definitionLine() const = 0; + virtual IMemberReference *reimplements() const = 0; + virtual IMemberReferenceIterator *reimplementedBy() const = 0; + virtual IEnumValueIterator *enumValues() const = 0; + virtual IDocRoot *briefDescription() const = 0; + virtual IDocRoot *detailedDescription() const = 0; +}; + +class IMemberIterator +{ + public: + virtual IMember *toFirst() = 0; + virtual IMember *toLast() = 0; + virtual IMember *toNext() = 0; + virtual IMember *toPrev() = 0; + virtual IMember *current() const = 0; + virtual void release() = 0; +}; + +class ISection +{ + public: + virtual QString kind() const = 0; + virtual IMemberIterator *members() const = 0; +}; + +class ISectionIterator +{ + public: + virtual ISection *toFirst() = 0; + virtual ISection *toLast() = 0; + virtual ISection *toNext() = 0; + virtual ISection *toPrev() = 0; + virtual ISection *current() const = 0; + virtual void release() = 0; +}; + +class ICompound +{ + public: + virtual QString name() const = 0; + virtual QString id() const = 0; + virtual QString kind() const = 0; + virtual ISectionIterator *sections() const = 0; + virtual IDocRoot *briefDescription() const = 0; + virtual IDocRoot *detailedDescription() const = 0; +}; + +class ICompoundIterator +{ + public: + virtual ICompound *toFirst() = 0; + virtual ICompound *toLast() = 0; + virtual ICompound *toNext() = 0; + virtual ICompound *toPrev() = 0; + virtual ICompound *current() const = 0; + virtual void release() = 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 ICompoundIterator *compounds() 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 *compoundById(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 *compoundByName(const QString &name) const = 0; + + /*! Returns an interface to a member given its id. + * @param id The member id. + */ + virtual IMember *memberById(const QString &id) const = 0; + + /*! Returns a list of all members with a certain name. + * @param name The name of the member. + */ + virtual IMemberIterator *memberByName(const QString &name) const = 0; + + /*! Releases the memory for the object hierarchy obtained by + * createdObjecModelFromXML(). First release all iterators before calling + * this function. + */ + virtual void release() = 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/doxmlparser/src/doxmlparser.pro.in b/addon/doxmlparser/src/doxmlparser.pro.in new file mode 100644 index 0000000..7724b47 --- /dev/null +++ b/addon/doxmlparser/src/doxmlparser.pro.in @@ -0,0 +1,23 @@ +TEMPLATE = lib.t +CONFIG = console staticlib warn_on $extraopts +HEADERS = basehandler.h mainhandler.h \ + compoundhandler.h sectionhandler.h \ + memberhandler.h paramhandler.h \ + dochandler.h linkedtexthandler.h +SOURCES = mainhandler.cpp \ + compoundhandler.cpp sectionhandler.cpp \ + memberhandler.cpp paramhandler.cpp \ + dochandler.cpp linkedtexthandler.cpp +unix:LIBS += -L../../../lib -lqtools +win32:INCLUDEPATH += . +win32-mingw:LIBS += -L../../../lib -lqtools +win32-msvc:LIBS += qtools.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 +DESTDIR = ../lib +OBJECTS_DIR = ../objects +TARGET = doxmlparser +INCLUDEPATH += ../../../qtools ../include + diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp new file mode 100644 index 0000000..b142188 --- /dev/null +++ b/addon/doxmlparser/src/linkedtexthandler.cpp @@ -0,0 +1,107 @@ +/****************************************************************************** + * + * $Id$ + * + * + * Copyright (C) 1997-2001 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ +#include "linkedtexthandler.h" +#include <doxmlintf.h> + +class LT_Text : public ILT_Text +{ + public: + LT_Text(const QString &text) : m_text(text) {} + virtual ~LT_Text() {} + + // ILT_Text + virtual QString text() const { return m_text; } + virtual Kind kind() const { return Kind_Text; } + private: + QString m_text; +}; + +class LT_Ref : public ILT_Ref +{ + public: + LT_Ref() {} + virtual ~LT_Ref() {} + void setRefId(const QString &refId) { m_refId=refId; } + void setText(const QString &text) { m_text=text; } + void setExtId(const QString &extId) { m_extId=extId; } + + // ILT_Ref + virtual QString text() const { return m_text; } + virtual QString id() const { return m_refId; } + virtual QString external() const { return m_extId; } + virtual Kind kind() const { return Kind_Ref; } + + private: + QString m_refId; + QString m_extId; + QString m_text; +}; + +LinkedTextHandler::LinkedTextHandler(IBaseHandler *parent, + QList<ILinkedText> &children + ) + : m_parent(parent), m_children(children) +{ + addStartHandler("ref",this,&LinkedTextHandler::startRef); + addEndHandler("ref",this,&LinkedTextHandler::endRef); + m_children.setAutoDelete(TRUE); + m_ref=0; +} + +LinkedTextHandler::~LinkedTextHandler() +{ +} + +void LinkedTextHandler::start(const char *endTag) +{ + addEndHandler(endTag,this,&LinkedTextHandler::end); + m_parent->setDelegate(this); + m_curString=""; +} + +void LinkedTextHandler::end() +{ + if (!m_curString.isEmpty()) + { + m_children.append(new LT_Text(m_curString)); + printf("LinkedTextHandler: add text `%s'\n",m_curString.data()); + m_curString=""; + } + m_parent->setDelegate(0); +} + +void LinkedTextHandler::startRef(const QXmlAttributes& attrib) +{ + if (!m_curString.isEmpty()) + { + m_children.append(new LT_Text(m_curString)); + printf("LinkedTextHandler: add text `%s'\n",m_curString.data()); + m_curString=""; + } + ASSERT(m_ref==0); + m_ref = new LT_Ref; + m_ref->setRefId(attrib.value("idref")); + m_ref->setExtId(attrib.value("external")); +} + +void LinkedTextHandler::endRef() +{ + m_ref->setText(m_curString); + m_children.append(m_ref); + printf("LinkedTextHandler: add ref `%s'\n",m_ref->text().data()); + m_ref=0; +} + + diff --git a/addon/doxmlparser/src/linkedtexthandler.h b/addon/doxmlparser/src/linkedtexthandler.h new file mode 100644 index 0000000..0569b00 --- /dev/null +++ b/addon/doxmlparser/src/linkedtexthandler.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * + * $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 LINKEDTEXTHANDLER_H +#define LINKEDTEXTHANDLER_H + +#include "baseiterator.h" +#include "basehandler.h" + +class LT_Ref; + +class LinkedTextIterator : public BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText> +{ + public: + LinkedTextIterator(const QList<ILinkedText> &list) : + BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText>(list) {} +}; + +class LinkedTextHandler : public BaseHandler<LinkedTextHandler> +{ + public: + LinkedTextHandler(IBaseHandler *parent,QList<ILinkedText> &children); + virtual ~LinkedTextHandler(); + virtual void start(const char *endTag); + virtual void end(); + virtual void startRef(const QXmlAttributes& attrib); + virtual void endRef(); + + private: + IBaseHandler *m_parent; + QList<ILinkedText> &m_children; + LT_Ref *m_ref; +}; + +#endif diff --git a/addon/xmlparse/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index c32426f..7d0e682 100644 --- a/addon/xmlparse/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -118,7 +118,9 @@ IDoxygen *createObjectModelFromXML(const char * xmlFileName) reader.setContentHandler( handler ); reader.setErrorHandler( &errorHandler ); reader.parse( source ); + printf("<---------- initialize ----------->\n"); handler->initialize(); + printf("<-------- end initialize --------->\n"); return handler; } diff --git a/addon/xmlparse/mainhandler.h b/addon/doxmlparser/src/mainhandler.h index c5f945f..e466b6f 100644 --- a/addon/xmlparse/mainhandler.h +++ b/addon/doxmlparser/src/mainhandler.h @@ -19,7 +19,8 @@ #include <qlist.h> #include "basehandler.h" #include "compoundhandler.h" -#include "doxmlintf.h" +#include <doxmlintf.h> +#include "memberhandler.h" class MainHandler : public IDoxygen, public BaseHandler<MainHandler> { @@ -28,26 +29,29 @@ class MainHandler : public IDoxygen, public BaseHandler<MainHandler> MainHandler(); virtual ~MainHandler(); - QListIterator<ICompound> getCompoundIterator() const + ICompoundIterator *compounds() const { - return m_compounds; + return new CompoundIterator(m_compounds); } - ICompound *getCompoundById(const QString &id) const + ICompound *compoundById(const QString &id) const { return m_compoundDict[id]; } - virtual ICompound *getCompoundByName(const QString &name) const + virtual ICompound *compoundByName(const QString &name) const { return name.isEmpty() ? 0 : m_compoundNameDict[name]; } - virtual IMember *getMemberById(const QString &id) const + virtual IMember *memberById(const QString &id) const { return m_memberDict[id]; } - virtual QList<IMember> *getMemberByName(const QString &name) const + virtual IMemberIterator *memberByName(const QString &name) const { - return m_memberNameDict[name]; + QList<IMember> *ml = m_memberNameDict[name]; + if (ml==0) return 0; + return new MemberIterator(*ml); } + virtual void release() { delete this; } void insertMemberById(const QString &id,IMember *h); void insertMemberByName(const QString &name,IMember *h); diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp new file mode 100644 index 0000000..f211f8e --- /dev/null +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -0,0 +1,299 @@ +/****************************************************************************** + * + * $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" +#include "linkedtexthandler.h" + +//------------------------------------------------------------------------------ + +void MemberReference::initialize(MainHandler *mh) +{ + m_mainHandler = mh; +} + +IMember *MemberReference::member() const +{ + return m_mainHandler->memberById(m_memId); +} + +//------------------------------------------------------------------------------ + + +EnumValueHandler::EnumValueHandler(IBaseHandler *parent) : m_parent(parent) +{ + addEndHandler("enumvalue",this,&EnumValueHandler::endEnumValue); + + addStartHandler("name",this,&EnumValueHandler::startName); + addEndHandler("name",this,&EnumValueHandler::endName); + addStartHandler("initializer",this,&EnumValueHandler::startInitializer); + addEndHandler("initializer",this,&EnumValueHandler::endInitializer); +} + +void EnumValueHandler::startEnumValue(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); +} + +void EnumValueHandler::endEnumValue() +{ + m_parent->setDelegate(0); +} + +void EnumValueHandler::startName(const QXmlAttributes& /*attrib*/) +{ + m_curString=""; +} + +void EnumValueHandler::endName() +{ + m_name = m_curString; +} + +void EnumValueHandler::startInitializer(const QXmlAttributes& /*attrib*/) +{ + m_curString=""; +} + +void EnumValueHandler::endInitializer() +{ + m_initializer = m_curString; +} + +//------------------------------------------------------------------------------ + +MemberHandler::MemberHandler(IBaseHandler *parent) + : m_parent(parent), m_brief(0), m_detailed(0) +{ + addEndHandler("memberdef",this,&MemberHandler::endMember); + + addStartHandler("type",this,&MemberHandler::startType); + addStartHandler("initializer",this,&MemberHandler::startInitializer); + addStartHandler("exception",this,&MemberHandler::startException); + addStartHandler("enumvalue",this,&MemberHandler::startEnumValue); + + addStartHandler("name"); + addEndHandler("name",this,&MemberHandler::endName); + + addStartHandler("param",this,&MemberHandler::startParam); + + addStartHandler("briefdescription",this,&MemberHandler::startBriefDesc); + + addStartHandler("detaileddescription",this,&MemberHandler::startDetailedDesc); + + addStartHandler("references",this,&MemberHandler::startReferences); + addEndHandler("references",this,&MemberHandler::endReferences); + + addStartHandler("referencedby",this,&MemberHandler::startReferencedBy); + addEndHandler("referencedby",this,&MemberHandler::endReferencedBy); + + addStartHandler("reimplements",this,&MemberHandler::startReimplements); + addEndHandler("reimplements",this,&MemberHandler::endReimplements); + + addStartHandler("reimplementedby",this,&MemberHandler::startReimplementedBy); + addEndHandler("reimplementedby",this,&MemberHandler::endReimplementedBy); + + addStartHandler("location",this,&MemberHandler::startLocation); + addEndHandler("location"); + + m_params.setAutoDelete(TRUE); + m_references.setAutoDelete(TRUE); + m_referencedBy.setAutoDelete(TRUE); + m_reimplements = 0; + m_reimplementedBy.setAutoDelete(TRUE); + m_enumValues.setAutoDelete(TRUE); + m_linkedTextHandler = 0; + m_defLine=0; + m_bodyStart=0; + m_bodyEnd=0; +} + +MemberHandler::~MemberHandler() +{ + delete m_brief; + delete m_detailed; + delete m_linkedTextHandler; +} + +void MemberHandler::startMember(const QXmlAttributes& attrib) +{ + m_parent->setDelegate(this); + m_kind = attrib.value("kind"); + m_id = attrib.value("id"); + m_virtualness = attrib.value("virt"); + m_protection = attrib.value("prot"); + m_isConst = attrib.value("const")=="yes"; + m_isVolatile = attrib.value("volatile")=="yes"; + 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"); + QCString s; + s = attrib.value("line"); + if (!s.isEmpty()) m_defLine=s.toInt(); + s = attrib.value("bodystart"); + if (!s.isEmpty()) m_bodyStart=s.toInt(); + s = attrib.value("bodyend"); + if (!s.isEmpty()) m_bodyEnd=s.toInt(); +} + +void MemberHandler::startReferences(const QXmlAttributes& attrib) +{ + MemberReference *mr = new MemberReference; + mr->m_memId = attrib.value("id"); + 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"); + m_referencedBy.append(mr); + m_curString=""; +} + +void MemberHandler::endReferencedBy() +{ + m_referencedBy.getLast()->m_name = m_curString; +} + +void MemberHandler::startReimplements(const QXmlAttributes& attrib) +{ + m_reimplements = new MemberReference; + m_reimplements->m_memId = attrib.value("id"); + m_curString=""; +} + +void MemberHandler::endReimplements() +{ + m_reimplements->m_name = m_curString; +} + +void MemberHandler::startReimplementedBy(const QXmlAttributes& attrib) +{ + MemberReference *mr = new MemberReference; + mr->m_memId = attrib.value("id"); + m_reimplementedBy.append(mr); + m_curString=""; +} + +void MemberHandler::endReimplementedBy() +{ + m_reimplementedBy.getLast()->m_name = m_curString; +} + +void MemberHandler::endMember() +{ + m_parent->setDelegate(0); +} + +void MemberHandler::startType(const QXmlAttributes &) +{ + printf("startType!\n"); + delete m_linkedTextHandler; + m_linkedTextHandler = new LinkedTextHandler(this,m_type); + m_linkedTextHandler->start("type"); +} + +void MemberHandler::startInitializer(const QXmlAttributes &) +{ + printf("startInitializer!\n"); + delete m_linkedTextHandler; + m_linkedTextHandler = new LinkedTextHandler(this,m_initializer); + m_linkedTextHandler->start("initializer"); +} + +void MemberHandler::startException(const QXmlAttributes &) +{ + printf("startException!\n"); + delete m_linkedTextHandler; + m_linkedTextHandler = new LinkedTextHandler(this,m_exception); + m_linkedTextHandler->start("exception"); +} + +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::startEnumValue(const QXmlAttributes& attrib) +{ + EnumValueHandler *evh = new EnumValueHandler(this); + evh->startEnumValue(attrib); + m_enumValues.append(evh); +} + +void MemberHandler::initialize(MainHandler *mh) +{ + { + QListIterator<MemberReference> mli(m_references); + MemberReference *mr; + for (;(mr=mli.current());++mli) + { + mr->initialize(mh); + } + } + { + QListIterator<MemberReference> mli(m_referencedBy); + MemberReference *mr; + for (;(mr=mli.current());++mli) + { + mr->initialize(mh); + } + } + { + QListIterator<MemberReference> mli(m_reimplementedBy); + MemberReference *mr; + for (;(mr=mli.current());++mli) + { + mr->initialize(mh); + } + } + if (m_reimplements) m_reimplements->initialize(mh); +} + diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h new file mode 100644 index 0000000..b599e2f --- /dev/null +++ b/addon/doxmlparser/src/memberhandler.h @@ -0,0 +1,193 @@ +/****************************************************************************** + * + * $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 <doxmlintf.h> + +#include "basehandler.h" +#include "baseiterator.h" +#include "paramhandler.h" +#include "linkedtexthandler.h" +#include "dochandler.h" + +class MainHandler; + +struct MemberReference : public IMemberReference +{ + virtual ~MemberReference() {} + virtual IMember *member() const; + virtual QString memberName() const { return m_name; } + void initialize(MainHandler *m); + + QString m_memId; + QString m_name; + MainHandler *m_mainHandler; +}; + +class MemberReferenceIterator : public BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference> +{ + public: + MemberReferenceIterator(const QList<MemberReference> &list) : + BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>(list) {} +}; + +class MemberIterator : public BaseIterator<IMemberIterator,IMember,IMember> +{ + public: + MemberIterator(const QList<IMember> &list) : + BaseIterator<IMemberIterator,IMember,IMember>(list) {} +}; + +class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler> +{ + public: + virtual void startName(const QXmlAttributes& attrib); + virtual void endName(); + virtual void startInitializer(const QXmlAttributes& attrib); + virtual void endInitializer(); + virtual void startEnumValue(const QXmlAttributes& attrib); + virtual void endEnumValue(); + + // IEnumValue + virtual QString name() const { return m_name; } + virtual QString initializer() const { return m_initializer; } + + void setName(const QString &name) { m_name=name; } + void setInitializer(const QString &init) { m_initializer=init; } + + virtual ~EnumValueHandler() {} + EnumValueHandler(IBaseHandler *parent); + + private: + QString m_name; + QString m_initializer; + IBaseHandler *m_parent; +}; + +class EnumValueIterator : public BaseIterator<IEnumValueIterator,IEnumValue,EnumValueHandler> +{ + public: + EnumValueIterator(const QList<EnumValueHandler> &list) : + BaseIterator<IEnumValueIterator,IEnumValue,EnumValueHandler>(list) {} +}; + + +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 startType(const QXmlAttributes& attrib); + 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(); + virtual void startReimplements(const QXmlAttributes& attrib); + virtual void endReimplements(); + virtual void startReimplementedBy(const QXmlAttributes& attrib); + virtual void endReimplementedBy(); + virtual void startInitializer(const QXmlAttributes& attrib); + virtual void startException(const QXmlAttributes& attrib); + virtual void startEnumValue(const QXmlAttributes& attrib); + + MemberHandler(IBaseHandler *parent); + virtual ~MemberHandler(); + + // IMember implementation + 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 name() const + { return m_name; } + virtual bool isConst() const + { return m_isConst; } + virtual bool isVolatile() const + { return m_isVolatile; } + virtual ILinkedTextIterator *type() const + { return new LinkedTextIterator(m_type); } + virtual IParamIterator *params() const + { return new ParamIterator(m_params); } + virtual IMemberReferenceIterator *references() const + { return new MemberReferenceIterator(m_references); } + virtual IMemberReferenceIterator *referencedBy() const + { return new MemberReferenceIterator(m_referencedBy); } + virtual ILinkedTextIterator *initializer() const + { return new LinkedTextIterator(m_initializer); } + virtual ILinkedTextIterator *exceptions() const + { return new LinkedTextIterator(m_exception); } + virtual int bodyStart() const + { return m_bodyStart; } + virtual int bodyEnd() const + { return m_bodyEnd; } + virtual QString definitionFile() const + { return m_defFile; } + virtual int definitionLine() const + { return m_defLine; } + virtual IMemberReference *reimplements() const + { return m_reimplements; } + virtual IMemberReferenceIterator *reimplementedBy() const + { return new MemberReferenceIterator(m_reimplementedBy); } + virtual IEnumValueIterator *enumValues() const + { return new EnumValueIterator(m_enumValues); } + virtual IDocRoot *briefDescription() const + { return m_brief; } + virtual IDocRoot *detailedDescription() const + { return m_detailed; } + + void initialize(MainHandler *m); + + private: + IBaseHandler *m_parent; + QString m_kind; + QString m_id; + QString m_protection; + QString m_virtualness; + QList<ILinkedText> m_type; + QList<ILinkedText> m_initializer; + QList<ILinkedText> m_exception; + QString m_name; + DocHandler *m_brief; + DocHandler *m_detailed; + QList<IParam> m_params; + QList<MemberReference> m_references; + QList<MemberReference> m_referencedBy; + MemberReference *m_reimplements; + QList<MemberReference> m_reimplementedBy; + QString m_defFile; + int m_defLine; + int m_bodyStart; + int m_bodyEnd; + bool m_isConst; + bool m_isVolatile; + LinkedTextHandler *m_linkedTextHandler; + QList<EnumValueHandler> m_enumValues; +}; + +#endif diff --git a/addon/xmlparse/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp index a800195..0cf00e4 100644 --- a/addon/xmlparse/paramhandler.cpp +++ b/addon/doxmlparser/src/paramhandler.cpp @@ -20,8 +20,7 @@ ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) { addEndHandler("param",this,&ParamHandler::endParam); - addStartHandler("type"); - addEndHandler("type",this,&ParamHandler::endType); + addStartHandler("type",this,&ParamHandler::startType); addStartHandler("declname"); addEndHandler("declname",this,&ParamHandler::endDeclName); @@ -35,8 +34,9 @@ ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) addStartHandler("attrib"); addEndHandler("attrib",this,&ParamHandler::endAttrib); - addStartHandler("defval"); - addEndHandler("defval",this,&ParamHandler::endDefVal); + addStartHandler("defval",this,&ParamHandler::startDefVal); + + m_linkedTextHandler = 0; } ParamHandler::~ParamHandler() @@ -54,10 +54,12 @@ void ParamHandler::endParam() m_parent->setDelegate(0); } -void ParamHandler::endType() +void ParamHandler::startType(const QXmlAttributes& /*attrib*/) { - m_type = m_curString.stripWhiteSpace(); - printf("param type=`%s'\n",m_type.data()); + delete m_linkedTextHandler; + m_linkedTextHandler = new LinkedTextHandler(this,m_type); + m_linkedTextHandler->start("type"); + printf("param type\n"); } void ParamHandler::endDeclName() @@ -84,10 +86,12 @@ void ParamHandler::endArray() printf("member array=`%s'\n",m_array.data()); } -void ParamHandler::endDefVal() +void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/) { - m_defVal = m_curString.stripWhiteSpace(); - printf("member defVal=`%s'\n",m_defVal.data()); + delete m_linkedTextHandler; + m_linkedTextHandler = new LinkedTextHandler(this,m_defVal); + m_linkedTextHandler->start("type"); + printf("member defVal\n"); } diff --git a/addon/xmlparse/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index 38e5e03..6725a5e 100644 --- a/addon/xmlparse/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -19,41 +19,53 @@ #include <qstring.h> #include <qlist.h> #include <qxml.h> +#include <doxmlintf.h> #include "basehandler.h" -#include "doxmlintf.h" +#include "baseiterator.h" +#include "linkedtexthandler.h" + +class ParamIterator : public BaseIterator<IParamIterator,IParam,IParam> +{ + public: + ParamIterator(const QList<IParam> &list) : + BaseIterator<IParamIterator,IParam,IParam>(list) {} +}; class ParamHandler : public IParam, public BaseHandler<ParamHandler> { public: virtual void startParam(const QXmlAttributes& attrib); virtual void endParam(); - virtual void endType(); + virtual void startType(const QXmlAttributes& attrib); virtual void endDeclName(); virtual void endDefName(); virtual void endAttrib(); virtual void endArray(); - virtual void endDefVal(); + virtual void startDefVal(const QXmlAttributes& attrib); ParamHandler(IBaseHandler *parent); virtual ~ParamHandler(); // IParam - virtual QString type() const { return m_type; } + virtual ILinkedTextIterator *type() const + { return new LinkedTextIterator(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; } + virtual ILinkedTextIterator *defaultValue() const + { return new LinkedTextIterator(m_defVal); } private: IBaseHandler *m_parent; - QString m_type; + QList<ILinkedText> m_type; QString m_declName; QString m_defName; QString m_attrib; QString m_array; - QString m_defVal; + QList<ILinkedText> m_defVal; + LinkedTextHandler *m_linkedTextHandler; }; #endif diff --git a/addon/xmlparse/sectionhandler.cpp b/addon/doxmlparser/src/sectionhandler.cpp index 0fc3446..d1c7b1f 100644 --- a/addon/xmlparse/sectionhandler.cpp +++ b/addon/doxmlparser/src/sectionhandler.cpp @@ -53,7 +53,7 @@ void SectionHandler::initialize(MainHandler *m) MemberHandler *mh; for (;(mh=(MemberHandler *)mli.current());++mli) { - m->insertMemberById(mh->name(),mh); + m->insertMemberById(mh->id(),mh); m->insertMemberByName(mh->name(),mh); } } diff --git a/addon/xmlparse/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h index 46cb422..234cce1 100644 --- a/addon/xmlparse/sectionhandler.h +++ b/addon/doxmlparser/src/sectionhandler.h @@ -19,13 +19,23 @@ #include <qstring.h> #include <qlist.h> #include <qxml.h> +#include <doxmlintf.h> #include "basehandler.h" #include "memberhandler.h" -#include "doxmlintf.h" class MainHandler; + +class SectionIterator : + public BaseIterator<ISectionIterator,ISection,ISection> +{ + public: + SectionIterator(const QList<ISection> &list) : + BaseIterator<ISectionIterator,ISection,ISection>(list) {} +}; + + class SectionHandler : public ISection, public BaseHandler<SectionHandler> { public: @@ -38,7 +48,8 @@ class SectionHandler : public ISection, public BaseHandler<SectionHandler> // ISection virtual QString kind() const { return m_kind; } - virtual QListIterator<IMember> getMemberIterator() const { return m_members; } + virtual IMemberIterator *members() const + { return new MemberIterator(m_members); } void initialize(MainHandler *m); diff --git a/addon/xmlparse/Makefile.in b/addon/doxmlparser/test/Makefile.in index 5fe8421..1dfbd17 100644 --- a/addon/xmlparse/Makefile.in +++ b/addon/doxmlparser/test/Makefile.in @@ -11,6 +11,3 @@ 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/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp new file mode 100644 index 0000000..9af575a --- /dev/null +++ b/addon/doxmlparser/test/main.cpp @@ -0,0 +1,225 @@ +/****************************************************************************** + * + * $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> + +QString linkedTextToString(ILinkedTextIterator *ti) +{ + QString result; + ILinkedText *lt=0; + for (ti->toFirst();(lt=ti->current());ti->toNext()) + { + switch (lt->kind()) + { + case ILinkedText::Kind_Text: + result+=dynamic_cast<ILT_Text*>(lt)->text(); break; + case ILinkedText::Kind_Ref: + result+=dynamic_cast<ILT_Ref *>(lt)->text(); break; + } + } + return result; +} + +void DumpDoc(IDoc *doc) +{ + printf(" doc node kind=`%d'\n",doc->kind()); + switch (doc->kind()) + { + case IDoc::Para: + { + printf(" --- par --- \n"); + IDocPara *par = dynamic_cast<IDocPara*>(doc); + ASSERT(par!=0); + IDocIterator *di = par->contents(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc); + } + di->release(); + printf(" --- end par --- \n"); + } + break; + case IDoc::Text: + { + IDocText *txt = dynamic_cast<IDocText*>(doc); + ASSERT(txt!=0); + printf(" --- text `%s' markup=%d --- \n",txt->text().data(),txt->markup()); + } + break; + case IDoc::Title: + { + printf(" --- title --- \n"); + IDocTitle *t = dynamic_cast<IDocTitle*>(doc); + ASSERT(t!=0); + IDocIterator *di = t->title(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc); + } + printf(" --- end title --- \n"); + } + break; + case IDoc::Section: + { + IDocSection *sec = dynamic_cast<IDocSection*>(doc); + ASSERT(sec!=0); + printf(" --- section id=`%s' level=%d --- \n", + sec->id().data(),sec->level()); + IDocIterator *di = sec->title(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc); + } + printf(" --- end section --- \n"); + } + break; + case IDoc::Root: + { + printf(" --- root --- \n"); + IDocRoot *root = dynamic_cast<IDocRoot*>(doc); + ASSERT(root!=0); + IDocIterator *di = root->contents(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc); + } + di->release(); + printf(" --- end root --- \n"); + } + break; + + default: + break; + } +} + +int main(int argc,char **argv) +{ + if (argc!=2) + { + printf("Usage: %s file.xml\n",argv[0]); + exit(1); + } + + IDoxygen *dox = createObjectModelFromXML(argv[1]); + + ICompoundIterator *cli = dox->compounds(); + ICompound *comp; + printf("--- compound list ---------\n"); + for (cli->toFirst();(comp=cli->current());cli->toNext()) + { + printf("Compound name=%s id=%s kind=%s\n", + comp->name().data(),comp->id().data(),comp->kind().data()); + ISectionIterator *sli = comp->sections(); + ISection *sec; + for (sli->toFirst();(sec=sli->current());sli->toNext()) + { + printf(" Section kind=%s\n",sec->kind().data()); + IMemberIterator *mli = sec->members(); + IMember *mem; + for (mli->toFirst();(mem=mli->current());mli->toNext()) + { + ILinkedTextIterator *lti = mem->type(); + printf(" Member type=%s name=%s\n", + linkedTextToString(lti).data(),mem->name().data()); + lti->release(); + + IParamIterator *pli = mem->params(); + IParam *par; + for (pli->toFirst();(par=pli->current());pli->toNext()) + { + lti = par->type(); + QString parType = linkedTextToString(lti); + lti->release(); + lti = par->defaultValue(); + QString defVal = linkedTextToString(lti); + lti->release(); + printf(" Param type=%s name=%s defvalue=%s\n", + parType.data(), par->definitionName().data(),defVal.data()); + } + pli->release(); + IMemberReferenceIterator *mri = mem->references(); + IMemberReference *mr; + for (mri->toFirst();(mr=mri->current());mri->toNext()) + { + IMember *memr = mr->member(); + printf(" References %s at line %d\n", + mr->memberName().data(),memr->bodyStart()); + } + + mri->release(); + mri = mem->referencedBy(); + for (mri->toFirst();(mr=mri->current());mri->toNext()) + { + IMember *memr = mr->member(); + printf(" ReferencedBy %s at line %d\n", + mr->memberName().data(),memr->bodyStart()); + } + mri->release(); + + IEnumValueIterator *evi = mem->enumValues(); + IEnumValue *ev; + for (evi->toFirst();(ev=evi->current());evi->toNext()) + { + printf(" Enum value `%s' init=`%s'\n", + ev->name().data(),ev->initializer().data()); + } + evi->release(); + + IDoc *doc = mem->briefDescription(); + if (doc) + { + printf("===== brief description ==== \n"); + DumpDoc(doc); + } + + doc = mem->detailedDescription(); + if (doc) + { + printf("===== detailed description ==== \n"); + DumpDoc(doc); + } + } + mli->release(); + } + sli->release(); + + IDoc *doc = comp->briefDescription(); + if (doc) + { + printf("===== brief description ==== \n"); + DumpDoc(doc); + } + + doc = comp->detailedDescription(); + if (doc) + { + printf("===== detailed description ==== \n"); + DumpDoc(doc); + } + } + cli->release(); + printf("---------------------------\n"); + + dox->release(); + + return 0; +} + diff --git a/addon/doxmlparser/test/xmlparse.pro.in b/addon/doxmlparser/test/xmlparse.pro.in new file mode 100644 index 0000000..1dc095b --- /dev/null +++ b/addon/doxmlparser/test/xmlparse.pro.in @@ -0,0 +1,19 @@ +TEMPLATE = app.t +CONFIG = console warn_on $extraopts +HEADERS = +SOURCES = main.cpp +unix:LIBS += -L../../../lib -L../lib -ldoxmlparser -lqtools +win32:INCLUDEPATH += . +win32-mingw:LIBS += -L../../../lib -L../lib -ldoxmlparser -lqtools +win32-msvc:LIBS += doxmlparser.lib qtools.lib shell32.lib +win32-msvc:TMAKE_LFLAGS += /LIBPATH:..\..\..\lib;..\lib +win32-borland:LIBS += doxmlparser.lib qtools.lib shell32.lib +win32-borland:TMAKE_LFLAGS += -L..\..\..\lib -L..\lib +win32:TMAKE_CXXFLAGS += -DQT_NODLL +DESTDIR = +OBJECTS_DIR = ../objects +TARGET = xmlparse +INCLUDEPATH += ../../../qtools ../include +unix:TARGETDEPS = ../lib/libdoxmlparser.a +win32:TARGETDEPS = ..\lib\doxmlparser.lib + 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/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/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 - |