diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-08-01 18:08:50 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-08-01 18:08:50 (GMT) |
commit | 071e39254b00ad7ffed5de8cdeb44072278d4d57 (patch) | |
tree | dd7f0f7dd0875046b1426a541b00547a8af08af1 /addon | |
parent | ea8a1bc7ccbd7b64a31c293caa31240bde7397cf (diff) | |
download | Doxygen-071e39254b00ad7ffed5de8cdeb44072278d4d57.zip Doxygen-071e39254b00ad7ffed5de8cdeb44072278d4d57.tar.gz Doxygen-071e39254b00ad7ffed5de8cdeb44072278d4d57.tar.bz2 |
Release-1.2.9
Diffstat (limited to 'addon')
35 files changed, 1466 insertions, 1721 deletions
diff --git a/addon/xmlgen/Makefile.in b/addon/xmlgen/Makefile.in deleted file mode 100644 index d0e2dc5..0000000 --- a/addon/xmlgen/Makefile.in +++ /dev/null @@ -1,16 +0,0 @@ -all clean depend: Makefile.xmlgen - $(MAKE) -f Makefile.xmlgen $@ - -distclean: clean - $(RM) -f Makefile.xmlgen - -tmake: - $(ENV) $(PERL) $(TMAKE) xmlgen.pro >Makefile.xmlgen - -Makefile.xmlgen: xmlgen.pro - $(ENV) $(PERL) $(TMAKE) xmlgen.pro >Makefile.xmlgen - -install: - $(INSTTOOL) -d $(INSTALL)/bin - $(INSTTOOL) -m 755 ../../bin/doxygen_xml $(INSTALL)/bin - diff --git a/addon/xmlgen/doxygen.dtd b/addon/xmlgen/doxygen.dtd deleted file mode 100644 index 62727b8..0000000 --- a/addon/xmlgen/doxygen.dtd +++ /dev/null @@ -1,117 +0,0 @@ -<?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 (compoundlist?)> -<!ELEMENT compoundlist (compounddef)+> -<!ELEMENT compounddef (compoundname, - basecompoundlist?, - derivedcompoundlist?, - sectionlist? - ) -> -<!ATTLIST compounddef %compound-req.att;> -<!ELEMENT basecompoundlist (basecompoundref)+> -<!ELEMENT derivedcompoundlist (derivedcompoundref)+> -<!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/xmlgen/main.cpp b/addon/xmlgen/main.cpp deleted file mode 100644 index 30f9071..0000000 --- a/addon/xmlgen/main.cpp +++ /dev/null @@ -1,40 +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. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include "doxygen.h" -#include "message.h" -#include "xml.h" - -/*! \file - * \brief main entry point for doxygen's XML generator - * - * This file contains main() - */ - -/*! Main that generate XML output - * - */ -int main(int argc,char **argv) -{ - initDoxygen(); - readConfiguration(argc,argv); - parseInput(); - msg("Generating XML output\n"); - generateXML(); - return 0; -} diff --git a/addon/xmlgen/xml.cpp b/addon/xmlgen/xml.cpp deleted file mode 100644 index 6e3a7d6..0000000 --- a/addon/xmlgen/xml.cpp +++ /dev/null @@ -1,521 +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. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include <stdlib.h> - -#include "qtbc.h" -#include "xml.h" -#include "doxygen.h" -#include "message.h" -#include "config.h" -#include "classlist.h" -#include "util.h" -#include "defargs.h" - -#include <qdir.h> -#include <qfile.h> -#include <qtextstream.h> - -const char dtd_data[]= -#include "xml_dtd.h" -; - -class TextGeneratorXMLImpl : public TextGeneratorIntf -{ - public: - TextGeneratorXMLImpl(QTextStream &t): m_t(t) {} - void writeString(const char *s) const - { - writeXMLString(m_t,s); - } - void writeBreak() const {} - void writeLink(const char *extRef,const char *file, - const char *anchor,const char *text - ) const - { - if (extRef==0) - { writeXMLLink(m_t,file,anchor,text); } - else // external references are not supported for XML - { writeXMLString(m_t,text); } - } - private: - QTextStream &m_t; -}; - - -void generateDTD() -{ - QCString fileName=Config_getString("OUTPUT_DIRECTORY")+"/xml/doxygen.dtd"; - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - QTextStream t(&f); - t << dtd_data; -} - -void writeXMLString(QTextStream &t,const char *s) -{ - t << convertToXML(s); -} - -void writeXMLLink(QTextStream &t,const char *compoundId,const char *memId, - const char *text) -{ - if (memId==0) - { - t << "<compoundref idref=\"" << compoundId << "\">"; - writeXMLString(t,text); - t << "</compoundref>"; - } - else - { - t << "<memberref idref=\"" << compoundId << ":" << memId << "\">"; - writeXMLString(t,text); - t << "</memberref>"; - } -} - -void generateXMLForMember(MemberDef *md,QTextStream &t,Definition *def) -{ - if (md->memberType()==MemberDef::EnumValue) return; - - QCString scopeName; - if (md->getClassDef()) - scopeName=md->getClassDef()->name(); - else if (md->getNamespaceDef()) - scopeName=md->getNamespaceDef()->name(); - - t << " <"; - enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t; - switch (md->memberType()) - { - case MemberDef::Define: t << "definedef"; xmlType=define_t; break; - case MemberDef::EnumValue: // fall through - case MemberDef::Property: // fall through - case MemberDef::Variable: t << "variabledef"; xmlType=variable_t; break; - case MemberDef::Typedef: t << "typedef"; xmlType=typedef_t; break; - case MemberDef::Enumeration: t << "enumdef"; xmlType=enum_t; break; - case MemberDef::Function: // fall through - case MemberDef::Signal: // fall through - case MemberDef::Prototype: // fall through - case MemberDef::Friend: // fall through - case MemberDef::DCOP: // fall through - case MemberDef::Slot: t << "functiondef"; xmlType=function_t; break; - } - t << " id=\""; - t << def->getOutputFileBase() - << "__" // can we change this to a non ID char? - // : do not seem allowed for some parsers! - << md->anchor(); - t << "\""; - if (xmlType==function_t && md->virtualness()!=Normal) - // functions has an extra "virt" attribute - { - t << " virt=\""; - switch (md->virtualness()) - { - case Virtual: t << "virtual"; break; - case Pure: t << "pure-virtual"; break; - default: ASSERT(0); - } - t << "\""; - } - t << ">" << endl; - - if (xmlType!=define_t && xmlType!=enum_t && // These don't have types. - (xmlType!=function_t || md->typeString()!=0) // Type is optional here. - ) - { - QCString typeStr = replaceAnonymousScopes(md->typeString()); - if (xmlType==typedef_t && typeStr.left(8)=="typedef ") - typeStr=typeStr.right(typeStr.length()-8); - if (xmlType==function_t && typeStr.left(8)=="virtual ") - typeStr=typeStr.right(typeStr.length()-8); - t << " <type>"; - linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),typeStr); - t << "</type>" << endl; - } - - t << " <name>"; - writeXMLString(t,md->name()); - t << "</name>" << endl; - if (xmlType==function_t) //function - { - t << " <paramlist>" << endl; - ArgumentList *declAl = new ArgumentList; - ArgumentList *defAl = md->argumentList(); - stringToArgumentList(md->argsString(),declAl); - if (declAl->count()>0) - { - ArgumentListIterator declAli(*declAl); - ArgumentListIterator defAli(*defAl); - Argument *a; - for (declAli.toFirst();(a=declAli.current());++declAli) - { - Argument *defArg = defAli.current(); - t << " <param>" << endl; - if (!a->attrib.isEmpty()) - { - t << " <attributes>"; - writeXMLString(t,a->attrib); - t << "</attributes>" << endl; - } - if (!a->type.isEmpty()) - { - t << " <type>"; - linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),a->type); - t << "</type>" << endl; - } - if (!a->name.isEmpty()) - { - t << " <declname>"; - writeXMLString(t,a->name); - t << "</declname>" << endl; - } - if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name) - { - t << " <defname>"; - writeXMLString(t,defArg->name); - t << "</defname>" << endl; - } - if (!a->array.isEmpty()) - { - t << " <array>"; - writeXMLString(t,a->array); - t << "</array>" << endl; - } - if (!a->defval.isEmpty()) - { - t << " <defval>"; - linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),a->defval); - t << "</defval>" << endl; - } - t << " </param>" << endl; - if (defArg) ++defAli; - } - } - delete declAl; - t << " </paramlist>" << endl; - } - else if (xmlType==define_t && md->argsString()!=0) // define - { - t << " <defparamlist>" << endl; - ArgumentListIterator ali(*md->argumentList()); - Argument *a; - for (ali.toFirst();(a=ali.current());++ali) - { - t << " <defarg>" << a->type << "</defarg>" << endl; - } - t << " </defparamlist>" << endl; - if (!md->initializer().isEmpty()) - { - t << " <initializer>"; - linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),md->initializer()); - t << "</initializer>" << endl; - } - } - else if (xmlType==enum_t) // enum - { - t << " <enumvaluelist>" << endl; - if (md->enumFieldList()) - { - MemberListIterator emli(*md->enumFieldList()); - MemberDef *emd; - for (emli.toFirst();(emd=emli.current());++emli) - { - t << " <enumvalue>" << endl; - t << " <name>"; - writeXMLString(t,emd->name()); - t << "</name>" << endl; - if (!emd->initializer().isEmpty()) - { - t << " <initializer>"; - writeXMLString(t,emd->initializer()); - t << "</initializer>" << endl; - } - t << " </enumvalue>" << endl; - } - } - t << " </enumvaluelist>" << endl; - } - t << " </"; - switch (md->memberType()) - { - case MemberDef::Define: t << "definedef"; break; - case MemberDef::EnumValue: // fall through - case MemberDef::Property: // fall through - case MemberDef::Variable: t << "variabledef"; break; - case MemberDef::Typedef: t << "typedef"; break; - case MemberDef::Enumeration: t << "enumdef"; break; - case MemberDef::Function: // fall through - case MemberDef::Signal: // fall through - case MemberDef::Prototype: // fall through - case MemberDef::Friend: // fall through - case MemberDef::DCOP: // fall through - case MemberDef::Slot: t << "functiondef"; break; - } - t << ">" << endl; -} - - -void generateXMLClassSection(ClassDef *cd,QTextStream &t,MemberList *ml,const char *type) -{ - if (ml->count()>0) - { - t << " <sectiondef type=\"" << type << "\">" << endl; - t << " <memberlist>" << endl; - MemberListIterator mli(*ml); - MemberDef *md; - for (mli.toFirst();(md=mli.current());++mli) - { - generateXMLForMember(md,t,cd); - } - t << " </memberlist>" << endl; - t << " </sectiondef>" << endl; - } -} - -void generateXMLForClass(ClassDef *cd,QTextStream &t) -{ - if (cd->name().find('@')!=-1) return; // skip anonymous compounds - t << " <compounddef id=\"" - << cd->getOutputFileBase() << "\" type=\"" - << cd->compoundTypeString() << "\">" << endl; - t << " <compoundname>"; - writeXMLString(t,cd->name()); - t << "</compoundname>" << endl; - if (cd->baseClasses()->count()>0) - { - t << " <basecompoundlist>" << endl; - BaseClassListIterator bcli(*cd->baseClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) - { - t << " <basecompoundref idref=\"" - << bcd->classDef->getOutputFileBase() - << "\" prot=\""; - switch (bcd->prot) - { - case Public: t << "public"; break; - case Protected: t << "protected"; break; - case Private: t << "private"; break; - } - t << "\" virt=\""; - switch(bcd->virt) - { - case Normal: t << "non-virtual"; break; - case Virtual: t << "virtual"; break; - case Pure: t <<"pure-virtual"; break; - } - t << "\"/>" << endl; - } - t << " </basecompoundlist>" << endl; - } - if (cd->subClasses()->count()>0) - { - t << " <derivedcompoundlist>" << endl; - BaseClassListIterator bcli(*cd->subClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) - { - t << " <derivedcompoundref idref=\"" - << bcd->classDef->getOutputFileBase() - << "\" prot=\""; - switch (bcd->prot) - { - case Public: t << "public"; break; - case Protected: t << "protected"; break; - case Private: t << "private"; break; - } - t << "\" virt=\""; - switch(bcd->virt) - { - case Normal: t << "non-virtual"; break; - case Virtual: t << "virtual"; break; - case Pure: t << "pure-virtual"; break; - } - t << "\"/>" << endl; - } - t << " </derivedcompoundlist>" << endl; - } - int numMembers = - cd->pubTypes.count()+cd->pubMembers.count()+cd->pubAttribs.count()+ - cd->pubSlots.count()+cd->signals.count()+cd->dcopMethods.count()+ - cd->pubStaticMembers.count()+ - cd->pubStaticAttribs.count()+cd->proTypes.count()+cd->proMembers.count()+ - cd->proAttribs.count()+cd->proSlots.count()+cd->proStaticMembers.count()+ - cd->proStaticAttribs.count()+cd->priTypes.count()+cd->priMembers.count()+ - cd->priAttribs.count()+cd->priSlots.count()+cd->priStaticMembers.count()+ - cd->priStaticAttribs.count()+cd->friends.count()+cd->related.count(); - if (numMembers>0) - { - t << " <sectionlist>" << endl; - generateXMLClassSection(cd,t,&cd->pubTypes,"public-type"); - generateXMLClassSection(cd,t,&cd->pubMembers,"public-func"); - generateXMLClassSection(cd,t,&cd->pubAttribs,"public-attrib"); - generateXMLClassSection(cd,t,&cd->pubSlots,"public-slot"); - generateXMLClassSection(cd,t,&cd->signals,"signal"); - generateXMLClassSection(cd,t,&cd->dcopMethods,"dcop-func"); - generateXMLClassSection(cd,t,&cd->properties,"property"); - generateXMLClassSection(cd,t,&cd->pubStaticMembers,"public-static-func"); - generateXMLClassSection(cd,t,&cd->pubStaticAttribs,"public-static-attrib"); - generateXMLClassSection(cd,t,&cd->proTypes,"protected-type"); - generateXMLClassSection(cd,t,&cd->proMembers,"protected-func"); - generateXMLClassSection(cd,t,&cd->proAttribs,"protected-attrib"); - generateXMLClassSection(cd,t,&cd->proSlots,"protected-slot"); - generateXMLClassSection(cd,t,&cd->proStaticMembers,"protected-static-func"); - generateXMLClassSection(cd,t,&cd->proStaticAttribs,"protected-static-attrib"); - generateXMLClassSection(cd,t,&cd->priTypes,"private-type"); - generateXMLClassSection(cd,t,&cd->priMembers,"private-func"); - generateXMLClassSection(cd,t,&cd->priAttribs,"private-attrib"); - generateXMLClassSection(cd,t,&cd->priSlots,"private-slot"); - generateXMLClassSection(cd,t,&cd->priStaticMembers,"private-static-func"); - generateXMLClassSection(cd,t,&cd->priStaticAttribs,"private-static-attrib"); - generateXMLClassSection(cd,t,&cd->friends,"signal"); - generateXMLClassSection(cd,t,&cd->related,"related"); - t << " </sectionlist>" << endl; - } - t << " </compounddef>" << endl; -} - -void generateXMLFileSection(FileDef *fd,QTextStream &t,MemberList *ml,const char *type) -{ - if (ml->count()>0) - { - t << " <sectiondef type=\"" << type << "\">" << endl; - t << " <memberlist>" << endl; - MemberListIterator mli(*ml); - MemberDef *md; - for (mli.toFirst();(md=mli.current());++mli) - { - generateXMLForMember(md,t,fd); - } - t << " </memberlist>" << endl; - t << " </sectiondef>" << endl; - } -} - -void generateXMLForFile(FileDef *fd,QTextStream &t) -{ - t << " <compounddef id=\"" - << fd->getOutputFileBase() << "\" type=\"file\">" << endl; - t << " <compoundname>"; - writeXMLString(t,fd->name()); - t << "</compoundname>" << endl; - int numMembers = fd->decDefineMembers.count()+fd->decProtoMembers.count()+ - fd->decTypedefMembers.count()+fd->decEnumMembers.count()+ - fd->decFuncMembers.count()+fd->decVarMembers.count(); - if (numMembers>0) - { - t << " <sectionlist>" << endl; - generateXMLFileSection(fd,t,&fd->decDefineMembers,"define"); - generateXMLFileSection(fd,t,&fd->decProtoMembers,"prototype"); - generateXMLFileSection(fd,t,&fd->decTypedefMembers,"typedef"); - generateXMLFileSection(fd,t,&fd->decEnumMembers,"enum"); - generateXMLFileSection(fd,t,&fd->decFuncMembers,"func"); - generateXMLFileSection(fd,t,&fd->decVarMembers,"var"); - t << " </sectionlist>" << endl; - } - t << " </compounddef>" << endl; -} - - -void generateXML() -{ - if (Config_getString("OUTPUT_DIRECTORY").isEmpty()) - Config_getString("OUTPUT_DIRECTORY")=QDir::currentDirPath(); - else - { - QDir dir(Config_getString("OUTPUT_DIRECTORY")); - if (!dir.exists()) - { - dir.setPath(QDir::currentDirPath()); - if (!dir.mkdir(Config_getString("OUTPUT_DIRECTORY"))) - { - err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not " - "exist and cannot be created\n",Config_getString("OUTPUT_DIRECTORY").data()); - exit(1); - } - else if (!Config_getBool("QUIET")) - { - err("Notice: Output directory `%s' does not exist. " - "I have created it for you.\n", Config_getString("OUTPUT_DIRECTORY").data()); - } - dir.cd(Config_getString("OUTPUT_DIRECTORY")); - } - Config_getString("OUTPUT_DIRECTORY")=dir.absPath(); - } - - QDir dir(Config_getString("OUTPUT_DIRECTORY")); - if (!dir.exists()) - { - dir.setPath(QDir::currentDirPath()); - if (!dir.mkdir(Config_getString("OUTPUT_DIRECTORY"))) - { - err("Cannot create directory %s\n",Config_getString("OUTPUT_DIRECTORY").data()); - return; - } - } - QDir xmlDir(Config_getString("OUTPUT_DIRECTORY")+"/xml"); - if (!xmlDir.exists() && !xmlDir.mkdir(Config_getString("OUTPUT_DIRECTORY")+"/xml")) - { - err("Could not create xml directory in %s\n",Config_getString("OUTPUT_DIRECTORY").data()); - return; - } - generateDTD(); - - QCString fileName=Config_getString("OUTPUT_DIRECTORY")+"/xml/doxygen.xml"; - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - QTextStream t(&f); - t << "<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>" << endl; - t << "<!DOCTYPE doxygen SYSTEM \"doxygen.dtd\">" << endl; - t << "<doxygen>" << endl; - if (Doxygen::classSDict.count()+Doxygen::inputNameList.count()>0) - { - t << " <compoundlist>" << endl; - ClassSDict::Iterator cli(Doxygen::classSDict); - ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) - { - generateXMLForClass(cd,t); - } - FileNameListIterator fnli(Doxygen::inputNameList); - FileName *fn; - for (;(fn=fnli.current());++fnli) - { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) - { - generateXMLForFile(fd,t); - } - } - t << " </compoundlist>" << endl; - } - t << "</doxygen>" << endl; -} - - diff --git a/addon/xmlgen/xml.h b/addon/xmlgen/xml.h deleted file mode 100644 index 6a249db..0000000 --- a/addon/xmlgen/xml.h +++ /dev/null @@ -1,26 +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 XML_H -#define XML_H - -class QTextStream; - -void generateXML(); -void writeXMLString(QTextStream &t,const char *s); -void writeXMLString(QTextStream &t,const char *s); -void writeXMLLink(QTextStream &t,const char *compoundRef,const char *memAnchor, - const char *text); - -#endif diff --git a/addon/xmlgen/xml_dtd.h b/addon/xmlgen/xml_dtd.h deleted file mode 100644 index 010a465..0000000 --- a/addon/xmlgen/xml_dtd.h +++ /dev/null @@ -1,117 +0,0 @@ -"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" -"<!-- DTD describing the grammar used in doxygen's XML output -->\n" -"\n" -"<!-- standard character entities -->\n" -"<!ENTITY lt \"&#60;\"> \n" -"<!ENTITY gt \">\"> \n" -"<!ENTITY amp \"&#38;\"> \n" -"<!ENTITY apos \"'\"> \n" -"<!ENTITY quot \""\"> \n" -"\n" -"<!-- required attributes for compounds -->\n" -"<!ENTITY % compound-req.att \n" -" 'id ID #REQUIRED\n" -" type (group|file|namespace|\n" -" class|struct|union|\n" -" interface|dispinterface|\n" -" valuetype|library) #REQUIRED'\n" -">\n" -"<!-- required attributes for references -->\n" -"<!ENTITY % ref-req.att 'idref IDREF #REQUIRED'\n" -">\n" -"<!-- required attributes for inheritance relations -->\n" -"<!ENTITY % inheritcompref-req.att\n" -" '%ref-req.att;\n" -" prot (public|protected|private) #REQUIRED\n" -" virt (non-virtual|virtual) #REQUIRED'\n" -">\n" -"\n" -"<!-- required attributes for member sections -->\n" -"<!ENTITY % sec-req.att 'type (user\n" -" |public-type\n" -" |public-func\n" -" |public-attrib\n" -" |public-slot\n" -" |public-static-func\n" -" |public-static-attrib\n" -" |protected-type\n" -" |protected-func\n" -" |protected-attrib\n" -" |protected-slot\n" -" |protected-static-func\n" -" |protected-static-attrib\n" -" |private-type\n" -" |private-func\n" -" |private-attrib\n" -" |private-slot\n" -" |private-static-func\n" -" |private-static-attrib\n" -" |signal\n" -" |friend\n" -" |related\n" -" |define|prototype|typedef|enum|func|var\n" -" |dcop-func\n" -" |property\n" -" ) #REQUIRED\n" -" '\n" -">\n" -"<!-- required attributes for members -->\n" -"<!ENTITY % mem-req.att 'id ID #REQUIRED'>\n" -"\n" -"<!-- optional attributes for function -->\n" -"<!ENTITY % func-opt.att 'virt (virtual|pure-virtual) #IMPLIED'>\n" -"\n" -"<!-- elements -->\n" -"<!ELEMENT doxygen (compoundlist?)>\n" -"<!ELEMENT compoundlist (compounddef)+>\n" -"<!ELEMENT compounddef (compoundname,\n" -" basecompoundlist?, \n" -" derivedcompoundlist?, \n" -" sectionlist? \n" -" )\n" -">\n" -"<!ATTLIST compounddef %compound-req.att;>\n" -"<!ELEMENT basecompoundlist (basecompoundref)+>\n" -"<!ELEMENT derivedcompoundlist (derivedcompoundref)+>\n" -"<!ELEMENT compoundref (#PCDATA)>\n" -"<!ATTLIST compoundref %ref-req.att;>\n" -"<!ELEMENT memberref (#PCDATA)>\n" -"<!ATTLIST memberref %ref-req.att;>\n" -"<!ELEMENT basecompoundref EMPTY>\n" -"<!ATTLIST basecompoundref %inheritcompref-req.att;>\n" -"<!ELEMENT derivedcompoundref EMPTY>\n" -"<!ATTLIST derivedcompoundref %inheritcompref-req.att;>\n" -"<!ELEMENT sectionlist (sectiondef)+>\n" -"<!ELEMENT sectiondef (memberlist)>\n" -"<!ATTLIST sectiondef %sec-req.att;>\n" -"<!ELEMENT memberlist (functiondef|variabledef|typedef|definedef|enumdef)+>\n" -"<!ELEMENT functiondef (type?,name,paramlist)>\n" -"<!ATTLIST functiondef %mem-req.att; %func-opt.att;>\n" -"<!ELEMENT variabledef (type,name,array?,initializer?)>\n" -"<!ATTLIST variabledef %mem-req.att;>\n" -"<!ELEMENT typedef (type,name)>\n" -"<!ATTLIST typedef %mem-req.att;>\n" -"<!ELEMENT definedef (name,defparamlist?,initializer?)>\n" -"<!ATTLIST definedef %mem-req.att;>\n" -"<!ELEMENT enumdef (name,enumvaluelist)>\n" -"<!ATTLIST enumdef %mem-req.att;>\n" -"<!ELEMENT slotdef (type,name,paramlist)>\n" -"<!ATTLIST slotdef %mem-req.att;>\n" -"<!ELEMENT signaldef (type,name,paramlist)>\n" -"<!ATTLIST signaldef %mem-req.att;>\n" -"<!ELEMENT paramlist (param)*>\n" -"<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)>\n" -"<!ELEMENT defparamlist (defarg)*>\n" -"<!ELEMENT defarg (#PCDATA)>\n" -"<!ELEMENT enumvaluelist (enumvalue)*>\n" -"<!ELEMENT enumvalue (name,initializer?)>\n" -"<!ELEMENT name (#PCDATA)>\n" -"<!ELEMENT compoundname (#PCDATA)>\n" -"<!ELEMENT declname (#PCDATA)>\n" -"<!ELEMENT defname (#PCDATA)>\n" -"<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*>\n" -"<!ELEMENT defval (#PCDATA|memberref|compoundref)*>\n" -"<!ELEMENT initializer (#PCDATA|memberref|compoundref)*>\n" -"<!ELEMENT array (#PCDATA)>\n" -"<!ELEMENT attributes (#PCDATA)>\n" -"\n" diff --git a/addon/xmlgen/xmlgen.pro.in b/addon/xmlgen/xmlgen.pro.in deleted file mode 100644 index 2f29fd3..0000000 --- a/addon/xmlgen/xmlgen.pro.in +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = xmlgen.t -CONFIG = console warn_on $extraopt -HEADERS = xml.h xml_dtd.h -SOURCES = main.cpp xml.cpp -DEPENDPATH = ../../src -unix:LIBS += -L../../lib -ldoxygen -ldoxycfg -lqtools -win32:INCLUDEPATH += . -win32-mingw:LIBS += -L../../lib -ldoxygen -ldoxycfg -lqtools -win32-msvc:LIBS += qtools.lib doxygen.lib doxycfg.lib shell32.lib -win32-msvc:TMAKE_LFLAGS += /LIBPATH:..\..\lib -win32-borland:LIBS += qtools.lib doxygen.lib doxycfg.lib shell32.lib -win32-borland:TMAKE_LFLAGS += -L..\..\lib -win32:TMAKE_CXXFLAGS += -DQT_NODLL -INCLUDEPATH += ../../qtools ../../src -DESTDIR = ../../bin -TARGET = doxygen_xml -unix:TARGETDEPS = ../../lib/libdoxygen.a ../../lib/libdoxycfg.a -win32:TARGETDEPS = ..\..\lib\doxygen.lib ../../lib/doxycfg.lib -OBJECTS_DIR = obj - diff --git a/addon/xmlgen/xmlgen.t b/addon/xmlgen/xmlgen.t deleted file mode 100644 index 5c3ab67..0000000 --- a/addon/xmlgen/xmlgen.t +++ /dev/null @@ -1,20 +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. -# -# Documents produced by Doxygen are derivative works derived from the -# input used in their production; they are not affected by this license. -#! -#! doxygen.t: This is a custom template for building Doxygen -#! -#$ IncludeTemplate("app.t"); - -xml_dtd.h: doxygen.dtd - cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h diff --git a/addon/xmlparse/Doxyfile b/addon/xmlparse/Doxyfile new file mode 100644 index 0000000..bec9537 --- /dev/null +++ b/addon/xmlparse/Doxyfile @@ -0,0 +1,161 @@ +# Doxyfile 1.2.8-20010715 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = dox2html +PROJECT_NUMBER = +OUTPUT_DIRECTORY = doc +OUTPUT_LANGUAGE = English +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = NO +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +CASE_SENSE_NAMES = YES +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ENABLED_SECTIONS = +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +ALIASES = +MAX_INITIALIZER_LINES = 30 +OPTIMIZE_OUTPUT_FOR_C = NO +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = . +FILE_PATTERNS = *.h *.cpp +RECURSIVE = NO +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = +MAN_EXTENSION = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = YES +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = ../../qtools_docs/qtools.tag=../../../../qtools_docs/html +GENERATE_TAGFILE = +ALLEXTERNALS = NO +PERL_PATH = +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_PATH = +MAX_DOT_GRAPH_WIDTH = 3024 +MAX_DOT_GRAPH_HEIGHT = 3024 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO +CGI_NAME = +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = +EXT_DOC_PATHS = diff --git a/addon/xmlparse/Makefile.in b/addon/xmlparse/Makefile.in new file mode 100644 index 0000000..5fe8421 --- /dev/null +++ b/addon/xmlparse/Makefile.in @@ -0,0 +1,16 @@ +all clean depend: Makefile.xmlparse + $(MAKE) -f Makefile.xmlparse $@ + +distclean: clean + $(RM) -rf Makefile.xmlparse xmlparse.pro Makefile obj + +tmake: + $(ENV) $(PERL) $(TMAKE) xmlparse.pro >Makefile.xmlparse + +Makefile.xmlparse: xmlparse.pro + $(ENV) $(PERL) $(TMAKE) xmlparse.pro >Makefile.xmlparse + +install: + $(INSTTOOL) -d $(INSTALL)/bin + $(INSTTOOL) -m 755 ../../bin/xmlparse $(INSTALL)/bin + diff --git a/addon/xmlparse/basehandler.h b/addon/xmlparse/basehandler.h new file mode 100644 index 0000000..2d037e0 --- /dev/null +++ b/addon/xmlparse/basehandler.h @@ -0,0 +1,252 @@ +#ifndef _BASEHANDLER_H +#define _BASEHANDLER_H + +#include <qxml.h> +#include <qdict.h> +#include <qstring.h> + +class IBaseHandler +{ + public: + virtual void setDelegate(QXmlDefaultHandler *delegate) = 0; + virtual QXmlDefaultHandler *delegate() const = 0; +}; + +class IFallBackHandler +{ + public: + virtual bool handleStartElement(const QString & name, + const QXmlAttributes & attrib) = 0; + virtual bool handleEndElement(const QString &name) = 0; +}; + +template<class T> class ElementMapper +{ + class StartElementHandler + { + typedef void (T::*Handler)(const QXmlAttributes &attrib); + public: + StartElementHandler() : m_parent(0) {} + StartElementHandler(T *parent, Handler h) + : m_parent(parent), m_handler(h) {} + void operator()(const QXmlAttributes &attrib) + { if (m_parent) (m_parent->*m_handler)(attrib); } + private: + T *m_parent; + Handler m_handler; + }; + + class EndElementHandler + { + typedef void (T::*Handler)(); + public: + EndElementHandler() : m_parent(0) {} + EndElementHandler(T *parent, Handler h) + : m_parent(parent), m_handler(h) {} + void operator()() + { if (m_parent) (m_parent->*m_handler)(); } + private: + T *m_parent; + Handler m_handler; + }; + + typedef StartElementHandler<T> StartElementHandlerT; + typedef EndElementHandler<T> EndElementHandlerT; + + public: + ElementMapper() : m_startHandlers(67), m_endHandlers(67) + { + m_startHandlers.setAutoDelete(TRUE); + m_endHandlers.setAutoDelete(TRUE); + } + virtual ~ElementMapper() + { + } + + void addStartHandler(const char *key) + { + m_startHandlers.insert(key,new StartElementHandlerT); + } + + void addStartHandler(const char *key, T *obj, void (T::*handler)(const QXmlAttributes &)) + { + m_startHandlers.insert(key,new StartElementHandlerT(obj,handler)); + } + + void addEndHandler(const char *key) + { + m_endHandlers.insert(key,new EndElementHandlerT); + } + + void addEndHandler(const char *key, T *obj, void (T::*handler)()) + { + m_endHandlers.insert(key,new EndElementHandlerT(obj,handler)); + } + + + protected: + QDict<StartElementHandlerT> m_startHandlers; + QDict<EndElementHandlerT> m_endHandlers; +}; + +template<class T> class BaseHandler : public IBaseHandler, + public QXmlDefaultHandler, + public ElementMapper<T> +{ + public: + BaseHandler() : m_delegateHandler(0), m_fallBackHandler(0) + { + } + + virtual ~BaseHandler() + { + delete m_fallBackHandler; + } + + virtual bool startDocument() + { + return TRUE; + } + + virtual bool startElement( const QString & namespaceURI, + const QString & localName, + const QString & name, + const QXmlAttributes & attrib + ) + { + if (m_delegateHandler) + { + return m_delegateHandler->startElement(namespaceURI,localName,name,attrib); + } + if (!m_skipUntil.isEmpty()) // skip mode + { + if (m_skipUntil==name) m_skipCount++; + printf("skipping start tag %s count=%d\n",name.data(),m_skipCount); + return TRUE; + } + + StartElementHandlerT *handler = m_startHandlers[name]; + if (handler) + { + (*handler)(attrib); + //printf("found start tag %s\n",name.data()); + } + else if (m_fallBackHandler && + !m_fallBackHandler->handleStartElement(name,attrib) + ) + { + printf("found unexpected tag `%s', skipping until matching end tag\n",name.data()); + m_skipUntil = name; + m_skipCount=1; + } + return TRUE; + } + + virtual bool endElement( const QString& namespaceURI, const QString& localName, const QString& name ) + { + if (m_delegateHandler) + { + return m_delegateHandler->endElement(namespaceURI,localName,name); + } + + if (name==m_skipUntil) + { + m_skipCount--; + printf("skipping end tag %s count=%d\n",name.data(),m_skipCount); + if (m_skipCount==0) + { + m_skipUntil=""; + } + //printf("found end tag %s\n",name.data()); + } + else if (m_skipUntil.isEmpty()) + { + EndElementHandlerT *handler = m_endHandlers[name]; + if (handler) + { + (*handler)(); + //printf("found end tag %s\n",name.data()); + } + else if (m_fallBackHandler) + { + m_fallBackHandler->handleEndElement(name); + } + } + m_curString=""; + return TRUE; + } + + virtual bool characters ( const QString & ch ) + { + if (m_delegateHandler) + { + return m_delegateHandler->characters(ch); + } + + m_curString+=ch; + return TRUE; + } + + void setDelegate(QXmlDefaultHandler *delegate) + { + m_delegateHandler = delegate; + } + + QXmlDefaultHandler *delegate() const + { + return m_delegateHandler; + } + + void setFallBackHandler(IFallBackHandler *h) + { + m_fallBackHandler = h; + } + + IFallBackHandler *fallBackHandler() const + { + return m_fallBackHandler; + } + + protected: + QString m_curString; + QString m_skipUntil; + int m_skipCount; + QXmlDefaultHandler *m_delegateHandler; + IFallBackHandler *m_fallBackHandler; +}; + +template<class T> class BaseFallBackHandler : public ElementMapper<T>, + public IFallBackHandler +{ + public: + BaseFallBackHandler() + { + } + virtual ~BaseFallBackHandler() + { + } + bool handleStartElement(const QString & name, + const QXmlAttributes & attrib) + { + StartElementHandlerT *handler = m_startHandlers[name]; + if (handler) + { + (*handler)(attrib); + return TRUE; + } + return FALSE; + } + bool handleEndElement(const QString &name) + { + EndElementHandlerT *handler = m_endHandlers[name]; + if (handler) + { + (*handler)(); + return TRUE; + } + return FALSE; + } +}; + + +#endif diff --git a/addon/xmlparse/compoundhandler.cpp b/addon/xmlparse/compoundhandler.cpp new file mode 100644 index 0000000..4949f63 --- /dev/null +++ b/addon/xmlparse/compoundhandler.cpp @@ -0,0 +1,100 @@ +#include "mainhandler.h" +#include "compoundhandler.h" +#include "dochandler.h" + +CompoundHandler::CompoundHandler(IBaseHandler *parent) + : m_parent(parent), m_brief(0), m_detailed(0) +{ + m_superClasses.setAutoDelete(TRUE); + + addEndHandler("compounddef",this,&CompoundHandler::endCompound); + + addStartHandler("compoundname"); + addEndHandler("compoundname",this,&CompoundHandler::endCompoundName); + + addStartHandler("derivedcompoundref",this,&CompoundHandler::addSubClass); + addEndHandler("derivedcompoundref"); + + addStartHandler("basecompoundref",this,&CompoundHandler::addSuperClass); + addEndHandler("basecompoundref"); + + addStartHandler("briefdescription",this,&CompoundHandler::startBriefDesc); + + addStartHandler("detaileddescription",this,&CompoundHandler::startDetailedDesc); + + addStartHandler("sectiondef",this,&CompoundHandler::startSection); +} + +CompoundHandler::~CompoundHandler() +{ +} + +void CompoundHandler::startSection(const QXmlAttributes& attrib) +{ + SectionHandler *sectHandler = new SectionHandler(this); + sectHandler->startSection(attrib); + m_sections.append(sectHandler); +} + +void CompoundHandler::startBriefDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_brief = docHandler; +} + +void CompoundHandler::startDetailedDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_detailed = docHandler; +} + +void CompoundHandler::startCompound(const QXmlAttributes& attrib) +{ + m_parent->setDelegate(this); + m_id = attrib.value("id"); + m_kind = attrib.value("kind"); + printf("startCompound(id=`%s' type=`%s')\n",m_id.data(),m_kind.data()); +} + +void CompoundHandler::endCompound() +{ + printf("endCompound()\n"); + m_parent->setDelegate(0); +} + +void CompoundHandler::endCompoundName() +{ + m_name = m_curString.stripWhiteSpace(); + printf("Compound name `%s'\n",m_name.data()); +} + +void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) +{ + SuperClass *sc=new SuperClass( + attrib.value("idref"), + attrib.value("prot"), + attrib.value("virt") + ); + printf("super class id=`%s' prot=`%s' virt=`%s'\n", + sc->m_id.data(), + sc->m_protection.data(), + sc->m_virtualness.data()); + m_superClasses.append(sc); +} + +void CompoundHandler::addSubClass(const QXmlAttributes& attrib) +{ + SubClass *sc = new SubClass( + attrib.value("idref"), + attrib.value("prot"), + attrib.value("virt") + ); + printf("sub class id=`%s' prot=`%s' virt=`%s'\n", + sc->m_id.data(), + sc->m_protection.data(), + sc->m_virtualness.data()); + m_subClasses.append(sc); +} + diff --git a/addon/xmlparse/compoundhandler.h b/addon/xmlparse/compoundhandler.h new file mode 100644 index 0000000..cd7da55 --- /dev/null +++ b/addon/xmlparse/compoundhandler.h @@ -0,0 +1,57 @@ +#ifndef _COMPOUNDHANDLER_H +#define _COMPOUNDHANDLER_H + +#include <qstring.h> +#include <qlist.h> +#include <qxml.h> + +#include "basehandler.h" +#include "sectionhandler.h" + +class DocHandler; + +class CompoundHandler : public BaseHandler<CompoundHandler> +{ + public: + virtual void startSection(const QXmlAttributes& attrib); + virtual void startCompound(const QXmlAttributes& attrib); + virtual void addSuperClass(const QXmlAttributes& attrib); + virtual void addSubClass(const QXmlAttributes& attrib); + virtual void endCompound(); + virtual void endCompoundName(); + virtual void startBriefDesc(const QXmlAttributes& attrib); + virtual void startDetailedDesc(const QXmlAttributes& attrib); + + CompoundHandler(IBaseHandler *parent); + virtual ~CompoundHandler(); + private: + struct SuperClass + { + SuperClass(const QString &id,const QString &prot,const QString &virt) : + m_id(id),m_protection(prot),m_virtualness(virt) {} + + QString m_id; + QString m_protection; + QString m_virtualness; + }; + struct SubClass + { + SubClass(const QString &id,const QString &prot,const QString &virt) : + m_id(id),m_protection(prot),m_virtualness(virt) {} + + QString m_id; + QString m_protection; + QString m_virtualness; + }; + QList<SuperClass> m_superClasses; + QList<SubClass> m_subClasses; + QList<SectionHandler> m_sections; + IBaseHandler *m_parent; + DocHandler *m_brief; + DocHandler *m_detailed; + QString m_id; + QString m_kind; + QString m_name; +}; + +#endif diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp new file mode 100644 index 0000000..c9a96c4 --- /dev/null +++ b/addon/xmlparse/dochandler.cpp @@ -0,0 +1,316 @@ +#include "dochandler.h" + +//---------------------------------------------------------------------- +// MarkupHandler +//---------------------------------------------------------------------- + +MarkupHandler::MarkupHandler(QList<DocNode> &children,QString &curString) + : m_children(children), m_curString(curString), m_curMarkup(DocNode::Normal) +{ + addStartHandler("bold",this,&MarkupHandler::startBold); + addEndHandler("bold",this,&MarkupHandler::endBold); + + addStartHandler("emphasis",this,&MarkupHandler::startEmphasis); + addEndHandler("emphasis",this,&MarkupHandler::endEmphasis); + + addStartHandler("computeroutput",this,&MarkupHandler::startComputerOutput); + addEndHandler("computeroutput",this,&MarkupHandler::endComputerOutput); + + addStartHandler("center",this,&MarkupHandler::startCenter); + addEndHandler("center",this,&MarkupHandler::endCenter); + + addStartHandler("small",this,&MarkupHandler::startSmallFont); + addEndHandler("small",this,&MarkupHandler::endSmallFont); + + addStartHandler("subscript",this,&MarkupHandler::startSubscript); + addEndHandler("subscript",this,&MarkupHandler::endSubscript); + + addStartHandler("superscript",this,&MarkupHandler::startSuperscript); + addEndHandler("superscript",this,&MarkupHandler::endSuperscript); +} + +MarkupHandler::~MarkupHandler() +{ +} + +void MarkupHandler::addTextNode() +{ + if (!m_curString.isEmpty()) + { + m_children.append(new TextNode(m_curString,m_curMarkup)); + printf("addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup); + m_curString=""; + } +} + +void MarkupHandler::startBold(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Bold,TRUE)); + m_curMarkup |= DocNode::Bold; +} + +void MarkupHandler::endBold() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Bold,FALSE)); + m_curMarkup &= ~DocNode::Bold; +} + +void MarkupHandler::startEmphasis(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Emphasis,TRUE)); + m_curMarkup |= DocNode::Emphasis; +} + +void MarkupHandler::endEmphasis() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Emphasis,FALSE)); + m_curMarkup &= ~DocNode::Emphasis; +} + +void MarkupHandler::startComputerOutput(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,TRUE)); + m_curMarkup |= DocNode::ComputerOutput; +} + +void MarkupHandler::endComputerOutput() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::ComputerOutput,FALSE)); + m_curMarkup &= ~DocNode::ComputerOutput; +} + +void MarkupHandler::startCenter(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Center,TRUE)); + m_curMarkup |= DocNode::Center; +} + +void MarkupHandler::endCenter() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Center,FALSE)); + m_curMarkup &= ~DocNode::Center; +} + +void MarkupHandler::startSmallFont(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::SmallFont,TRUE)); + m_curMarkup |= DocNode::SmallFont; +} + +void MarkupHandler::endSmallFont() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::SmallFont,FALSE)); + m_curMarkup &= ~DocNode::SmallFont; +} + +void MarkupHandler::startSubscript(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Subscript,TRUE)); + m_curMarkup |= DocNode::Subscript; +} + +void MarkupHandler::endSubscript() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Subscript,FALSE)); + m_curMarkup &= ~DocNode::Subscript; +} + +void MarkupHandler::startSuperscript(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Superscript,TRUE)); + m_curMarkup |= DocNode::Superscript; +} + +void MarkupHandler::endSuperscript() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(DocNode::Superscript,FALSE)); + m_curMarkup &= ~DocNode::Superscript; +} + +//---------------------------------------------------------------------- +// ListItemHandler +//---------------------------------------------------------------------- + +ListItemHandler::ListItemHandler(IBaseHandler *parent) + : DocNode(ListItem), m_parent(parent) +{ + addEndHandler("listitem",this,&ListItemHandler::endListItem); + + addStartHandler("para",this,&ListItemHandler::startParagraph); +} + +ListItemHandler::~ListItemHandler() +{ +} + +void ListItemHandler::startListItem(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); + printf("start list item handler\n"); +} + +void ListItemHandler::endListItem() +{ + printf("end list item handler\n"); + m_parent->setDelegate(0); +} + +void ListItemHandler::startParagraph(const QXmlAttributes& attrib) +{ + ParagraphHandler *parHandler = new ParagraphHandler(this); + parHandler->startParagraph(attrib); + m_children.append(parHandler); +} + +//---------------------------------------------------------------------- +// ListHandler +//---------------------------------------------------------------------- + +ListHandler::ListHandler(NodeKind k,IBaseHandler *parent) + : DocNode(k), m_parent(parent) +{ + m_children.setAutoDelete(TRUE); + const char *endListName=0; + switch(k) + { + case ItemizedList : endListName="itemizedlist"; break; + case OrderedList : endListName="orderedlist"; break; + default: ASSERT(0); + } + addEndHandler(endListName,this,&ListHandler::endList); + + addStartHandler("listitem",this,&ListHandler::startListItem); +} + +ListHandler::~ListHandler() +{ +} + +void ListHandler::startList(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); +} + +void ListHandler::endList() +{ + m_parent->setDelegate(0); +} + +void ListHandler::startListItem(const QXmlAttributes& attrib) +{ + ListItemHandler *liHandler = new ListItemHandler(this); + liHandler->startListItem(attrib); + m_children.append(liHandler); +} + +//---------------------------------------------------------------------- +// ParagraphHandler +//---------------------------------------------------------------------- + +ParagraphHandler::ParagraphHandler(IBaseHandler *parent) + : DocNode(Para), m_parent(parent) +{ + m_children.setAutoDelete(TRUE); + + m_markupHandler = new MarkupHandler(m_children,m_curString); + setFallBackHandler(m_markupHandler); + + addEndHandler("para",this,&ParagraphHandler::endParagraph); + + addStartHandler("itemizedlist",this,&ParagraphHandler::startItemizedList); + addStartHandler("orderedlist",this,&ParagraphHandler::startOrderedList); +} + +ParagraphHandler::~ParagraphHandler() +{ +} + +void ParagraphHandler::startParagraph(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); + printf("para\n"); +} + +void ParagraphHandler::endParagraph() +{ + addTextNode(); + printf("end para\n"); + m_parent->setDelegate(0); +} + +void ParagraphHandler::startItemizedList(const QXmlAttributes& attrib) +{ + addTextNode(); + ListHandler *listHandler = new ListHandler(ItemizedList,this); + listHandler->startList(attrib); + m_children.append(listHandler); +} + +void ParagraphHandler::startOrderedList(const QXmlAttributes& attrib) +{ + addTextNode(); + ListHandler *listHandler = new ListHandler(OrderedList,this); + listHandler->startList(attrib); + m_children.append(listHandler); +} + +void ParagraphHandler::addTextNode() +{ + if (!m_curString.isEmpty()) + { + m_children.append(new TextNode(m_curString,m_markupHandler->markup())); + printf("addTextNode() text=%s markup=%x\n", + m_curString.data(),m_markupHandler->markup()); + m_curString=""; + } +} + +//---------------------------------------------------------------------- +// DocHandler +//---------------------------------------------------------------------- + +DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) +{ + addEndHandler("briefdescription",this,&DocHandler::endDoc); + addEndHandler("detaileddescription",this,&DocHandler::endDoc); + + addStartHandler("para",this,&DocHandler::startParagraph); +} + +DocHandler::~DocHandler() +{ +} + +void DocHandler::startDoc(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); + printf("start dochandler\n"); +} + +void DocHandler::endDoc() +{ + printf("end dochandler\n"); + m_parent->setDelegate(0); +} + +void DocHandler::startParagraph(const QXmlAttributes& attrib) +{ + ParagraphHandler *parHandler = new ParagraphHandler(this); + parHandler->startParagraph(attrib); + m_children.append(parHandler); +} + diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h new file mode 100644 index 0000000..761842f --- /dev/null +++ b/addon/xmlparse/dochandler.h @@ -0,0 +1,154 @@ +#ifndef _DOCHANDLER_H +#define _DOCHANDLER_H + +#include <qstring.h> +#include <qlist.h> +#include <qxml.h> + +#include "basehandler.h" + +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 + }; + DocNode(NodeKind k) : m_kind(k) {} + virtual ~DocNode() {} + + private: + NodeKind m_kind; +}; + +class TextNode : public DocNode +{ + public: + TextNode(const QString &t,int markup) + : DocNode(Text), m_text(t), m_markup(markup) {} + + private: + QString m_text; + int m_markup; +}; + +class MarkupModifierNode : public DocNode +{ + public: + MarkupModifierNode(int markup,bool enabled) + : DocNode(MarkupModifier), m_markup(markup), m_enabled(enabled) {} + + private: + int m_markup; + bool m_enabled; +}; + +class MarkupHandler : public BaseFallBackHandler<MarkupHandler> +{ + public: + MarkupHandler(QList<DocNode> &children,QString &curString); + virtual ~MarkupHandler(); + int markup() const { return m_curMarkup; } + + virtual void startBold(const QXmlAttributes &attrib); + virtual void endBold(); + virtual void startEmphasis(const QXmlAttributes &attrib); + virtual void endEmphasis(); + virtual void startComputerOutput(const QXmlAttributes &attrib); + virtual void endComputerOutput(); + virtual void startCenter(const QXmlAttributes &attrib); + virtual void endCenter(); + virtual void startSmallFont(const QXmlAttributes &attrib); + virtual void endSmallFont(); + virtual void startSubscript(const QXmlAttributes &attrib); + virtual void endSubscript(); + virtual void startSuperscript(const QXmlAttributes &attrib); + virtual void endSuperscript(); + + + private: + void addTextNode(); + + QList<DocNode> &m_children; + QString &m_curString; + int m_curMarkup; +}; + +class ListItemHandler : public DocNode, public BaseHandler<ListItemHandler> +{ + public: + ListItemHandler(IBaseHandler *parent); + virtual ~ListItemHandler(); + virtual void startListItem(const QXmlAttributes& attrib); + virtual void endListItem(); + virtual void startParagraph(const QXmlAttributes& attrib); + + private: + IBaseHandler *m_parent; + QList<DocNode> m_children; +}; + +class ListHandler : public DocNode, public BaseHandler<ListHandler> +{ + public: + ListHandler(NodeKind k,IBaseHandler *parent); + virtual ~ListHandler(); + virtual void startList(const QXmlAttributes& attrib); + virtual void endList(); + virtual void startListItem(const QXmlAttributes& attrib); + + private: + IBaseHandler *m_parent; + QList<DocNode> m_children; +}; + +class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> +{ + public: + virtual void startParagraph(const QXmlAttributes& attrib); + virtual void endParagraph(); + virtual void startItemizedList(const QXmlAttributes& attrib); + virtual void startOrderedList(const QXmlAttributes& attrib); + + ParagraphHandler(IBaseHandler *parent); + virtual ~ParagraphHandler(); + + private: + void addTextNode(); + IBaseHandler *m_parent; + QList<DocNode> m_children; + MarkupHandler *m_markupHandler; +}; + + +class DocHandler : public BaseHandler<DocHandler> +{ + public: + virtual void startDoc(const QXmlAttributes& attrib); + virtual void endDoc(); + virtual void startParagraph(const QXmlAttributes& attrib); + + DocHandler(IBaseHandler *parent); + virtual ~DocHandler(); + private: + IBaseHandler *m_parent; + QList<DocNode> m_children; +}; + +#endif diff --git a/addon/xmlparse/main.cpp b/addon/xmlparse/main.cpp new file mode 100644 index 0000000..82cc849 --- /dev/null +++ b/addon/xmlparse/main.cpp @@ -0,0 +1,54 @@ +#include "mainhandler.h" + +#include <qstring.h> +#include <qxml.h> +#include <qfile.h> +#include <qdict.h> +#include <qlist.h> + +class ErrorHandler : public QXmlErrorHandler +{ + public: + virtual ~ErrorHandler() {} + bool warning( const QXmlParseException & ) + { + return FALSE; + } + bool error( const QXmlParseException & ) + { + return FALSE; + } + bool fatalError( const QXmlParseException &exception ) + { + fprintf(stderr,"Fatal error at line %d column %d: %s\n", + exception.lineNumber(),exception.columnNumber(), + exception.message().data()); + return FALSE; + } + QString errorString() { return ""; } + + private: + QString errorMsg; +}; + + +int main(int argc,char **argv) +{ + if (argc==1) + { + printf("Usage: %s file.xml\n",argv[0]); + exit(1); + } + + 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/mainhandler.cpp b/addon/xmlparse/mainhandler.cpp new file mode 100644 index 0000000..b062578 --- /dev/null +++ b/addon/xmlparse/mainhandler.cpp @@ -0,0 +1,23 @@ +#include "mainhandler.h" + +void MainHandler::startCompound(const QXmlAttributes& attrib) +{ + CompoundHandler *compHandler = new CompoundHandler(this); + compHandler->startCompound(attrib); + m_compounds.append(compHandler); +} + +MainHandler::MainHandler() +{ + m_compounds.setAutoDelete(TRUE); + addStartHandler("doxygen"); + addStartHandler("compounddef",this,&MainHandler::startCompound); + addEndHandler("doxygen"); + addEndHandler("compounddef"); +} + +MainHandler::~MainHandler() +{ +} + + diff --git a/addon/xmlparse/mainhandler.h b/addon/xmlparse/mainhandler.h new file mode 100644 index 0000000..20eedc3 --- /dev/null +++ b/addon/xmlparse/mainhandler.h @@ -0,0 +1,18 @@ +#ifndef _MAINHANDLER_H +#define _MAINHANDLER_H + +#include <qlist.h> +#include "basehandler.h" +#include "compoundhandler.h" + +class MainHandler : public BaseHandler<MainHandler> +{ + public: + virtual void startCompound(const QXmlAttributes& attrib); + MainHandler(); + virtual ~MainHandler(); + private: + QList<CompoundHandler> m_compounds; +}; + +#endif diff --git a/addon/xmlparse/memberhandler.cpp b/addon/xmlparse/memberhandler.cpp new file mode 100644 index 0000000..1130f8d --- /dev/null +++ b/addon/xmlparse/memberhandler.cpp @@ -0,0 +1,77 @@ +#include "memberhandler.h" +#include "sectionhandler.h" +#include "dochandler.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); + +} + +MemberHandler::~MemberHandler() +{ +} + +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::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); +} + + diff --git a/addon/xmlparse/memberhandler.h b/addon/xmlparse/memberhandler.h new file mode 100644 index 0000000..5f19ee2 --- /dev/null +++ b/addon/xmlparse/memberhandler.h @@ -0,0 +1,39 @@ +#ifndef _MEMBERHANDLER_H +#define _MEMBERHANDLER_H + +#include <qstring.h> +#include <qlist.h> +#include <qxml.h> + +#include "basehandler.h" +#include "paramhandler.h" + +class DocHandler; + +class MemberHandler : 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); + + MemberHandler(IBaseHandler *parent); + virtual ~MemberHandler(); + private: + 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<ParamHandler> m_params; +}; + +#endif diff --git a/addon/xmlparse/paramhandler.cpp b/addon/xmlparse/paramhandler.cpp new file mode 100644 index 0000000..3563ebd --- /dev/null +++ b/addon/xmlparse/paramhandler.cpp @@ -0,0 +1,79 @@ +#include "paramhandler.h" +#include "memberhandler.h" + +ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) +{ + addEndHandler("param",this,&ParamHandler::endParam); + + addStartHandler("type"); + addEndHandler("type",this,&ParamHandler::endType); + + addStartHandler("declname"); + addEndHandler("declname",this,&ParamHandler::endDeclName); + + addStartHandler("defname"); + addEndHandler("defname",this,&ParamHandler::endDefName); + + addStartHandler("array"); + addEndHandler("array",this,&ParamHandler::endArray); + + addStartHandler("attrib"); + addEndHandler("attrib",this,&ParamHandler::endAttrib); + + addStartHandler("defval"); + addEndHandler("defval",this,&ParamHandler::endDefVal); +} + +ParamHandler::~ParamHandler() +{ +} + +void ParamHandler::startParam(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); + printf("param\n"); +} + +void ParamHandler::endParam() +{ + m_parent->setDelegate(0); +} + +void ParamHandler::endType() +{ + m_type = m_curString.stripWhiteSpace(); + printf("param type=`%s'\n",m_type.data()); +} + +void ParamHandler::endDeclName() +{ + m_declName = m_curString.stripWhiteSpace(); + printf("member declName=`%s'\n",m_declName.data()); +} + +void ParamHandler::endDefName() +{ + m_defName = m_curString.stripWhiteSpace(); + printf("member defName=`%s'\n",m_defName.data()); +} + +void ParamHandler::endAttrib() +{ + m_attrib = m_curString.stripWhiteSpace(); + printf("member attrib=`%s'\n",m_attrib.data()); +} + +void ParamHandler::endArray() +{ + m_array = m_curString.stripWhiteSpace(); + printf("member array=`%s'\n",m_array.data()); +} + +void ParamHandler::endDefVal() +{ + m_defVal = m_curString.stripWhiteSpace(); + printf("member defVal=`%s'\n",m_defVal.data()); +} + + + diff --git a/addon/xmlparse/paramhandler.h b/addon/xmlparse/paramhandler.h new file mode 100644 index 0000000..062bab1 --- /dev/null +++ b/addon/xmlparse/paramhandler.h @@ -0,0 +1,34 @@ +#ifndef _PARAMHANDLER_H +#define _PARAMHANDLER_H + +#include <qstring.h> +#include <qlist.h> +#include <qxml.h> + +#include "basehandler.h" + +class ParamHandler : public BaseHandler<ParamHandler> +{ + public: + virtual void startParam(const QXmlAttributes& attrib); + virtual void endParam(); + virtual void endType(); + virtual void endDeclName(); + virtual void endDefName(); + virtual void endAttrib(); + virtual void endArray(); + virtual void endDefVal(); + + ParamHandler(IBaseHandler *parent); + virtual ~ParamHandler(); + private: + IBaseHandler *m_parent; + QString m_type; + QString m_declName; + QString m_defName; + QString m_attrib; + QString m_array; + QString m_defVal; +}; + +#endif diff --git a/addon/xmlparse/sectionhandler.cpp b/addon/xmlparse/sectionhandler.cpp new file mode 100644 index 0000000..0b63832 --- /dev/null +++ b/addon/xmlparse/sectionhandler.cpp @@ -0,0 +1,34 @@ +#include "compoundhandler.h" +#include "sectionhandler.h" + +SectionHandler::SectionHandler(IBaseHandler *parent) : m_parent(parent) +{ + m_members.setAutoDelete(TRUE); + addEndHandler("sectiondef",this,&SectionHandler::endSection); + addStartHandler("memberdef",this,&SectionHandler::startMember); +} + +SectionHandler::~SectionHandler() +{ +} + +void SectionHandler::startSection(const QXmlAttributes& attrib) +{ + m_parent->setDelegate(this); + m_kind = attrib.value("kind"); + printf("section kind=`%s'\n",m_kind.data()); +} + +void SectionHandler::endSection() +{ + m_parent->setDelegate(0); +} + +void SectionHandler::startMember(const QXmlAttributes& attrib) +{ + MemberHandler *memHandler = new MemberHandler(this); + memHandler->startMember(attrib); + m_members.append(memHandler); +} + + diff --git a/addon/xmlparse/sectionhandler.h b/addon/xmlparse/sectionhandler.h new file mode 100644 index 0000000..b2d1ce1 --- /dev/null +++ b/addon/xmlparse/sectionhandler.h @@ -0,0 +1,26 @@ +#ifndef _SECTIONHANDLER_H +#define _SECTIONHANDLER_H + +#include <qstring.h> +#include <qlist.h> +#include <qxml.h> + +#include "basehandler.h" +#include "memberhandler.h" + +class SectionHandler : public BaseHandler<SectionHandler> +{ + public: + virtual void startMember(const QXmlAttributes& attrib); + virtual void startSection(const QXmlAttributes& attrib); + virtual void endSection(); + + SectionHandler(IBaseHandler *parent); + virtual ~SectionHandler(); + private: + IBaseHandler *m_parent; + QString m_kind; + QList<MemberHandler> m_members; +}; + +#endif diff --git a/addon/xmlparse/xmlparse.pro.in b/addon/xmlparse/xmlparse.pro.in new file mode 100644 index 0000000..9e3b6aa --- /dev/null +++ b/addon/xmlparse/xmlparse.pro.in @@ -0,0 +1,26 @@ +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 + diff --git a/addon/xmlread/Doxyfile b/addon/xmlread/Doxyfile deleted file mode 100644 index fa17d6f..0000000 --- a/addon/xmlread/Doxyfile +++ /dev/null @@ -1,142 +0,0 @@ -# Doxyfile 1.2.0 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = xmlread -PROJECT_NUMBER = -OUTPUT_DIRECTORY = doc -OUTPUT_LANGUAGE = English -DISABLE_INDEX = NO -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = NO -CLASS_DIAGRAMS = YES -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = YES -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -TAB_SIZE = 8 -ENABLED_SECTIONS = -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = "$file:$line: $text" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = . -FILE_PATTERNS = *.h *.cpp -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -IMAGE_PATH = -INPUT_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = search.cgi -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = /usr/local/bin/ -EXT_DOC_PATHS = diff --git a/addon/xmlread/Makefile.in b/addon/xmlread/Makefile.in deleted file mode 100644 index 723887e..0000000 --- a/addon/xmlread/Makefile.in +++ /dev/null @@ -1,12 +0,0 @@ -all clean depend: Makefile.xmlread - $(MAKE) -f Makefile.xmlread $@ - -distclean: clean - $(RM) -f Makefile.xmlread - -tmake: - export TMAKEPATH=$(TMAKEPATH) ; $(PERL) $(TMAKE) xmlread.pro >Makefile.xmlread - -Makefile.xmlread: xmlread.pro - export TMAKEPATH=$(TMAKEPATH) ; $(PERL) $(TMAKE) xmlread.pro >Makefile.xmlread - diff --git a/addon/xmlread/README b/addon/xmlread/README deleted file mode 100644 index 9420de6..0000000 --- a/addon/xmlread/README +++ /dev/null @@ -1,9 +0,0 @@ -This is a small utility that is used to test and validate the -XML output generated by doxygen (when GENERATE_XML = YES). - -It uses the Xerces-C XML parser/validator (see http://xml.apache.org) -and expects the environment variable XERCESCROOT to point to the root -of the Xerces package. - -Currently is reads an XML file, validates it, and prints the class -hierarchy contained in it. diff --git a/addon/xmlread/compounddef.h b/addon/xmlread/compounddef.h deleted file mode 100644 index 95f5b84..0000000 --- a/addon/xmlread/compounddef.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef COMPOUNDDEF_H -#define COMPOUNDDEF_H - -#include "qtbc.h" -#include <qlist.h> -#include <qdict.h> -#include <qstrlist.h> - -/*! Abstract interface for a compound as presented to the user */ -class CompoundDef -{ - public: - /*! Possible compound types */ - enum Type { Unknown_t, Class_t, Struct_t, Union_t, - File_t, Namespace_t, Group_t, Interface_t }; - /*! Destructor */ - virtual ~CompoundDef() {} - - /*! Returns the name of this compound */ - virtual QCString name() const = 0; - /*! Returns the type of this compound */ - virtual Type type() const = 0; - /*! Returns the unique identifier for this compound */ - virtual QCString id() const = 0; - /*! Returns the list of base compounds from which this compound inherits */ - virtual QList<CompoundDef> *baseCompounds() const = 0; - /*! Returns the list of compounds that derive from this one */ - virtual QList<CompoundDef> *derivedCompounds() const = 0; -}; - -/*! Ordered dictionary of abstract compounds. */ -class CompoundSDict : public QList<CompoundDef> -{ - friend class CompoundSDictIterator; - - public: - /*! Create an ordered dictionary. - * \param size The size of the dictionary. Should be a prime number for - * best distribution of elements. - */ - CompoundSDict(int size) - { - m_list = new QList<CompoundDef>; - m_list->setAutoDelete(TRUE); - m_dict = new QDict<CompoundDef>(size); - } - /*! Destroys the dictionary */ - ~CompoundSDict() - { - delete m_list; - delete m_dict; - } - /*! Appends a compound to the dictionary. The element is owned by the - * dictionary. - * \param key The unique key to use to quicky find the item later on. - * \param d The compound to add. - * \sa find() - */ - void append(const char *key,CompoundDef *d) - { - m_list->append(d); - m_dict->insert(key,d); - } - /*! Looks up a compound given its key. - * \param key The key to identify this element. - * \return The requested compound or zero if it cannot be found. - * \sa append() - */ - CompoundDef *find(const char *key) - { - return m_dict->find(key); - } - - private: - QList<CompoundDef> *m_list; - QDict<CompoundDef> *m_dict; -}; - -/*! Simple iterator for CompoundSDict. It iterates in the order the - * element were appended. - */ -class CompoundSDictIterator -{ - public: - /*! Create an iterator given the dictionary. */ - CompoundSDictIterator(const CompoundSDict &dict) - { - m_li = new QListIterator<CompoundDef>(*dict.m_list); - } - /*! Destroys the dictionary */ - ~CompoundSDictIterator() - { - delete m_li; - } - /*! Set the iterator to the first element in the list. - * \return The first compound, or zero if the list was empty. - */ - CompoundDef *toFirst() const - { - return m_li->toFirst(); - } - /*! Returns the current compound */ - CompoundDef *current() const - { - return m_li->current(); - } - /*! Moves the iterator to the next element. - * \return the new "current" element, or zero if the iterator was - * already pointing at the last element. - */ - CompoundDef *operator++() - { - return m_li->operator++(); - } - - private: - QListIterator<CompoundDef> *m_li; -}; - -/*! Concrete compound implementation. Used internally by the sax handlers */ -class CompoundDef_Impl : public CompoundDef -{ - public: - /*! Create an compound implementation object */ - CompoundDef_Impl() - { - m_type = Unknown_t; - m_baseCompounds = new QList<CompoundDef>; - m_derivedCompounds = new QList<CompoundDef>; - } - /*! Destroy the implementation object */ - ~CompoundDef_Impl() - { - delete m_baseCompounds; - delete m_derivedCompounds; - } - - /* implementation of the abstract interface */ - Type type() const { return m_type; } - QCString name() const { return m_name; } - QCString id() const { return m_id; } - QList<CompoundDef> *baseCompounds() const { return m_baseCompounds; } - QList<CompoundDef> *derivedCompounds() const { return m_derivedCompounds; } - - /*! Sets the type of the compound to \a t. */ - void setType(Type t) { m_type = t; } - /*! Sets the name of the compound to \a name. */ - void setName(const char *name) { m_name=name; } - /*! Sets the Id of the compound to \a id. */ - void setId(const char *id) { m_id=id; } - /*! Adds a new reference to the internal base class reference list */ - void addBaseRef(const char *name) { m_baseRefs.append(name); } - /*! Adds a new reference to the internal derived class reference list */ - void addDerivedRef(const char *name) { m_derivedRefs.append(name); } - - /*! Resolve the base and derived compound references. */ - void resolveReferences(CompoundSDict *dict) - { - char *refId; - refId = m_baseRefs.first(); - while (refId) - { - CompoundDef *cd = dict->find(refId); - m_baseCompounds->append(cd); - refId = m_baseRefs.next(); - } - refId = m_derivedRefs.first(); - while (refId) - { - CompoundDef *cd = dict->find(refId); - m_derivedCompounds->append(cd); - refId = m_derivedRefs.next(); - } - } - - private: - Type m_type; - QCString m_name; - QCString m_id; - QStrList m_derivedRefs; - QStrList m_baseRefs; - QList<CompoundDef> *m_baseCompounds; - QList<CompoundDef> *m_derivedCompounds; -}; - -#endif diff --git a/addon/xmlread/main.cpp b/addon/xmlread/main.cpp deleted file mode 100644 index 3f607f4..0000000 --- a/addon/xmlread/main.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <util/PlatformUtils.hpp> -#include <parsers/SAXParser.hpp> -#include "strx.h" -#include "saxhandlers.h" -#include "compounddef.h" - -// --------------------------------------------------------------------------- -// Local data -// -// xmlFile -// The path to the file to parser. Set via command line. -// -// --------------------------------------------------------------------------- -static char* xmlFile = 0; - -// --------------------------------------------------------------------------- -// Local helper methods -// --------------------------------------------------------------------------- -static void usage() -{ - cout << "\nUsage: xmlread file.xml\n" - << " Extracts the class hierarchy from a doxygen generated XML file.\n" - << endl; -} - -// recursively display non-root compounds -static void showDerivedCompounds(QList<CompoundDef> *compoundList,int level) -{ - if (compoundList->count()>0) - { - QListIterator<CompoundDef> cli(*compoundList); - CompoundDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) - { - int i; - for (i=0;i<level;i++) cout << " "; - cout << cd->name() << endl; - showDerivedCompounds(cd->derivedCompounds(),level+1); - } - } -} - -// show compound hierarchy -static void showCompoundHierarchy(CompoundSDict *compounds) -{ - CompoundSDictIterator cdi(*compounds); - CompoundDef *cd; - for (cdi.toFirst();(cd=cdi.current());++cdi) - { - if (cd->type()==CompoundDef::Class_t && - cd->baseCompounds()->count()==0) // root compound - { - cout << cd->name() << endl; - showDerivedCompounds(cd->derivedCompounds(),1); - } - } -} - -// --------------------------------------------------------------------------- -// Program entry point -// --------------------------------------------------------------------------- -int main(int argC, char* argV[]) -{ - // Initialize the XML4C2 system - try - { - XMLPlatformUtils::Initialize(); - } - catch (const XMLException& toCatch) - { - cerr << "Error during initialization! :\n" - << StrX(toCatch.getMessage()) << endl; - return 1; - } - - // Check command line and extract arguments. - if (argC!=2) - { - usage(); - return 1; - } - - // Watch for special case help request - if (strcmp(argV[1], "-?") == 0) - { - usage(); - return 0; - } - - // Assume the argument is a file name - xmlFile = argV[1]; - - // - // Create a SAX validating parser object. - // - SAXParser parser; - parser.setDoValidation(TRUE); - - // Create a compound dictionary, where the results will be stored. - // The size of the dictionary is 1009 entries (should be a prime number) - CompoundSDict compounds(1009); - - // - // Create the handler object and install it as the document and error - // handler for the parser. - // - SaxPass1Handlers handler(&compounds); - parser.setDocumentHandler(&handler); - parser.setErrorHandler(&handler); - - // Parse the file and catch any exceptions that propogate out - try - { - parser.parse(xmlFile); - } - catch (const XMLException& toCatch) - { - cerr << "\nFile not found: '" << xmlFile << "'\n" - << "Exception message is: \n" - << StrX(toCatch.getMessage()) - << "\n" << endl; - return -1; - } - - // Show the class hierarchy that we extracted - showCompoundHierarchy(&compounds); - - return 0; -} - diff --git a/addon/xmlread/qtbc.h b/addon/xmlread/qtbc.h deleted file mode 100644 index 51f62dd..0000000 --- a/addon/xmlread/qtbc.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** - * - * - * - * 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. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#ifndef QTBC_H -#define QTBC_H - -/*! This file contains some hacks to make Doxygen work with - * Qt version 2.00 and Qt version 1.xx - */ - -#include <qglobal.h> - -#if QT_VERSION >= 200 - -#include <locale.h> - -#define GCI QCollection::Item - -#include <qcstring.h> -#include <qstring.h> -inline QCString convertToQCString(const QString &s) { return s.latin1(); } - -#else /* QT_VERSION < 200 */ - -#include <qstring.h> -#define QCString QString -inline QCString convertToQCString(const QCString &s) { return s; } - -#endif - -#endif diff --git a/addon/xmlread/saxhandlers.cpp b/addon/xmlread/saxhandlers.cpp deleted file mode 100644 index de8de89..0000000 --- a/addon/xmlread/saxhandlers.cpp +++ /dev/null @@ -1,185 +0,0 @@ - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <util/XMLUni.hpp> -#include <sax/AttributeList.hpp> -#include "saxhandlers.h" -#include "strx.h" -#include <iostream.h> - -static void error(const SAXParseException& e) -{ - cerr << "\nError at (file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "): " << StrX(e.getMessage()) << endl; - exit(1); -} - -static void fatalError(const SAXParseException& e) -{ - cerr << "\nFatal Error at (file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "): " << StrX(e.getMessage()) << endl; - exit(1); -} - -static void warning(const SAXParseException& e) -{ - cerr << "\nWarning at (file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "): " << StrX(e.getMessage()) << endl; - exit(1); -} - -// --------------------------------------------------------------------------- -// SaxPass1Handlers: Constructors and Destructor -// --------------------------------------------------------------------------- -SaxPass1Handlers::SaxPass1Handlers(CompoundSDict *comp) : m_compounds(comp) -{ - m_currentCompound = 0; -} - -SaxPass1Handlers::~SaxPass1Handlers() -{ -} - -// --------------------------------------------------------------------------- -// SaxPass1Handlers: Overrides of the SAX ErrorHandler interface -// --------------------------------------------------------------------------- -void SaxPass1Handlers::error(const SAXParseException& e) -{ - ::error(e); -} - -void SaxPass1Handlers::fatalError(const SAXParseException& e) -{ - ::fatalError(e); -} - -void SaxPass1Handlers::warning(const SAXParseException& e) -{ - ::warning(e); -} - -// --------------------------------------------------------------------------- -// SaxPass1Handlers: Overrides of the SAX DocumentHandler interface -// --------------------------------------------------------------------------- -void SaxPass1Handlers::characters(const XMLCh* const chars, - const unsigned int /*length*/ - ) -{ - if (m_charAction==ReadCompoundName) - { - m_compoundName=StrX(chars); - m_charAction=Done; - } -} - -void SaxPass1Handlers::endDocument() -{ - // resolve all references - CompoundSDictIterator cdi(*m_compounds); - CompoundDef *cd; - for (cdi.toFirst();(cd=cdi.current());++cdi) - { - CompoundDef_Impl *impl = dynamic_cast<CompoundDef_Impl*>(cd); - impl->resolveReferences(m_compounds); - } -} - -void SaxPass1Handlers::startElement(const XMLCh* const name, - AttributeList& attributes - ) -{ - QCString sname = StrX(name); - if (sname=="compounddef") - { - m_currentCompound = new CompoundDef_Impl; - unsigned int len = attributes.getLength(),index; - for (index = 0; index < len; index++) - { - QCString attName = StrX(attributes.getName(index)); - QCString attValue = StrX(attributes.getValue(index)); - if (attName == "id") - { - m_currentCompound->setId(attValue); - } - else if (attName=="type") - { - if (attValue=="class") - { - m_currentCompound->setType(CompoundDef::Class_t); - } - else if (attValue=="struct") - { - m_currentCompound->setType(CompoundDef::Struct_t); - } - else if (attValue=="union") - { - m_currentCompound->setType(CompoundDef::Union_t); - } - else if (attValue=="interface") - { - m_currentCompound->setType(CompoundDef::Interface_t); - } - else if (attValue=="file") - { - m_currentCompound->setType(CompoundDef::File_t); - } - else - { - cerr << "Unsupported compound type: " << attValue << "\n"; - } - } - } - } - else if (sname=="compoundname") - { - m_charAction = ReadCompoundName; - } - else if (sname=="basecompoundref") - { - unsigned int len = attributes.getLength(),index; - for (index = 0; index < len; index++) - { - QCString attName = StrX(attributes.getName(index)); - QCString attValue = StrX(attributes.getValue(index)); - if (attName=="idref") - { - m_currentCompound->addBaseRef(attValue); - } - } - } - else if (sname=="derivedcompoundref") - { - unsigned int len = attributes.getLength(),index; - for (index = 0; index < len; index++) - { - QCString attName = StrX(attributes.getName(index)); - QCString attValue = StrX(attributes.getValue(index)); - if (attName=="idref") - { - m_currentCompound->addDerivedRef(attValue); - } - } - } -} - -void SaxPass1Handlers::endElement(const XMLCh* const name) -{ - QCString sname = StrX(name); - if (sname=="compounddef") - { - m_compounds->append(m_currentCompound->id(),m_currentCompound); - m_currentCompound=0; - } - else if (sname=="compoundname") - { - m_currentCompound->setName(m_compoundName); - } -} - diff --git a/addon/xmlread/saxhandlers.h b/addon/xmlread/saxhandlers.h deleted file mode 100644 index c9f38b8..0000000 --- a/addon/xmlread/saxhandlers.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _SAXHANDLERS_H -#define _SAXHANDLERS_H - -#include "compounddef.h" -#include <sax/HandlerBase.hpp> - -/*! SAX Handlers used for pass 1. */ -class SaxPass1Handlers : public HandlerBase -{ - public: - // ----------------------------------------------------------------------- - //! @name Constructors - // ----------------------------------------------------------------------- - //@{ - /*! Constructor */ - SaxPass1Handlers(CompoundSDict *comp); - /*! Destructor */ - ~SaxPass1Handlers(); - //@} - - // ----------------------------------------------------------------------- - //! @name Implementations of the SAX DocumentHandler interface - // ----------------------------------------------------------------------- - //@{ - /*! Handler called at the start of the XML document */ - void startDocument() {} - /*! Handler called at the end of the XML document */ - void endDocument(); - /*! Handler called when an element is found in the XML file - * \param name The element's name. - * \param attributes The list of attributes for the element. - */ - void startElement(const XMLCh* const name, AttributeList& attributes); - /*! Handler called when the element of an element is found in the XML file - * \param name The element's name. - */ - void endElement(const XMLCh* const name); - /*! Handler called when a character string is found in the XML file. - * \param chars Zero terminated string of characters. - * \param length The number of characters in the string. - */ - void characters(const XMLCh* const chars, const unsigned int length); - - /*! Handler called when an amount of whitespace is found, that is not - * Part of the text. - */ - void ignorableWhitespace(const XMLCh* const /*chars*/, - const unsigned int /*length*/ - ) {} - - /*! Handler called when a preprocessing intruction is found. - */ - void processingInstruction(const XMLCh* const /*target*/, - const XMLCh* const /*data*/ - ) {} - //@} - - // ----------------------------------------------------------------------- - //! @name Implementations of the SAX ErrorHandler interface - // ----------------------------------------------------------------------- - //@{ - /*! Handler called for a parser warning. */ - void warning(const SAXParseException& exception); - /*! Handler called for a parser error. */ - void error(const SAXParseException& exception); - /*! Handler called for a parser fatal error. */ - void fatalError(const SAXParseException& exception); - //@} - - // ----------------------------------------------------------------------- - //! @name Implementation of the SAX DTDHandler interface - // ----------------------------------------------------------------------- - //@{ - /*! Handler for DTD notation declaration. */ - void notationDecl(const XMLCh* const /*name*/, - const XMLCh* const /*publicId*/, - const XMLCh* const /*systemId*/ - ) {} - - /*! Handler for DTD unparsed entity declaration. */ - void unparsedEntityDecl(const XMLCh* const /*name*/, - const XMLCh* const /*publicId*/, - const XMLCh* const /*systemId*/, - const XMLCh* const /*notationName*/ - ) {} - //@} - - private: - // ----------------------------------------------------------------------- - // Private data members - // - // ----------------------------------------------------------------------- - - enum CharActions { Done, ReadCompoundName }; - CompoundSDict *m_compounds; - CompoundDef_Impl *m_currentCompound; - QCString m_compoundName; - CharActions m_charAction; -}; - -#endif diff --git a/addon/xmlread/strx.h b/addon/xmlread/strx.h deleted file mode 100644 index ee58791..0000000 --- a/addon/xmlread/strx.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _STRX_H -#define _STRX_H - -// --------------------------------------------------------------------------- -// Includes for all the program files to see -// --------------------------------------------------------------------------- -#include "qtbc.h" -#include <iostream.h> - -/*! - * This is a simple wrapper class around QCString that lets us do easy - * trancoding of XMLCh data to local code page for display. - */ -class StrX : public QCString -{ - public: - /*! Constructor */ - StrX(const XMLCh* const toTranscode) : - QCString(XMLString::transcode(toTranscode)) {} - /*! Destructor */ - ~StrX() {} -}; - -#endif diff --git a/addon/xmlread/xmlread.pro.in b/addon/xmlread/xmlread.pro.in deleted file mode 100644 index 0a59a9a..0000000 --- a/addon/xmlread/xmlread.pro.in +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -CONFIG = console qt warn_on debug -HEADERS = saxhandler.h strx.h compounddef.h -SOURCES = main.cpp \ - saxhandlers.cpp -LIBS = -lxerces-c1_2 -L$(XERCESCROOT)/lib -INCLUDEPATH = $(XERCESCROOT)/include |