diff options
Diffstat (limited to 'addon')
-rw-r--r-- | addon/xmlparse/Doxyfile | 6 | ||||
-rw-r--r-- | addon/xmlparse/basehandler.h | 2 | ||||
-rw-r--r-- | addon/xmlparse/compoundhandler.cpp | 4 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.cpp | 76 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.h | 42 | ||||
-rw-r--r-- | addon/xmlparse/main.cpp | 19 | ||||
-rw-r--r-- | addon/xmlparse/memberhandler.cpp | 4 |
7 files changed, 136 insertions, 17 deletions
diff --git a/addon/xmlparse/Doxyfile b/addon/xmlparse/Doxyfile index bec9537..7899f6b 100644 --- a/addon/xmlparse/Doxyfile +++ b/addon/xmlparse/Doxyfile @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = dox2html +PROJECT_NAME = xmlparse PROJECT_NUMBER = OUTPUT_DIRECTORY = doc OUTPUT_LANGUAGE = English @@ -145,8 +145,8 @@ INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES GRAPHICAL_HIERARCHY = YES DOT_PATH = -MAX_DOT_GRAPH_WIDTH = 3024 -MAX_DOT_GRAPH_HEIGHT = 3024 +MAX_DOT_GRAPH_WIDTH = 1280 +MAX_DOT_GRAPH_HEIGHT = 1024 GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- diff --git a/addon/xmlparse/basehandler.h b/addon/xmlparse/basehandler.h index 0bf7c68..6129aa4 100644 --- a/addon/xmlparse/basehandler.h +++ b/addon/xmlparse/basehandler.h @@ -115,7 +115,7 @@ template<class T> class BaseHandler : public IBaseHandler, virtual ~BaseHandler() { - delete m_fallBackHandler; + ASSERT(m_delegateHandler==0); } virtual bool startDocument() diff --git a/addon/xmlparse/compoundhandler.cpp b/addon/xmlparse/compoundhandler.cpp index c299397..dd81a2a 100644 --- a/addon/xmlparse/compoundhandler.cpp +++ b/addon/xmlparse/compoundhandler.cpp @@ -21,6 +21,8 @@ CompoundHandler::CompoundHandler(IBaseHandler *parent) : m_parent(parent), m_brief(0), m_detailed(0) { m_superClasses.setAutoDelete(TRUE); + m_subClasses.setAutoDelete(TRUE); + m_sections.setAutoDelete(TRUE); addEndHandler("compounddef",this,&CompoundHandler::endCompound); @@ -42,6 +44,8 @@ CompoundHandler::CompoundHandler(IBaseHandler *parent) CompoundHandler::~CompoundHandler() { + delete m_brief; + delete m_detailed; } void CompoundHandler::startSection(const QXmlAttributes& attrib) diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp index 4e91d8f..7a72763 100644 --- a/addon/xmlparse/dochandler.cpp +++ b/addon/xmlparse/dochandler.cpp @@ -163,6 +163,8 @@ void MarkupHandler::endSuperscript() ListItemHandler::ListItemHandler(IBaseHandler *parent) : DocNode(ListItem), m_parent(parent) { + m_children.setAutoDelete(TRUE); + addEndHandler("listitem",this,&ListItemHandler::endListItem); addStartHandler("para",this,&ListItemHandler::startParagraph); @@ -236,6 +238,48 @@ void ListHandler::startListItem(const QXmlAttributes& attrib) // ParameterHandler //---------------------------------------------------------------------- +ParameterHandler::ParameterHandler(IBaseHandler *parent) : DocNode(Parameter), + m_parent(parent), m_description(0) +{ + addEndHandler("parametername",this,&ParameterHandler::endParameterName); + addEndHandler("parameterdescription",this,&ParameterHandler::endParameterDescription); + addStartHandler("para",this,&ParameterHandler::startParagraph); +} + +ParameterHandler::~ParameterHandler() +{ + delete m_description; +} + +void ParameterHandler::startParameterName(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); +} + +void ParameterHandler::endParameterName() +{ + m_name = m_curString; + printf("parameter %s\n",m_name.data()); + m_curString=""; + m_parent->setDelegate(0); +} + +void ParameterHandler::startParameterDescription(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); +} + +void ParameterHandler::endParameterDescription() +{ + m_parent->setDelegate(0); +} + +void ParameterHandler::startParagraph(const QXmlAttributes& attrib) +{ + ASSERT(m_description==0); + m_description = new ParagraphHandler(this); + m_description->startParagraph(attrib); +} //---------------------------------------------------------------------- // ParameterListHandler @@ -245,6 +289,10 @@ ParameterListHandler::ParameterListHandler(IBaseHandler *parent) : DocNode(ParameterList), m_parent(parent) { addEndHandler("parameterlist",this,&ParameterListHandler::endParameterList); + addStartHandler("parametername",this,&ParameterListHandler::startParameterName); + addStartHandler("parameterdescription",this,&ParameterListHandler::startParameterDescription); + addStartHandler("title"); + addEndHandler("title"); m_parameters.setAutoDelete(TRUE); m_curParam=0; } @@ -253,8 +301,17 @@ ParameterListHandler::~ParameterListHandler() { } -void ParameterListHandler::startParameterList(const QXmlAttributes& /*attrib*/) +void ParameterListHandler::startParameterList(const QXmlAttributes& attrib) { + QString kind = attrib.value("kind"); + if (kind=="retval") m_type=RetVal; + else if (kind=="exception") m_type=Exception; + else if (kind=="param") m_type=Param; + else + { + printf("Error: invalid parameterlist type: %s\n",kind.data()); + } + printf("parameterlist kind=%s\n",kind.data()); m_parent->setDelegate(this); } @@ -263,6 +320,19 @@ void ParameterListHandler::endParameterList() m_parent->setDelegate(0); } +void ParameterListHandler::startParameterName(const QXmlAttributes& attrib) +{ + m_curParam = new ParameterHandler(this); + m_parameters.append(m_curParam); + m_curParam->startParameterName(attrib); +} + +void ParameterListHandler::startParameterDescription(const QXmlAttributes& attrib) +{ + ASSERT(m_curParam!=0); + m_curParam->startParameterDescription(attrib); +} + //---------------------------------------------------------------------- // ParagraphHandler //---------------------------------------------------------------------- @@ -279,10 +349,12 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent) addStartHandler("itemizedlist",this,&ParagraphHandler::startItemizedList); addStartHandler("orderedlist",this,&ParagraphHandler::startOrderedList); + addStartHandler("parameterlist",this,&ParagraphHandler::startParameterList); } ParagraphHandler::~ParagraphHandler() { + delete m_markupHandler; } void ParagraphHandler::startParagraph(const QXmlAttributes& /*attrib*/) @@ -339,6 +411,8 @@ void ParagraphHandler::addTextNode() DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) { + m_children.setAutoDelete(TRUE); + addEndHandler("briefdescription",this,&DocHandler::endDoc); addEndHandler("detaileddescription",this,&DocHandler::endDoc); diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h index 376d6f8..0b11e25 100644 --- a/addon/xmlparse/dochandler.h +++ b/addon/xmlparse/dochandler.h @@ -51,7 +51,8 @@ class DocNode ItemizedList, OrderedList, ListItem, - ParameterList + ParameterList, + Parameter }; DocNode(NodeKind k) : m_kind(k) {} virtual ~DocNode() {} @@ -182,8 +183,11 @@ class ParameterHandler : public DocNode, public: ParameterHandler(IBaseHandler *parent); virtual ~ParameterHandler(); - virtual void startParameterList(const QXmlAttributes& attrib); - virtual void endParameterList(); + virtual void startParameterName(const QXmlAttributes& attrib); + virtual void endParameterName(); + virtual void startParameterDescription(const QXmlAttributes& attrib); + virtual void endParameterDescription(); + virtual void startParagraph(const QXmlAttributes& attrib); private: IBaseHandler *m_parent; @@ -201,15 +205,45 @@ class ParameterListHandler : public DocNode, public BaseHandler<ParameterListHandler> { public: + enum Types { Param, RetVal, Exception }; ParameterListHandler(IBaseHandler *parent); virtual ~ParameterListHandler(); virtual void startParameterList(const QXmlAttributes& attrib); virtual void endParameterList(); + virtual void startParameterName(const QXmlAttributes& attrib); + virtual void startParameterDescription(const QXmlAttributes& attrib); private: IBaseHandler *m_parent; QList<ParameterHandler> m_parameters; ParameterHandler *m_curParam; + Types m_type; +}; + +//----------------------------------------------------------------------------- + +/* \brief Node representing a simple section with an unnumbered header. + * + */ +class SimpleSectHandler : public DocNode, + public BaseHandler<SimpleSectHandler> +{ + public: + enum Types { See, Return, Author, Version, + Since, Date, Bug, Note, + Warning, Par, Deprecated, Pre, + Post, Invar, Remark, Attention + }; + SimpleSectHandler(IBaseHandler *parent); + virtual ~SimpleSectHandler(); + virtual void startSimpleSect(const QXmlAttributes& attrib); + virtual void endSimpleSect(); + + private: + IBaseHandler *m_parent; + ParameterHandler *m_curParam; + Types m_type; + QString m_title; }; //----------------------------------------------------------------------------- @@ -252,7 +286,7 @@ class DocHandler : public BaseHandler<DocHandler> virtual ~DocHandler(); private: IBaseHandler *m_parent; - QList<DocNode> m_children; + QList<ParagraphHandler> m_children; }; #endif diff --git a/addon/xmlparse/main.cpp b/addon/xmlparse/main.cpp index 60f4142..7fdb60a 100644 --- a/addon/xmlparse/main.cpp +++ b/addon/xmlparse/main.cpp @@ -55,14 +55,17 @@ int main(int argc,char **argv) exit(1); } - QFile xmlFile(argv[1]); - MainHandler handler; - ErrorHandler errorHandler; - QXmlInputSource source( xmlFile ); - QXmlSimpleReader reader; - reader.setContentHandler( &handler ); - reader.setErrorHandler( &errorHandler ); - reader.parse( source ); + //for (;;) + //{ + QFile xmlFile(argv[1]); + MainHandler handler; + ErrorHandler errorHandler; + QXmlInputSource source( xmlFile ); + QXmlSimpleReader reader; + reader.setContentHandler( &handler ); + reader.setErrorHandler( &errorHandler ); + reader.parse( source ); + //} return 0; } diff --git a/addon/xmlparse/memberhandler.cpp b/addon/xmlparse/memberhandler.cpp index 4cbe4a6..3198676 100644 --- a/addon/xmlparse/memberhandler.cpp +++ b/addon/xmlparse/memberhandler.cpp @@ -33,11 +33,15 @@ MemberHandler::MemberHandler(IBaseHandler *parent) addStartHandler("briefdescription",this,&MemberHandler::startBriefDesc); addStartHandler("detaileddescription",this,&MemberHandler::startDetailedDesc); + + m_params.setAutoDelete(TRUE); } MemberHandler::~MemberHandler() { + delete m_brief; + delete m_detailed; } void MemberHandler::startMember(const QXmlAttributes& attrib) |