summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
Diffstat (limited to 'addon')
-rw-r--r--addon/doxmlparser/Doxyfile2
-rw-r--r--addon/doxmlparser/examples/metrics/Makefile.in13
-rw-r--r--addon/doxmlparser/examples/metrics/main.cpp252
-rw-r--r--addon/doxmlparser/examples/metrics/metrics.pro.in20
-rw-r--r--addon/doxmlparser/include/doxmlintf.h107
-rw-r--r--addon/doxmlparser/src/basehandler.h40
-rw-r--r--addon/doxmlparser/src/baseiterator.h2
-rw-r--r--addon/doxmlparser/src/compoundhandler.cpp154
-rw-r--r--addon/doxmlparser/src/compoundhandler.h41
-rw-r--r--addon/doxmlparser/src/debug.cpp24
-rw-r--r--addon/doxmlparser/src/debug.h7
-rw-r--r--addon/doxmlparser/src/dochandler.cpp148
-rw-r--r--addon/doxmlparser/src/dochandler.h21
-rw-r--r--addon/doxmlparser/src/doxmlintf.h107
-rw-r--r--addon/doxmlparser/src/doxmlparser.pro.in6
-rw-r--r--addon/doxmlparser/src/linkedtexthandler.cpp36
-rw-r--r--addon/doxmlparser/src/linkedtexthandler.h3
-rw-r--r--addon/doxmlparser/src/mainhandler.cpp289
-rw-r--r--addon/doxmlparser/src/mainhandler.h77
-rw-r--r--addon/doxmlparser/src/memberhandler.cpp97
-rw-r--r--addon/doxmlparser/src/memberhandler.h36
-rw-r--r--addon/doxmlparser/src/paramhandler.cpp20
-rw-r--r--addon/doxmlparser/src/paramhandler.h2
-rw-r--r--addon/doxmlparser/src/sectionhandler.cpp84
-rw-r--r--addon/doxmlparser/src/sectionhandler.h37
-rw-r--r--addon/doxmlparser/test/main.cpp17
-rw-r--r--addon/doxywizard/Makefile.in2
-rw-r--r--addon/doxywizard/Makefile.win_nmake.in2
-rw-r--r--addon/doxywizard/doxywizard.cpp2
-rw-r--r--addon/doxywizard/doxywizard.h2
-rw-r--r--addon/doxywizard/doxywizard.pro.in2
-rw-r--r--addon/doxywizard/inputbool.cpp2
-rw-r--r--addon/doxywizard/inputbool.h2
-rw-r--r--addon/doxywizard/inputint.cpp2
-rw-r--r--addon/doxywizard/inputint.h2
-rw-r--r--addon/doxywizard/inputstring.cpp2
-rw-r--r--addon/doxywizard/inputstring.h2
-rw-r--r--addon/doxywizard/inputstrlist.cpp2
-rw-r--r--addon/doxywizard/inputstrlist.h2
-rw-r--r--addon/doxywizard/pagewidget.cpp2
-rw-r--r--addon/doxywizard/pagewidget.h2
-rw-r--r--addon/doxywizard/pixmaps.cpp2
-rw-r--r--addon/doxywizard/pixmaps.h2
-rw-r--r--addon/doxywizard/qtbc.h2
44 files changed, 1360 insertions, 318 deletions
diff --git a/addon/doxmlparser/Doxyfile b/addon/doxmlparser/Doxyfile
index 6225af2..50d205a 100644
--- a/addon/doxmlparser/Doxyfile
+++ b/addon/doxmlparser/Doxyfile
@@ -43,7 +43,7 @@ SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-QUIET = YES
+QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT =
diff --git a/addon/doxmlparser/examples/metrics/Makefile.in b/addon/doxmlparser/examples/metrics/Makefile.in
new file mode 100644
index 0000000..83cbc28
--- /dev/null
+++ b/addon/doxmlparser/examples/metrics/Makefile.in
@@ -0,0 +1,13 @@
+all clean depend: Makefile.metrics
+ $(MAKE) -f Makefile.metrics $@
+
+distclean: clean
+ $(RM) -rf Makefile.metrics metrics.pro Makefile obj
+
+tmake:
+ $(ENV) $(PERL) $(TMAKE) metrics.pro >Makefile.metrics
+
+Makefile.metrics: metrics.pro
+ $(ENV) $(PERL) $(TMAKE) metrics.pro >Makefile.metrics
+
+install:
diff --git a/addon/doxmlparser/examples/metrics/main.cpp b/addon/doxmlparser/examples/metrics/main.cpp
new file mode 100644
index 0000000..6c2ad1a
--- /dev/null
+++ b/addon/doxmlparser/examples/metrics/main.cpp
@@ -0,0 +1,252 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2002 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.
+ *
+ */
+
+/*! \mainpage Metrics
+ * This is a small example that shows how to use doxygen's XML output and
+ * the doxmlparser library. The example shows some very basic code metrics.
+ */
+
+#include <stdio.h>
+#include <doxmlintf.h>
+
+bool isDocumented(IDocRoot *brief,IDocRoot *detailed)
+{
+ bool found=FALSE;
+ if (brief)
+ {
+ IDocIterator *docIt = brief->contents();
+ if (docIt->current()) // method has brief description
+ {
+ found=TRUE;
+ }
+ docIt->release();
+ }
+ if (detailed && !found)
+ {
+ IDocIterator *docIt = detailed->contents();
+ if (docIt->current())
+ {
+ found=TRUE;
+ }
+ docIt->release();
+ }
+ return found;
+}
+
+int main(int argc,char **argv)
+{
+ if (argc!=2)
+ {
+ printf("Usage: %s xml_output_dir\n",argv[0]);
+ exit(1);
+ }
+
+ int numClasses=0;
+ int numDocClasses=0;
+ int numStructs=0;
+ int numUnions=0;
+ int numInterfaces=0;
+ int numExceptions=0;
+ int numNamespaces=0;
+ int numFiles=0;
+ int numGroups=0;
+ int numPages=0;
+ int numPackages=0;
+ int numPubMethods=0;
+ int numProMethods=0;
+ int numPriMethods=0;
+ int numDocPubMethods=0;
+ int numDocProMethods=0;
+ int numDocPriMethods=0;
+ int numFunctions=0;
+ int numAttributes=0;
+ int numVariables=0;
+ int numDocFunctions=0;
+ int numDocAttributes=0;
+ int numDocVariables=0;
+ int numParams=0;
+
+ IDoxygen *dox = createObjectModel();
+
+ dox->setDebugLevel(0);
+
+ if (!dox->readXMLDir(argv[1]))
+ {
+ printf("Error reading %s/index.xml\n",argv[1]);
+ exit(1);
+ }
+
+ ICompoundIterator *cli = dox->compounds();
+ ICompound *comp;
+ for (cli->toFirst();(comp=cli->current());cli->toNext())
+ {
+ printf("Processing %s...\n",comp->name().data());
+ bool hasDocs = isDocumented(comp->briefDescription(),comp->detailedDescription());
+ switch (comp->kind())
+ {
+ case ICompound::Class:
+ numClasses++;
+ if (hasDocs) numDocClasses++;
+ break;
+ case ICompound::Struct: numStructs++; break;
+ case ICompound::Union: numUnions++; break;
+ case ICompound::Interface: numInterfaces++; break;
+ case ICompound::Exception: numExceptions++; break;
+ case ICompound::Namespace: numNamespaces++; break;
+ case ICompound::File: numFiles++; break;
+ case ICompound::Group: numGroups++; break;
+ case ICompound::Page: numPages++; break;
+ case ICompound::Package: numPackages++; break;
+ default: break;
+ }
+
+ ISectionIterator *sli = comp->sections();
+ ISection *sec;
+ for (sli->toFirst();(sec=sli->current());sli->toNext())
+ {
+ IMemberIterator *mli = sec->members();
+ IMember *mem;
+ for (mli->toFirst();(mem=mli->current());mli->toNext())
+ {
+ IParamIterator *pli = mem->params();
+ IParam *par;
+ if (comp->kind()==ICompound::Class ||
+ comp->kind()==ICompound::Struct ||
+ comp->kind()==ICompound::Interface
+ )
+ {
+ if (mem->kind()==IMember::Function ||
+ mem->kind()==IMember::Prototype ||
+ mem->kind()==IMember::Signal ||
+ mem->kind()==IMember::Slot ||
+ mem->kind()==IMember::DCOP
+ ) // is a "method"
+ {
+ if (mem->section()->isPublic())
+ {
+ numPubMethods++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocPubMethods++;
+ }
+ }
+ else if (mem->section()->isProtected())
+ {
+ numProMethods++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocProMethods++;
+ }
+ }
+ else if (mem->section()->isPrivate())
+ {
+ numPriMethods++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocPriMethods++;
+ }
+ }
+ }
+ else if (mem->kind()==IMember::Variable ||
+ mem->kind()==IMember::Property
+ ) // is an "attribute"
+ {
+ numAttributes++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocAttributes++;
+ }
+ }
+ }
+ else if (comp->kind()==ICompound::File ||
+ comp->kind()==ICompound::Namespace
+ )
+ {
+ if (mem->kind()==IMember::Function ||
+ mem->kind()==IMember::Prototype ||
+ mem->kind()==IMember::Signal ||
+ mem->kind()==IMember::Slot ||
+ mem->kind()==IMember::DCOP
+ ) // is a "method"
+ {
+ numFunctions++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocFunctions++;
+ }
+ }
+ else if (mem->kind()==IMember::Variable ||
+ mem->kind()==IMember::Property
+ ) // is an "attribute"
+ {
+ numVariables++;
+ if (isDocumented(mem->briefDescription(),mem->detailedDescription()))
+ {
+ numDocVariables++;
+ }
+ }
+ }
+
+ for (pli->toFirst();(par=pli->current());pli->toNext())
+ {
+ numParams++;
+ }
+ if (mem->typeString()!="void")
+ {
+ numParams++; // count non-void return types as well
+ }
+ pli->release();
+ }
+ mli->release();
+ }
+ sli->release();
+
+ comp->release();
+ }
+ cli->release();
+
+ dox->release();
+
+ int numMethods = numPubMethods+numProMethods+numPriMethods;
+ int numDocMethods = numDocPubMethods+numDocProMethods+numDocPriMethods;
+
+ printf("Metrics:\n");
+ printf("-----------------------------------\n");
+ if (numClasses>0) printf("Classes: %10d (%d documented)\n",numClasses,numDocClasses);
+ if (numStructs>0) printf("Structs: %10d\n",numStructs);
+ if (numUnions>0) printf("Unions: %10d\n",numUnions);
+ if (numInterfaces>0) printf("Interfaces: %10d\n",numInterfaces);
+ if (numExceptions>0) printf("Exceptions: %10d\n",numExceptions);
+ if (numNamespaces>0) printf("Namespaces: %10d\n",numNamespaces);
+ if (numFiles>0) printf("Files: %10d\n",numFiles);
+ if (numGroups>0) printf("Groups: %10d\n",numGroups);
+ if (numPages>0) printf("Pages: %10d\n",numPages);
+ if (numPackages>0) printf("Packages: %10d\n",numPackages);
+ if (numMethods>0) printf("Methods: %10d (%d documented)\n",numMethods,numDocMethods);
+ if (numPubMethods>0) printf(" Public: %10d (%d documented)\n",numPubMethods,numDocPubMethods);
+ if (numProMethods>0) printf(" Protected: %10d (%d documented)\n",numProMethods,numDocProMethods);
+ if (numPriMethods>0) printf(" Private: %10d (%d documented)\n",numPriMethods,numDocPriMethods);
+ if (numFunctions>0) printf("Functions: %10d (%d documented)\n",numFunctions,numDocFunctions);
+ if (numAttributes>0) printf("Attributes: %10d (%d documented)\n",numAttributes,numDocAttributes);
+ if (numVariables>0) printf("Variables: %10d (%d documented)\n",numVariables,numDocVariables);
+ if (numParams>0) printf("Params: %10d\n",numParams);
+ printf("-----------------------------------\n");
+ if (numClasses>0) printf("Avg. #methods/compound: %10f\n",(double)numMethods/(double)numClasses);
+ if (numMethods>0) printf("Avg. #params/method: %10f\n",(double)numParams/(double)numMethods);
+ printf("-----------------------------------\n");
+
+ return 0;
+}
+
diff --git a/addon/doxmlparser/examples/metrics/metrics.pro.in b/addon/doxmlparser/examples/metrics/metrics.pro.in
new file mode 100644
index 0000000..6dd344f
--- /dev/null
+++ b/addon/doxmlparser/examples/metrics/metrics.pro.in
@@ -0,0 +1,20 @@
+TEMPLATE = app.t
+CONFIG = console warn_on $extraopts
+HEADERS =
+SOURCES = main.cpp
+unix:LIBS += -L../../../../lib -L../../lib -ldoxmlparser -lqtools
+win32:INCLUDEPATH += .
+win32-mingw:LIBS += -L../../../../lib -L../../lib -ldoxmlparser -lqtools
+win32-msvc:LIBS += doxmlparser.lib qtools.lib shell32.lib
+win32-msvc:TMAKE_LFLAGS += /LIBPATH:..\..\..\..\lib;..\..\lib
+win32-borland:LIBS += doxmlparser.lib qtools.lib shell32.lib
+win32-borland:TMAKE_LFLAGS += -L..\..\..\..\lib -L..\..\lib
+win32:TMAKE_CXXFLAGS += -DQT_NODLL
+DESTDIR =
+OBJECTS_DIR = obj
+TARGET = metrics
+DEPENDPATH = ../../include
+INCLUDEPATH += ../../../../qtools ../../include
+unix:TARGETDEPS = ../../lib/libdoxmlparser.a
+win32:TARGETDEPS = ..\..\lib\doxmlparser.lib
+
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h
index 390e9bb..0ca2cc8 100644
--- a/addon/doxmlparser/include/doxmlintf.h
+++ b/addon/doxmlparser/include/doxmlintf.h
@@ -5,12 +5,15 @@
class IMember;
class IDocIterator;
+class ICompound;
+class ISection;
class ILinkedText
{
public:
enum Kind { Kind_Text, Kind_Ref };
virtual Kind kind() const = 0;
+ virtual ~ILinkedText() {}
};
class ILT_Text : public ILinkedText
@@ -49,6 +52,7 @@ class IParam
virtual QString attrib() const = 0;
virtual QString arraySpecifier() const = 0;
virtual ILinkedTextIterator *defaultValue() const = 0;
+ virtual ~IParam() {}
};
class IParamIterator
@@ -67,6 +71,7 @@ class IMemberReference
public:
virtual IMember *member() const = 0;
virtual QString memberName() const = 0;
+ virtual ~IMemberReference() {}
};
class IMemberReferenceIterator
@@ -85,6 +90,7 @@ class IEnumValue
public:
virtual QString name() const = 0;
virtual QString initializer() const = 0;
+ virtual ~IEnumValue() {}
};
class IEnumValueIterator
@@ -136,6 +142,7 @@ class IDoc
Root // 30 -> IDocRoot
};
virtual Kind kind() const = 0;
+ virtual ~IDoc() {}
};
class IDocMarkup : public IDoc
@@ -234,7 +241,7 @@ class IDocRef : public IDoc
{
public:
enum TargetKind { Member, Compound };
- virtual QString id() const = 0;
+ virtual QString refId() const = 0;
virtual TargetKind targetKind() const = 0;
virtual QString external() const = 0;
virtual QString text() const = 0;
@@ -340,11 +347,19 @@ class IDocIterator
class IMember
{
public:
- virtual QString kind() const = 0;
+ enum MemberKind { Invalid=0,
+ Define, Property, Variable, Typedef, Enum,
+ Function, Signal, Prototype, Friend, DCOP, Slot
+ };
+ virtual ICompound *compound() const = 0;
+ virtual ISection *section() const = 0;
+ virtual MemberKind kind() const = 0;
+ virtual QString kindString() const = 0;
virtual QString id() const = 0;
virtual QString protection() const = 0;
virtual QString virtualness() const = 0;
virtual ILinkedTextIterator *type() const = 0;
+ virtual QString typeString() const = 0;
virtual QString name() const = 0;
virtual bool isConst() const = 0;
virtual bool isVolatile() const = 0;
@@ -362,6 +377,7 @@ class IMember
virtual IEnumValueIterator *enumValues() const = 0;
virtual IDocRoot *briefDescription() const = 0;
virtual IDocRoot *detailedDescription() const = 0;
+ virtual ~IMember() {}
};
class IMemberIterator
@@ -378,8 +394,26 @@ class IMemberIterator
class ISection
{
public:
- virtual QString kind() const = 0;
+ enum SectionKind { Invalid=0,
+ UserDefined,
+ PubTypes, PubFuncs, PubAttribs, PubSlots,
+ Signals, DCOPFuncs, Properties,
+ PubStatFuncs, PubStatAttribs,
+ ProTypes, ProFuncs, ProAttribs, ProSlots,
+ ProStatFuncs, ProStatAttribs,
+ PriTypes, PriFuncs, PriAttribs, PriSlots,
+ PriStatFuncs, PriStatAttribs,
+ Friend, Related, Defines, Prototypes, Typedefs,
+ Enums, Functions, Variables
+ };
+ virtual QString kindString() const = 0;
+ virtual SectionKind kind() const = 0;
virtual IMemberIterator *members() const = 0;
+ virtual bool isStatic() const = 0;
+ virtual bool isPublic() const = 0;
+ virtual bool isPrivate() const = 0;
+ virtual bool isProtected() const = 0;
+ virtual ~ISection() {}
};
class ISectionIterator
@@ -396,21 +430,42 @@ class ISectionIterator
class ICompound
{
public:
+ enum CompoundKind { Invalid=0,
+ Class, Struct, Union, Interface, Exception,
+ Namespace, File, Group, Page, Package
+ };
virtual QString name() const = 0;
virtual QString id() const = 0;
- virtual QString kind() const = 0;
+ virtual CompoundKind kind() const = 0;
+ virtual QString kindString() const = 0;
virtual ISectionIterator *sections() const = 0;
virtual IDocRoot *briefDescription() const = 0;
virtual IDocRoot *detailedDescription() const = 0;
+
+ /*! Returns an interface to a member given its id.
+ * @param id The member id.
+ */
+ virtual IMember *memberById(const QString &id) const = 0;
+
+ /*! Returns a list of all members within the compound having a certain
+ * name. Overloading is the reason why there can be more than one member.
+ * @param name The name of the member.
+ */
+ virtual IMemberIterator *memberByName(const QString &name) const = 0;
+
+ /*! Decreases the reference counter for this compound. If it reaches
+ * zero, the memory for the compound will be released.
+ */
+ virtual void release() = 0;
};
class ICompoundIterator
{
public:
- virtual ICompound *toFirst() = 0;
- virtual ICompound *toLast() = 0;
- virtual ICompound *toNext() = 0;
- virtual ICompound *toPrev() = 0;
+ virtual void toFirst() = 0;
+ virtual void toLast() = 0;
+ virtual void toNext() = 0;
+ virtual void toPrev() = 0;
virtual ICompound *current() const = 0;
virtual void release() = 0;
};
@@ -419,6 +474,7 @@ class ICompoundIterator
class IDoxygen
{
public:
+
/*! Returns an iterator that can be used to iterate over the list
* of compounds found in the project.
*/
@@ -435,28 +491,43 @@ class IDoxygen
*/
virtual ICompound *compoundByName(const QString &name) const = 0;
- /*! Returns an interface to a member given its id.
+ /*! Returns an interface to a compound containing a member given it the
+ * member's id. Given the ICompound interface one can use the same id
+ * to obtain the IMember interface.
* @param id The member id.
*/
- virtual IMember *memberById(const QString &id) const = 0;
+ virtual ICompound *memberById(const QString &id) const = 0;
- /*! Returns a list of all members with a certain name.
+ /*! Returns a list of all compounds containing at least one members
+ * with a certain name. Each compound can be asked to return the
+ * list of members with that name.
* @param name The name of the member.
*/
- virtual IMemberIterator *memberByName(const QString &name) const = 0;
-
+ virtual ICompoundIterator *memberByName(const QString &name) const = 0;
+
/*! Releases the memory for the object hierarchy obtained by
* createdObjecModelFromXML(). First release all iterators before calling
* this function.
*/
virtual void release() = 0;
+
+ /*! Sets the debug level.
+ * - 0 all debugging messages are disabled (the default).
+ * - 1 display important messages only
+ * - 2 display any messages.
+ */
+ virtual void setDebugLevel(int level) = 0;
+
+ /*! Reads an XML directory produced by doxygen and builds up a data
+ * structure representing the contents of the XML files in the directory.
+ */
+ virtual bool readXMLDir(const char *xmlDirName) = 0;
};
-/*! Factory method that creates an object model given an XML file generated
- * by doxygen.
- * @param xmlFileName The name of the XML to parse.
- * @returns An iterface to the object model.
+/*! Factory method that creates an empty object model for a doxygen generated XML file.
+ * Use the readXMLDir() method to build the model from an XML output
+ * directory containing doxygen output.
*/
-IDoxygen *createObjectModelFromXML(const char *xmlFileName);
+IDoxygen *createObjectModel();
#endif
diff --git a/addon/doxmlparser/src/basehandler.h b/addon/doxmlparser/src/basehandler.h
index d62cf74..89f9504 100644
--- a/addon/doxmlparser/src/basehandler.h
+++ b/addon/doxmlparser/src/basehandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -20,11 +20,14 @@
#include <qdict.h>
#include <qstring.h>
+#include "debug.h"
+
class IBaseHandler
{
public:
virtual void setDelegate(QXmlDefaultHandler *delegate) = 0;
virtual QXmlDefaultHandler *delegate() const = 0;
+ virtual ~IBaseHandler() {}
};
class IFallBackHandler
@@ -33,6 +36,7 @@ class IFallBackHandler
virtual bool handleStartElement(const QString & name,
const QXmlAttributes & attrib) = 0;
virtual bool handleEndElement(const QString &name) = 0;
+ virtual ~IFallBackHandler() {}
};
template<class T> class ElementMapper
@@ -104,9 +108,15 @@ template<class T> class ElementMapper
QDict<EndElementHandlerT> m_endHandlers;
};
-template<class T> class BaseHandler : public IBaseHandler,
- public QXmlDefaultHandler,
- public ElementMapper<T>
+struct LocatorContainer
+{
+ static QXmlLocator *s_theLocator;
+};
+
+template<class T> class BaseHandler : public QXmlDefaultHandler,
+ public ElementMapper<T>,
+ public LocatorContainer,
+ public IBaseHandler
{
public:
BaseHandler() : m_delegateHandler(0), m_fallBackHandler(0)
@@ -136,7 +146,9 @@ template<class T> class BaseHandler : public IBaseHandler,
if (!m_skipUntil.isEmpty()) // skip mode
{
if (m_skipUntil==name) m_skipCount++;
- printf("skipping start tag %s count=%d\n",name.data(),m_skipCount);
+ debug(1,"line %d, col %d: skipping start tag %s count=%d\n",
+ s_theLocator->lineNumber(),s_theLocator->columnNumber(),
+ name.data(),m_skipCount);
return TRUE;
}
@@ -150,7 +162,9 @@ template<class T> class BaseHandler : public IBaseHandler,
!m_fallBackHandler->handleStartElement(name,attrib)
)
{
- printf("found unexpected tag `%s', skipping until matching end tag\n",name.data());
+ debug(1,"line %d, col %d: found unexpected tag `%s', skipping until matching end tag\n",
+ s_theLocator->lineNumber(),s_theLocator->columnNumber(),
+ name.data());
m_skipUntil = name;
m_skipCount=1;
}
@@ -167,7 +181,9 @@ template<class T> class BaseHandler : public IBaseHandler,
if (name==m_skipUntil)
{
m_skipCount--;
- printf("skipping end tag %s count=%d\n",name.data(),m_skipCount);
+ debug(1,"line %d, col %d: skipping end tag %s count=%d\n",
+ s_theLocator->lineNumber(),s_theLocator->columnNumber(),
+ name.data(),m_skipCount);
if (m_skipCount==0)
{
m_skipUntil="";
@@ -198,7 +214,9 @@ template<class T> class BaseHandler : public IBaseHandler,
return m_delegateHandler->skippedEntity(s);
}
- printf("Skipped unhandled entity %s\n",s.data());
+ debug(1,"line %d, col %d: Skipped unhandled entity %s\n",
+ s_theLocator->lineNumber(),s_theLocator->columnNumber(),
+ s.data());
return TRUE;
}
@@ -237,6 +255,12 @@ template<class T> class BaseHandler : public IBaseHandler,
return m_fallBackHandler;
}
+ void setDocumentLocator( QXmlLocator * locator )
+ {
+ debug(2,"setDocumentLocator(%p)\n",locator);
+ s_theLocator = locator;
+ }
+
protected:
QString m_curString;
QString m_skipUntil;
diff --git a/addon/doxmlparser/src/baseiterator.h b/addon/doxmlparser/src/baseiterator.h
index 52a4c4e..847d1ef 100644
--- a/addon/doxmlparser/src/baseiterator.h
+++ b/addon/doxmlparser/src/baseiterator.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp
index 1ce6c6b..18a8c0c 100644
--- a/addon/doxmlparser/src/compoundhandler.cpp
+++ b/addon/doxmlparser/src/compoundhandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -16,14 +16,97 @@
#include "mainhandler.h"
#include "compoundhandler.h"
#include "dochandler.h"
+#include "debug.h"
-CompoundHandler::CompoundHandler(IBaseHandler *parent)
- : m_parent(parent), m_brief(0), m_detailed(0), m_programListing(0)
+class CompoundErrorHandler : public QXmlErrorHandler
+{
+ public:
+ virtual ~CompoundErrorHandler() {}
+ bool warning( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool error( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool fatalError( const QXmlParseException &exception )
+ {
+ debug(1,"Fatal error at line %d column %d: %s\n",
+ exception.lineNumber(),exception.columnNumber(),
+ exception.message().data());
+ return FALSE;
+ }
+ QString errorString() { return ""; }
+
+ private:
+ QString errorMsg;
+};
+
+//----------------------------------------------------------------------------
+
+class CompoundTypeMap
+{
+ public:
+ CompoundTypeMap()
+ {
+ m_map.setAutoDelete(TRUE);
+ m_map.insert("class",new int(ICompound::Class));
+ m_map.insert("struct",new int(ICompound::Struct));
+ m_map.insert("union",new int(ICompound::Union));
+ m_map.insert("interface",new int(ICompound::Interface));
+ m_map.insert("exception",new int(ICompound::Exception));
+ m_map.insert("namespace",new int(ICompound::Namespace));
+ m_map.insert("file",new int(ICompound::File));
+ m_map.insert("group",new int(ICompound::Group));
+ m_map.insert("page",new int(ICompound::Page));
+ m_map.insert("package",new int(ICompound::Package));
+ }
+ virtual ~CompoundTypeMap()
+ {
+ }
+ ICompound::CompoundKind map(const QString &s)
+ {
+ int *val = m_map.find(s);
+ if (val==0)
+ {
+ debug(1,"Warning: `%s' is an invalid compound type\n",s.data());
+ return ICompound::Invalid;
+ }
+ else return (ICompound::CompoundKind)*val;
+ }
+ private:
+ QDict<int> m_map;
+};
+
+static CompoundTypeMap *s_typeMap;
+
+void compoundhandler_init()
+{
+ s_typeMap = new CompoundTypeMap;
+}
+
+void compoundhandler_exit()
+{
+ delete s_typeMap;
+}
+
+//----------------------------------------------------------------------------
+
+CompoundHandler::CompoundHandler(const QString &xmlDir)
+ : m_brief(0), m_detailed(0), m_programListing(0),
+ m_xmlDir(xmlDir), m_refCount(1), m_memberDict(257), m_memberNameDict(257),
+ m_mainHandler(0)
{
m_superClasses.setAutoDelete(TRUE);
m_subClasses.setAutoDelete(TRUE);
m_sections.setAutoDelete(TRUE);
+ m_memberNameDict.setAutoDelete(TRUE);
+ addStartHandler("doxygen");
+ addEndHandler("doxygen");
+
+ addStartHandler("compounddef",this,&CompoundHandler::startCompound);
addEndHandler("compounddef",this,&CompoundHandler::endCompound);
addStartHandler("compoundname");
@@ -45,10 +128,12 @@ CompoundHandler::CompoundHandler(IBaseHandler *parent)
addEndHandler("location");
addStartHandler("programlisting",this,&CompoundHandler::startProgramListing);
+
}
CompoundHandler::~CompoundHandler()
{
+ debug(2,"CompoundHandler::~CompoundHandler()\n");
delete m_brief;
delete m_detailed;
delete m_programListing;
@@ -84,28 +169,27 @@ void CompoundHandler::startProgramListing(const QXmlAttributes& attrib)
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());
+ m_kindString = attrib.value("kind");
+ m_kind = s_typeMap->map(m_kindString);
+ debug(2,"startCompound(id=`%s' type=`%s')\n",m_id.data(),m_kindString.data());
}
-void CompoundHandler::startLocation(const QXmlAttributes& attrib)
+void CompoundHandler::endCompound()
{
- m_defFile = attrib.value("file");
- m_defLine = attrib.value("line").toInt();
+ debug(2,"endCompound()\n");
}
-void CompoundHandler::endCompound()
+void CompoundHandler::startLocation(const QXmlAttributes& attrib)
{
- printf("endCompound()\n");
- m_parent->setDelegate(0);
+ m_defFile = attrib.value("file");
+ m_defLine = attrib.value("line").toInt();
}
void CompoundHandler::endCompoundName()
{
m_name = m_curString.stripWhiteSpace();
- printf("Compound name `%s'\n",m_name.data());
+ debug(2,"Compound name `%s'\n",m_name.data());
}
void CompoundHandler::addSuperClass(const QXmlAttributes& attrib)
@@ -115,7 +199,7 @@ void CompoundHandler::addSuperClass(const QXmlAttributes& attrib)
attrib.value("prot"),
attrib.value("virt")
);
- printf("super class id=`%s' prot=`%s' virt=`%s'\n",
+ debug(2,"super class id=`%s' prot=`%s' virt=`%s'\n",
sc->m_id.data(),
sc->m_protection.data(),
sc->m_virtualness.data());
@@ -129,20 +213,56 @@ void CompoundHandler::addSubClass(const QXmlAttributes& attrib)
attrib.value("prot"),
attrib.value("virt")
);
- printf("sub class id=`%s' prot=`%s' virt=`%s'\n",
+ debug(2,"sub class id=`%s' prot=`%s' virt=`%s'\n",
sc->m_id.data(),
sc->m_protection.data(),
sc->m_virtualness.data());
m_subClasses.append(sc);
}
-void CompoundHandler::initialize(MainHandler *m)
+bool CompoundHandler::parseXML(const QString &compId)
+{
+ QFile xmlFile(m_xmlDir+"/"+compId+".xml");
+ if (!xmlFile.exists()) return FALSE;
+ CompoundErrorHandler errorHandler;
+ QXmlInputSource source( xmlFile );
+ QXmlSimpleReader reader;
+ reader.setContentHandler( this );
+ reader.setErrorHandler( &errorHandler );
+ reader.parse( source );
+ return TRUE;
+}
+
+void CompoundHandler::initialize(MainHandler *mh)
{
+ m_mainHandler = mh;
QListIterator<ISection> msi(m_sections);
SectionHandler *sec;
for (;(sec=(SectionHandler *)msi.current());++msi)
{
- sec->initialize(m);
+ sec->initialize(this);
+ }
+}
+
+void CompoundHandler::insertMember(MemberHandler *mh)
+{
+ m_memberDict.insert(mh->id(),mh);
+ QList<MemberHandler> *mhl = m_memberNameDict.find(mh->id());
+ if (mhl==0)
+ {
+ mhl = new QList<MemberHandler>;
+ m_memberNameDict.insert(mh->name(),mhl);
+ }
+ mhl->append(mh);
+}
+
+void CompoundHandler::release()
+{
+ debug(2,"CompoundHandler::release() %d->%d\n",m_refCount,m_refCount-1);
+ if (--m_refCount<=0)
+ {
+ m_mainHandler->unloadCompound(this);
+ delete this;
}
}
diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h
index 99db5d8..762641f 100644
--- a/addon/doxmlparser/src/compoundhandler.h
+++ b/addon/doxmlparser/src/compoundhandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -28,13 +28,6 @@ class MainHandler;
class DocHandler;
class ProgramListingHandler;
-class CompoundIterator : public BaseIterator<ICompoundIterator,ICompound,ICompound>
-{
- public:
- CompoundIterator(const QList<ICompound> &list) :
- BaseIterator<ICompoundIterator,ICompound,ICompound>(list) {}
-};
-
class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler>
{
public:
@@ -48,22 +41,34 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler>
virtual void startDetailedDesc(const QXmlAttributes& attrib);
virtual void startLocation(const QXmlAttributes& attrib);
virtual void startProgramListing(const QXmlAttributes& attrib);
+ virtual void addref() { m_refCount++; }
- CompoundHandler(IBaseHandler *parent);
+ CompoundHandler(const QString &dirName);
virtual ~CompoundHandler();
- void initialize(MainHandler *m);
+ bool parseXML(const QString &compId);
+ void initialize(MainHandler *mh);
+ void insertMember(MemberHandler *mh);
// ICompound implementation
QString name() const { return m_name; }
QString id() const { return m_id; }
- QString kind() const { return m_kind; }
+ CompoundKind kind() const { return m_kind; }
+ QString kindString() const { return m_kindString; }
ISectionIterator *sections() const
{ return new SectionIterator(m_sections); }
virtual IDocRoot *briefDescription() const
{ return m_brief; }
virtual IDocRoot *detailedDescription() const
{ return m_detailed; }
-
+ virtual IMember *memberById(const QString &id) const
+ { return m_memberDict[id]; }
+ virtual IMemberIterator *memberByName(const QString &name) const
+ {
+ QList<MemberHandler> *ml = m_memberNameDict[name];
+ if (ml==0) return 0;
+ return new MemberIterator(*ml);
+ }
+ virtual void release();
private:
struct SuperClass
@@ -87,15 +92,23 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler>
QList<SuperClass> m_superClasses;
QList<SubClass> m_subClasses;
QList<ISection> m_sections;
- IBaseHandler *m_parent;
DocHandler *m_brief;
DocHandler *m_detailed;
ProgramListingHandler *m_programListing;
QString m_id;
- QString m_kind;
+ QString m_kindString;
+ CompoundKind m_kind;
QString m_name;
QString m_defFile;
int m_defLine;
+ QString m_xmlDir;
+ int m_refCount;
+ QDict<MemberHandler> m_memberDict;
+ QDict<QList<MemberHandler> > m_memberNameDict;
+ MainHandler *m_mainHandler;
};
+void compoundhandler_init();
+void compoundhandler_exit();
+
#endif
diff --git a/addon/doxmlparser/src/debug.cpp b/addon/doxmlparser/src/debug.cpp
new file mode 100644
index 0000000..a8be32c
--- /dev/null
+++ b/addon/doxmlparser/src/debug.cpp
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "debug.h"
+
+static int s_debugLevel = 0;
+
+void debug(int level,const char *msg,...)
+{
+ if (level<=s_debugLevel)
+ {
+ va_list args;
+ va_start(args, msg);
+ vfprintf(stderr, msg, args);
+ va_end(args);
+ }
+}
+
+void setDebugLevel(int level)
+{
+ s_debugLevel = level;
+}
+
diff --git a/addon/doxmlparser/src/debug.h b/addon/doxmlparser/src/debug.h
new file mode 100644
index 0000000..c77f7fe
--- /dev/null
+++ b/addon/doxmlparser/src/debug.h
@@ -0,0 +1,7 @@
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+void debug(int level,const char *msg,...);
+void setDebugLevel(int level);
+
+#endif
diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp
index b670de2..344e457 100644
--- a/addon/doxmlparser/src/dochandler.cpp
+++ b/addon/doxmlparser/src/dochandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -14,6 +14,7 @@
*/
#include "dochandler.h"
+#include "debug.h"
#include <qmap.h>
class TypeNameMapper
@@ -51,8 +52,17 @@ class TypeNameMapper
QMap<QString,SimpleSectHandler::Types> m_typeNameMap;
};
-static TypeNameMapper g_typeMapper;
+static TypeNameMapper *s_typeMapper;
+void dochandler_init()
+{
+ s_typeMapper = new TypeNameMapper;
+}
+
+void dochandler_exit()
+{
+ delete s_typeMapper;
+}
//----------------------------------------------------------------------
// MarkupHandler
@@ -92,7 +102,7 @@ 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);
+ debug(2,"addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup);
m_curString="";
}
}
@@ -216,12 +226,12 @@ ListItemHandler::~ListItemHandler()
void ListItemHandler::startListItem(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start list item handler\n");
+ debug(2,"start list item handler\n");
}
void ListItemHandler::endListItem()
{
- printf("end list item handler\n");
+ debug(2,"end list item handler\n");
m_parent->setDelegate(0);
}
@@ -336,7 +346,7 @@ void ParameterHandler::startParameterName(const QXmlAttributes& /*attrib*/)
void ParameterHandler::endParameterName()
{
m_name = m_curString;
- printf("parameter %s\n",m_name.data());
+ debug(2,"parameter %s\n",m_name.data());
m_curString="";
m_parent->setDelegate(0);
}
@@ -386,9 +396,9 @@ void ParameterListHandler::startParameterList(const QXmlAttributes& attrib)
else if (kind=="param") m_type=Param;
else
{
- printf("Error: invalid parameterlist type: %s\n",kind.data());
+ debug(1,"Error: invalid parameterlist type: %s\n",kind.data());
}
- printf("parameterlist kind=%s\n",kind.data());
+ debug(2,"parameterlist kind=%s\n",kind.data());
m_parent->setDelegate(this);
}
@@ -432,7 +442,7 @@ LinkHandler::~LinkHandler()
void LinkHandler::startLink(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- printf("Start link\n");
+ debug(2,"Start link\n");
m_ref = attrib.value("linkend");
m_curString="";
}
@@ -442,7 +452,7 @@ void LinkHandler::endLink()
m_text = m_curString;
m_curString="";
m_parent->setDelegate(0);
- printf("End link\n");
+ debug(2,"End link\n");
}
//----------------------------------------------------------------------
@@ -462,7 +472,7 @@ EMailHandler::~EMailHandler()
void EMailHandler::startEMail(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("Start email\n");
+ debug(2,"Start email\n");
m_curString="";
}
@@ -471,7 +481,7 @@ void EMailHandler::endEMail()
m_address = m_curString;
m_curString="";
m_parent->setDelegate(0);
- printf("End email\n");
+ debug(2,"End email\n");
}
//----------------------------------------------------------------------
@@ -491,7 +501,7 @@ ULinkHandler::~ULinkHandler()
void ULinkHandler::startULink(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- printf("Start ulink\n");
+ debug(2,"Start ulink\n");
m_url = attrib.value("url");
m_curString="";
}
@@ -501,7 +511,7 @@ void ULinkHandler::endULink()
m_text = m_curString;
m_curString="";
m_parent->setDelegate(0);
- printf("End ulink\n");
+ debug(2,"End ulink\n");
}
//----------------------------------------------------------------------
@@ -521,13 +531,13 @@ LineBreakHandler::~LineBreakHandler()
void LineBreakHandler::startLineBreak(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("Start linebreak\n");
+ debug(2,"Start linebreak\n");
}
void LineBreakHandler::endLineBreak()
{
m_parent->setDelegate(0);
- printf("End linebreak\n");
+ debug(2,"End linebreak\n");
}
//----------------------------------------------------------------------
@@ -547,13 +557,13 @@ HRulerHandler::~HRulerHandler()
void HRulerHandler::startHRuler(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("Start hruler\n");
+ debug(2,"Start hruler\n");
}
void HRulerHandler::endHRuler()
{
m_parent->setDelegate(0);
- printf("End hruler\n");
+ debug(2,"End hruler\n");
}
//----------------------------------------------------------------------
@@ -573,9 +583,12 @@ RefHandler::~RefHandler()
void RefHandler::startRef(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- m_refId = attrib.value("idref");
- m_anchor = attrib.value("anchor");
- printf("Start ref refId=%s anchor=%s\n",m_refId.data(),m_anchor.data());
+ m_refId = attrib.value("refid");
+ m_refId = attrib.value("external");
+ ASSERT(attrib.value("kindref")=="compound" ||
+ attrib.value("kindref")=="member");
+ m_targetKind = attrib.value("kindref")=="compound" ? Compound : Member;
+ debug(2,"Start ref refId=%s\n",m_refId.data());
m_curString="";
}
@@ -583,7 +596,7 @@ void RefHandler::endRef()
{
m_linkText = m_curString;
m_parent->setDelegate(0);
- printf("End ref: text=`%s'\n",m_linkText.data());
+ debug(2,"End ref: text=`%s'\n",m_linkText.data());
}
@@ -609,7 +622,7 @@ TitleHandler::~TitleHandler()
void TitleHandler::startTitle(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("Start title\n");
+ debug(2,"Start title\n");
m_curString="";
}
@@ -617,7 +630,7 @@ void TitleHandler::endTitle()
{
addTextNode();
m_parent->setDelegate(0);
- printf("End title\n");
+ debug(2,"End title\n");
}
void TitleHandler::addTextNode()
@@ -625,7 +638,7 @@ void TitleHandler::addTextNode()
if (!m_curString.isEmpty())
{
m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
- printf("addTextNode() text=\"%s\" markup=%x\n",
+ debug(2,"addTextNode() text=\"%s\" markup=%x\n",
m_curString.data(),m_markupHandler->markup());
m_curString="";
}
@@ -661,14 +674,14 @@ SimpleSectHandler::~SimpleSectHandler()
void SimpleSectHandler::startSimpleSect(const QXmlAttributes& attrib)
{
- m_type = g_typeMapper.stringToType(attrib.value("kind"));
- printf("start simple section %s\n",attrib.value("kind").data());
+ m_type = s_typeMapper->stringToType(attrib.value("kind"));
+ debug(2,"start simple section %s\n",attrib.value("kind").data());
m_parent->setDelegate(this);
}
void SimpleSectHandler::endSimpleSect()
{
- printf("end simple section\n");
+ debug(2,"end simple section\n");
m_parent->setDelegate(0);
}
@@ -708,25 +721,25 @@ VariableListEntryHandler::~VariableListEntryHandler()
void VariableListEntryHandler::startVarListEntry(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start varlistentry\n");
+ debug(2,"start varlistentry\n");
}
void VariableListEntryHandler::endVarListEntry()
{
m_parent->setDelegate(0);
- printf("end varlistentry\n");
+ debug(2,"end varlistentry\n");
}
void VariableListEntryHandler::startListItem(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start listitem\n");
+ debug(2,"start listitem\n");
}
void VariableListEntryHandler::endListItem()
{
m_parent->setDelegate(0);
- printf("end listitem\n");
+ debug(2,"end listitem\n");
}
void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/)
@@ -737,7 +750,7 @@ void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/)
void VariableListEntryHandler::endTerm()
{
m_term = m_curString;
- printf("term=%s\n",m_term.data());
+ debug(2,"term=%s\n",m_term.data());
}
void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib)
@@ -769,12 +782,12 @@ VariableListHandler::~VariableListHandler()
void VariableListHandler::startVariableList(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start variablelist\n");
+ debug(2,"start variablelist\n");
}
void VariableListHandler::endVariableList()
{
- printf("end variablelist\n");
+ debug(2,"end variablelist\n");
m_parent->setDelegate(0);
}
@@ -799,7 +812,9 @@ void VariableListHandler::startListItem(const QXmlAttributes& attrib)
HighlightHandler::HighlightHandler(IBaseHandler *parent)
: m_parent(parent)
{
+ m_children.setAutoDelete(TRUE);
addEndHandler("highlight",this,&HighlightHandler::endHighlight);
+ addStartHandler("ref",this,&HighlightHandler::startRef);
}
HighlightHandler::~HighlightHandler()
@@ -815,11 +830,30 @@ void HighlightHandler::startHighlight(const QXmlAttributes& attrib)
void HighlightHandler::endHighlight()
{
- m_text = m_curString;
- printf("highlight class=`%s' text=`%s'\n",m_class.data(),m_text.data());
+ addTextNode();
+ debug(2,"highlight class=`%s'\n",m_class.data());
m_parent->setDelegate(0);
}
+void HighlightHandler::startRef(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ RefHandler *rh = new RefHandler(this);
+ m_children.append(rh);
+ rh->startRef(attrib);
+}
+
+void HighlightHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,IDocMarkup::Normal));
+ debug(2,"addTextNode() text=\"%s\"\n",
+ m_curString.data());
+ m_curString="";
+ }
+}
+
//----------------------------------------------------------------------
// CodeLineHandler
//----------------------------------------------------------------------
@@ -842,20 +876,20 @@ CodeLineHandler::~CodeLineHandler()
void CodeLineHandler::startCodeLine(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start codeline\n");
+ debug(2,"start codeline\n");
}
void CodeLineHandler::endCodeLine()
{
addTextNode();
- printf("end codeline\n");
+ debug(2,"end codeline\n");
m_parent->setDelegate(0);
}
void CodeLineHandler::startLineNumber(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- printf("start linenumber\n");
+ debug(2,"start linenumber\n");
m_lineNumber = attrib.value("line").toInt();
m_refId = attrib.value("refid");
}
@@ -886,7 +920,7 @@ void CodeLineHandler::addTextNode()
if (!m_curString.isEmpty())
{
m_children.append(new TextNode(m_curString,IDocMarkup::Normal));
- printf("addTextNode() text=\"%s\"\n",
+ debug(2,"addTextNode() text=\"%s\"\n",
m_curString.data());
m_curString="";
}
@@ -914,12 +948,12 @@ ProgramListingHandler::~ProgramListingHandler()
void ProgramListingHandler::startProgramListing(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start programlisting\n");
+ debug(2,"start programlisting\n");
}
void ProgramListingHandler::endProgramListing()
{
- printf("end programlisting\n");
+ debug(2,"end programlisting\n");
m_parent->setDelegate(0);
}
@@ -972,7 +1006,7 @@ void FormulaHandler::startFormula(const QXmlAttributes& attrib)
void FormulaHandler::endFormula()
{
m_text = m_curString;
- printf("formula id=`%s' text=`%s'\n",m_id.data(),m_text.data());
+ debug(2,"formula id=`%s' text=`%s'\n",m_id.data(),m_text.data());
m_parent->setDelegate(0);
}
@@ -1000,7 +1034,7 @@ void ImageHandler::startImage(const QXmlAttributes& attrib)
void ImageHandler::endImage()
{
m_caption = m_curString;
- printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
+ debug(2,"image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
m_parent->setDelegate(0);
}
@@ -1028,7 +1062,7 @@ void DotFileHandler::startDotFile(const QXmlAttributes& attrib)
void DotFileHandler::endDotFile()
{
m_caption = m_curString;
- printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
+ debug(2,"image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
m_parent->setDelegate(0);
}
@@ -1052,13 +1086,13 @@ IndexEntryHandler::~IndexEntryHandler()
void IndexEntryHandler::startIndexEntry(const QXmlAttributes& /*attrib*/)
{
- printf("start index entry\n");
+ debug(2,"start index entry\n");
m_parent->setDelegate(this);
}
void IndexEntryHandler::endIndexEntry()
{
- printf("index entry primary=`%s' secondary=`%s'\n",
+ debug(2,"index entry primary=`%s' secondary=`%s'\n",
m_primary.data(),m_secondary.data());
m_parent->setDelegate(0);
}
@@ -1171,7 +1205,7 @@ void TableHandler::startTable(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
m_numColumns = attrib.value("cols").toInt();
- printf("table cols=%d\n",m_numColumns);
+ debug(2,"table cols=%d\n",m_numColumns);
}
void TableHandler::endTable()
@@ -1237,13 +1271,13 @@ ParagraphHandler::~ParagraphHandler()
void ParagraphHandler::startParagraph(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("para\n");
+ debug(2,"para\n");
}
void ParagraphHandler::endParagraph()
{
addTextNode();
- printf("end para\n");
+ debug(2,"end para\n");
m_parent->setDelegate(0);
}
@@ -1388,7 +1422,7 @@ void ParagraphHandler::addTextNode()
if (!m_curString.isEmpty())
{
m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
- printf("addTextNode() text=\"%s\" markup=%x\n",
+ debug(2,"addTextNode() text=\"%s\" markup=%x\n",
m_curString.data(),m_markupHandler->markup());
m_curString="";
}
@@ -1423,7 +1457,7 @@ DocSectionHandler::~DocSectionHandler()
void DocSectionHandler::startDocSection(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- printf("Start docsection\n");
+ debug(2,"Start docsection\n");
m_id = attrib.value("id");
m_curString="";
}
@@ -1432,7 +1466,7 @@ void DocSectionHandler::endDocSection()
{
addTextNode();
m_parent->setDelegate(0);
- printf("End docsection\n");
+ debug(2,"End docsection\n");
}
void DocSectionHandler::addTextNode()
@@ -1440,7 +1474,7 @@ void DocSectionHandler::addTextNode()
if (!m_curString.isEmpty())
{
m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
- printf("addTextNode() text=\"%s\" markup=%x\n",
+ debug(2,"addTextNode() text=\"%s\" markup=%x\n",
m_curString.data(),m_markupHandler->markup());
m_curString="";
}
@@ -1483,12 +1517,12 @@ DocHandler::~DocHandler()
void DocHandler::startDoc(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("start dochandler\n");
+ debug(2,"start dochandler\n");
}
void DocHandler::endDoc()
{
- printf("end dochandler\n");
+ debug(2,"end dochandler\n");
m_parent->setDelegate(0);
}
diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h
index e72ad41..3aaef72 100644
--- a/addon/doxmlparser/src/dochandler.h
+++ b/addon/doxmlparser/src/dochandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -449,11 +449,16 @@ class RefHandler : public IDocRef, public BaseHandler<RefHandler>
// IDocRef
virtual Kind kind() const { return Ref; }
virtual QString refId() const { return m_refId; }
+ virtual TargetKind targetKind() const { return m_targetKind; }
+ virtual QString external() const { return m_extId; }
+ virtual QString text() const { return m_linkText; }
private:
IBaseHandler *m_parent;
- QString m_refId;
- QString m_linkText;
+ QString m_refId;
+ QString m_extId;
+ QString m_linkText;
+ TargetKind m_targetKind;
};
//-----------------------------------------------------------------------------
@@ -582,7 +587,7 @@ class VariableListHandler : public IDocVariableList, public BaseHandler<Variable
/*! \brief Node representing a highlighted text fragment.
*
*/
-// children: -
+// TODO: children: ref
class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandler>
{
public:
@@ -590,14 +595,17 @@ class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandl
virtual ~HighlightHandler();
void startHighlight(const QXmlAttributes& attrib);
void endHighlight();
+ virtual void startRef(const QXmlAttributes&);
// IDocHighlight
virtual Kind kind() const { return Highlight; }
private:
+ void addTextNode();
+
IBaseHandler *m_parent;
QString m_class;
- QString m_text;
+ QList<IDoc> m_children;
};
//-----------------------------------------------------------------------------
@@ -915,4 +923,7 @@ class DocIterator : public BaseIterator<IDocIterator,IDoc,IDoc>
BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {}
};
+void dochandler_init();
+void dochandler_exit();
+
#endif
diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h
index 390e9bb..0ca2cc8 100644
--- a/addon/doxmlparser/src/doxmlintf.h
+++ b/addon/doxmlparser/src/doxmlintf.h
@@ -5,12 +5,15 @@
class IMember;
class IDocIterator;
+class ICompound;
+class ISection;
class ILinkedText
{
public:
enum Kind { Kind_Text, Kind_Ref };
virtual Kind kind() const = 0;
+ virtual ~ILinkedText() {}
};
class ILT_Text : public ILinkedText
@@ -49,6 +52,7 @@ class IParam
virtual QString attrib() const = 0;
virtual QString arraySpecifier() const = 0;
virtual ILinkedTextIterator *defaultValue() const = 0;
+ virtual ~IParam() {}
};
class IParamIterator
@@ -67,6 +71,7 @@ class IMemberReference
public:
virtual IMember *member() const = 0;
virtual QString memberName() const = 0;
+ virtual ~IMemberReference() {}
};
class IMemberReferenceIterator
@@ -85,6 +90,7 @@ class IEnumValue
public:
virtual QString name() const = 0;
virtual QString initializer() const = 0;
+ virtual ~IEnumValue() {}
};
class IEnumValueIterator
@@ -136,6 +142,7 @@ class IDoc
Root // 30 -> IDocRoot
};
virtual Kind kind() const = 0;
+ virtual ~IDoc() {}
};
class IDocMarkup : public IDoc
@@ -234,7 +241,7 @@ class IDocRef : public IDoc
{
public:
enum TargetKind { Member, Compound };
- virtual QString id() const = 0;
+ virtual QString refId() const = 0;
virtual TargetKind targetKind() const = 0;
virtual QString external() const = 0;
virtual QString text() const = 0;
@@ -340,11 +347,19 @@ class IDocIterator
class IMember
{
public:
- virtual QString kind() const = 0;
+ enum MemberKind { Invalid=0,
+ Define, Property, Variable, Typedef, Enum,
+ Function, Signal, Prototype, Friend, DCOP, Slot
+ };
+ virtual ICompound *compound() const = 0;
+ virtual ISection *section() const = 0;
+ virtual MemberKind kind() const = 0;
+ virtual QString kindString() const = 0;
virtual QString id() const = 0;
virtual QString protection() const = 0;
virtual QString virtualness() const = 0;
virtual ILinkedTextIterator *type() const = 0;
+ virtual QString typeString() const = 0;
virtual QString name() const = 0;
virtual bool isConst() const = 0;
virtual bool isVolatile() const = 0;
@@ -362,6 +377,7 @@ class IMember
virtual IEnumValueIterator *enumValues() const = 0;
virtual IDocRoot *briefDescription() const = 0;
virtual IDocRoot *detailedDescription() const = 0;
+ virtual ~IMember() {}
};
class IMemberIterator
@@ -378,8 +394,26 @@ class IMemberIterator
class ISection
{
public:
- virtual QString kind() const = 0;
+ enum SectionKind { Invalid=0,
+ UserDefined,
+ PubTypes, PubFuncs, PubAttribs, PubSlots,
+ Signals, DCOPFuncs, Properties,
+ PubStatFuncs, PubStatAttribs,
+ ProTypes, ProFuncs, ProAttribs, ProSlots,
+ ProStatFuncs, ProStatAttribs,
+ PriTypes, PriFuncs, PriAttribs, PriSlots,
+ PriStatFuncs, PriStatAttribs,
+ Friend, Related, Defines, Prototypes, Typedefs,
+ Enums, Functions, Variables
+ };
+ virtual QString kindString() const = 0;
+ virtual SectionKind kind() const = 0;
virtual IMemberIterator *members() const = 0;
+ virtual bool isStatic() const = 0;
+ virtual bool isPublic() const = 0;
+ virtual bool isPrivate() const = 0;
+ virtual bool isProtected() const = 0;
+ virtual ~ISection() {}
};
class ISectionIterator
@@ -396,21 +430,42 @@ class ISectionIterator
class ICompound
{
public:
+ enum CompoundKind { Invalid=0,
+ Class, Struct, Union, Interface, Exception,
+ Namespace, File, Group, Page, Package
+ };
virtual QString name() const = 0;
virtual QString id() const = 0;
- virtual QString kind() const = 0;
+ virtual CompoundKind kind() const = 0;
+ virtual QString kindString() const = 0;
virtual ISectionIterator *sections() const = 0;
virtual IDocRoot *briefDescription() const = 0;
virtual IDocRoot *detailedDescription() const = 0;
+
+ /*! Returns an interface to a member given its id.
+ * @param id The member id.
+ */
+ virtual IMember *memberById(const QString &id) const = 0;
+
+ /*! Returns a list of all members within the compound having a certain
+ * name. Overloading is the reason why there can be more than one member.
+ * @param name The name of the member.
+ */
+ virtual IMemberIterator *memberByName(const QString &name) const = 0;
+
+ /*! Decreases the reference counter for this compound. If it reaches
+ * zero, the memory for the compound will be released.
+ */
+ virtual void release() = 0;
};
class ICompoundIterator
{
public:
- virtual ICompound *toFirst() = 0;
- virtual ICompound *toLast() = 0;
- virtual ICompound *toNext() = 0;
- virtual ICompound *toPrev() = 0;
+ virtual void toFirst() = 0;
+ virtual void toLast() = 0;
+ virtual void toNext() = 0;
+ virtual void toPrev() = 0;
virtual ICompound *current() const = 0;
virtual void release() = 0;
};
@@ -419,6 +474,7 @@ class ICompoundIterator
class IDoxygen
{
public:
+
/*! Returns an iterator that can be used to iterate over the list
* of compounds found in the project.
*/
@@ -435,28 +491,43 @@ class IDoxygen
*/
virtual ICompound *compoundByName(const QString &name) const = 0;
- /*! Returns an interface to a member given its id.
+ /*! Returns an interface to a compound containing a member given it the
+ * member's id. Given the ICompound interface one can use the same id
+ * to obtain the IMember interface.
* @param id The member id.
*/
- virtual IMember *memberById(const QString &id) const = 0;
+ virtual ICompound *memberById(const QString &id) const = 0;
- /*! Returns a list of all members with a certain name.
+ /*! Returns a list of all compounds containing at least one members
+ * with a certain name. Each compound can be asked to return the
+ * list of members with that name.
* @param name The name of the member.
*/
- virtual IMemberIterator *memberByName(const QString &name) const = 0;
-
+ virtual ICompoundIterator *memberByName(const QString &name) const = 0;
+
/*! Releases the memory for the object hierarchy obtained by
* createdObjecModelFromXML(). First release all iterators before calling
* this function.
*/
virtual void release() = 0;
+
+ /*! Sets the debug level.
+ * - 0 all debugging messages are disabled (the default).
+ * - 1 display important messages only
+ * - 2 display any messages.
+ */
+ virtual void setDebugLevel(int level) = 0;
+
+ /*! Reads an XML directory produced by doxygen and builds up a data
+ * structure representing the contents of the XML files in the directory.
+ */
+ virtual bool readXMLDir(const char *xmlDirName) = 0;
};
-/*! Factory method that creates an object model given an XML file generated
- * by doxygen.
- * @param xmlFileName The name of the XML to parse.
- * @returns An iterface to the object model.
+/*! Factory method that creates an empty object model for a doxygen generated XML file.
+ * Use the readXMLDir() method to build the model from an XML output
+ * directory containing doxygen output.
*/
-IDoxygen *createObjectModelFromXML(const char *xmlFileName);
+IDoxygen *createObjectModel();
#endif
diff --git a/addon/doxmlparser/src/doxmlparser.pro.in b/addon/doxmlparser/src/doxmlparser.pro.in
index 7724b47..889f069 100644
--- a/addon/doxmlparser/src/doxmlparser.pro.in
+++ b/addon/doxmlparser/src/doxmlparser.pro.in
@@ -3,11 +3,13 @@ CONFIG = console staticlib warn_on $extraopts
HEADERS = basehandler.h mainhandler.h \
compoundhandler.h sectionhandler.h \
memberhandler.h paramhandler.h \
- dochandler.h linkedtexthandler.h
+ dochandler.h linkedtexthandler.h \
+ debug.h
SOURCES = mainhandler.cpp \
compoundhandler.cpp sectionhandler.cpp \
memberhandler.cpp paramhandler.cpp \
- dochandler.cpp linkedtexthandler.cpp
+ dochandler.cpp linkedtexthandler.cpp \
+ basehandler.cpp debug.cpp
unix:LIBS += -L../../../lib -lqtools
win32:INCLUDEPATH += .
win32-mingw:LIBS += -L../../../lib -lqtools
diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp
index fabd0c1..972e32e 100644
--- a/addon/doxmlparser/src/linkedtexthandler.cpp
+++ b/addon/doxmlparser/src/linkedtexthandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -13,6 +13,7 @@
*
*/
#include "linkedtexthandler.h"
+#include "debug.h"
#include <doxmlintf.h>
class LT_Text : public ILT_Text
@@ -46,9 +47,9 @@ class LT_Ref : public ILT_Ref
virtual Kind kind() const { return Kind_Ref; }
private:
- QString m_refId;
- QString m_extId;
- QString m_text;
+ QString m_refId;
+ QString m_extId;
+ QString m_text;
TargetKind m_targetKind;
};
@@ -79,7 +80,7 @@ void LinkedTextHandler::end()
if (!m_curString.isEmpty())
{
m_children.append(new LT_Text(m_curString));
- printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ debug(2,"LinkedTextHandler: add text `%s'\n",m_curString.data());
m_curString="";
}
m_parent->setDelegate(0);
@@ -90,7 +91,7 @@ void LinkedTextHandler::startRef(const QXmlAttributes& attrib)
if (!m_curString.isEmpty())
{
m_children.append(new LT_Text(m_curString));
- printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ debug(2,"LinkedTextHandler: add text `%s'\n",m_curString.data());
m_curString="";
}
ASSERT(m_ref==0);
@@ -98,15 +99,34 @@ void LinkedTextHandler::startRef(const QXmlAttributes& attrib)
m_ref->setRefId(attrib.value("refid"));
m_ref->setExtId(attrib.value("external"));
ASSERT(attrib.value("kindref")=="compound" || attrib.value("kindref")=="member");
- m_ref->setTargetKind(attrib.value("kindref")=="compound" ? Compound : Member);
+ m_ref->setTargetKind(attrib.value("kindref")=="compound" ? ILT_Ref::Compound : ILT_Ref::Member);
}
void LinkedTextHandler::endRef()
{
m_ref->setText(m_curString);
m_children.append(m_ref);
- printf("LinkedTextHandler: add ref `%s'\n",m_ref->text().data());
+ debug(2,"LinkedTextHandler: add ref `%s'\n",m_ref->text().data());
m_ref=0;
}
+QString LinkedTextHandler::toString(const QList<ILinkedText> &list)
+{
+ QListIterator<ILinkedText> li(list);
+ QString result;
+ ILinkedText *lt;
+ for (li.toFirst();(lt=li.current());++li)
+ {
+ switch(lt->kind())
+ {
+ case ILinkedText::Kind_Text:
+ result+=dynamic_cast<ILT_Text*>(lt)->text();
+ break;
+ case ILinkedText::Kind_Ref:
+ result+=dynamic_cast<ILT_Ref *>(lt)->text();
+ break;
+ }
+ }
+ return result;
+}
diff --git a/addon/doxmlparser/src/linkedtexthandler.h b/addon/doxmlparser/src/linkedtexthandler.h
index 0569b00..6055d29 100644
--- a/addon/doxmlparser/src/linkedtexthandler.h
+++ b/addon/doxmlparser/src/linkedtexthandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -36,6 +36,7 @@ class LinkedTextHandler : public BaseHandler<LinkedTextHandler>
virtual void end();
virtual void startRef(const QXmlAttributes& attrib);
virtual void endRef();
+ static QString toString(const QList<ILinkedText> &list);
private:
IBaseHandler *m_parent;
diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp
index 7d0e682..99cb665 100644
--- a/addon/doxmlparser/src/mainhandler.cpp
+++ b/addon/doxmlparser/src/mainhandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -15,112 +15,261 @@
#include <qxml.h>
#include "mainhandler.h"
+#include "compoundhandler.h"
+#include "debug.h"
-MainHandler::MainHandler() : m_compoundDict(10007), m_compoundNameDict(10007)
+class ErrorHandler : public QXmlErrorHandler
+{
+ public:
+ virtual ~ErrorHandler() {}
+ bool warning( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool error( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool fatalError( const QXmlParseException &exception )
+ {
+ debug(1,"Fatal error at line %d column %d: %s\n",
+ exception.lineNumber(),exception.columnNumber(),
+ exception.message().data());
+ return FALSE;
+ }
+ QString errorString() { return ""; }
+
+ private:
+ QString errorMsg;
+};
+
+//--------------------------------------------------------------------------
+
+class CompoundEntryIterator : public ICompoundIterator,
+ public QListIterator<CompoundEntry>
+{
+ public:
+ CompoundEntryIterator(const MainHandler *m,const QList<CompoundEntry> &list) :
+ QListIterator<CompoundEntry>(list), m_mainHandler(m) {}
+ virtual ~CompoundEntryIterator() {}
+
+ virtual void toFirst()
+ {
+ QListIterator<CompoundEntry>::toFirst();
+ }
+ virtual void toLast()
+ {
+ QListIterator<CompoundEntry>::toLast();
+ }
+ virtual void toNext()
+ {
+ QListIterator<CompoundEntry>::operator++();
+ }
+ virtual void toPrev()
+ {
+ QListIterator<CompoundEntry>::operator--();
+ }
+ virtual ICompound *current() const
+ {
+ CompoundEntry *ch = QListIterator<CompoundEntry>::current();
+ return ch ? m_mainHandler->compoundById(ch->id) : 0;
+ }
+ virtual void release()
+ { delete this; }
+
+ private:
+ const MainHandler *m_mainHandler;
+};
+
+//--------------------------------------------------------------------------
+
+MainHandler::MainHandler() : m_compoundDict(2999), m_compoundNameDict(2999),
+ m_memberDict(12251), m_memberNameDict(12251),
+ m_compoundsLoaded(1009)
{
m_compounds.setAutoDelete(TRUE);
+ m_memberNameDict.setAutoDelete(TRUE);
addStartHandler("doxygen");
- addStartHandler("compounddef",this,&MainHandler::startCompound);
addEndHandler("doxygen");
- addEndHandler("compounddef");
+ addStartHandler("compound",this,&MainHandler::startCompound);
+ addEndHandler("compound");
+ addStartHandler("member",this,&MainHandler::startMember);
+ addEndHandler("member",this,&MainHandler::endMember);
+ addStartHandler("name",this,&MainHandler::startName);
+ addEndHandler("name",this,&MainHandler::endName);
+ m_curCompound = 0;
}
MainHandler::~MainHandler()
{
- printf("MainHandler::~MainHandler()\n");
+ debug(2,"MainHandler::~MainHandler()\n");
}
void MainHandler::startCompound(const QXmlAttributes& attrib)
{
- CompoundHandler *compHandler = new CompoundHandler(this);
- compHandler->startCompound(attrib);
- m_compounds.append(compHandler);
+ m_curCompound = new CompoundEntry(257);
+ m_curCompound->id = attrib.value("id");
+ m_compounds.append(m_curCompound);
+ m_compoundDict.insert(m_curCompound->id,m_curCompound);
}
-void MainHandler::insertMemberById(const QString &id,IMember *h)
+void MainHandler::startName(const QXmlAttributes& /*attrib*/)
{
- m_memberDict.insert(id,h);
+ m_curString = "";
}
-void MainHandler::insertMemberByName(const QString &name,IMember *h)
+void MainHandler::endName()
{
- QList<IMember> *ml = m_memberNameDict[name];
- if (ml)
+ m_curCompound->name = m_curString;
+}
+
+void MainHandler::startMember(const QXmlAttributes& attrib)
+{
+ m_curString = "";
+ m_curMember = new MemberEntry;
+ m_curMember->id = attrib.value("id");
+ m_curMember->compound = m_curCompound;
+ m_memberDict.insert(m_curMember->id,m_curMember);
+}
+
+void MainHandler::endMember()
+{
+ m_curMember->name = m_curString;
+ m_curCompound->memberDict.insert(m_curString,m_curMember);
+ QList<CompoundEntry> *cel=0;
+ if ((cel=m_memberNameDict.find(m_curString))==0)
{
- ml->append(h);
+ cel = new QList<CompoundEntry>;
+ m_memberNameDict.insert(m_curString,cel);
}
- else
+ cel->append(m_curCompound);
+}
+
+void MainHandler::setDebugLevel(int level)
+{
+ ::setDebugLevel(level);
+}
+
+void MainHandler::dump()
+{
+ QListIterator<CompoundEntry> cli(m_compounds);
+ CompoundEntry *ce;
+ for (cli.toFirst();(ce=cli.current());++cli)
{
- ml = new QList<IMember>;
- ml->append(h);
- m_memberNameDict.insert(name,ml);
+ debug(2,"compound id=`%s' name=`%s'\n",ce->id.data(),ce->name.data());
+ QDictIterator<MemberEntry> mdi(ce->memberDict);
+ MemberEntry *me;
+ for (mdi.toFirst();(me=mdi.current());++mdi)
+ {
+ debug(2," member id=`%s' name=`%s'\n",me->id.data(),me->name.data());
+ }
}
}
-void MainHandler::initialize()
+bool MainHandler::readXMLDir(const char * xmlDirName)
{
- QListIterator<ICompound> mci(m_compounds);
- CompoundHandler *compHandler;
- for (;(compHandler=(CompoundHandler *)mci.current());++mci)
+ m_xmlDirName = xmlDirName;
+ QString xmlFileName=m_xmlDirName+"/index.xml";
+ QFile xmlFile(xmlFileName);
+ //printf("Trying %s xmlFile.exists()=%d isReadable()=%d\n",
+ // xmlFileName.data(),xmlFile.exists(),xmlFile.isReadable());
+ if (xmlFile.exists())
{
- compHandler->initialize(this);
- m_compoundNameDict.insert(compHandler->name(),compHandler);
- m_compoundDict.insert(compHandler->id(),compHandler);
+ ErrorHandler errorHandler;
+ QXmlInputSource source( xmlFile );
+ QXmlSimpleReader reader;
+ reader.setContentHandler( this );
+ reader.setErrorHandler( &errorHandler );
+ reader.parse( source );
+ dump();
+ return TRUE;
}
+ return FALSE;
+}
+
+ICompoundIterator *MainHandler::compounds() const
+{
+ return new CompoundEntryIterator(this,m_compounds);
+}
- // for each member
- QDictIterator< QList<IMember> > mndi(m_memberNameDict);
- QList<IMember> *ml;
- for (;(ml=mndi.current());++mndi)
+ICompound *MainHandler::compoundById(const QString &id) const
+{
+ if (id.isEmpty()) return 0;
+ CompoundHandler *ch = m_compoundsLoaded[id];
+ if (ch) // compound already in memory
{
- QListIterator<IMember> mli(*ml);
- IMember *mem;
- for (;(mem=mli.current());++mli)
- {
- ((MemberHandler*)mem)->initialize(this);
- }
+ ch->addref(); // returning alias -> increase reference counter
+ return ch;
+ }
+ CompoundEntry *ce = m_compoundDict.find(id);
+ if (ce==0) return 0; // id not found
+ // create and load a new compound
+ ch = new CompoundHandler(m_xmlDirName);
+ if (!ch->parseXML(id))
+ {
+ // compound could not be initialized.
+ delete ch;
+ return 0;
}
+ // we disregard the constness here, because the object stays conceptually
+ // unchanged.
+ MainHandler *that = (MainHandler *)this;
+ ch->initialize(that);
+ that->m_compoundsLoaded.insert(id,ch);
+ return ch;
}
-class ErrorHandler : public QXmlErrorHandler
+void MainHandler::unloadCompound(CompoundHandler *ch)
{
- 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 ""; }
+ m_compoundsLoaded.remove(ch->id());
+}
- private:
- QString errorMsg;
-};
+ICompound *MainHandler::compoundByName(const QString &name) const
+{
+ if (name.isEmpty()) return 0;
+ CompoundEntry *ce = m_compoundNameDict[name];
+ if (ce==0) return 0; // name not found
+ return compoundById(ce->id);
+}
-IDoxygen *createObjectModelFromXML(const char * xmlFileName)
+ICompound *MainHandler::memberById(const QString &id) const
{
- QFile xmlFile(xmlFileName);
- MainHandler * handler = new MainHandler;
- ErrorHandler errorHandler;
- QXmlInputSource source( xmlFile );
- QXmlSimpleReader reader;
- reader.setContentHandler( handler );
- reader.setErrorHandler( &errorHandler );
- reader.parse( source );
- printf("<---------- initialize ----------->\n");
- handler->initialize();
- printf("<-------- end initialize --------->\n");
- return handler;
+ if (id.isEmpty()) return 0;
+ MemberEntry *me = m_memberDict[id];
+ if (me==0) return 0; // id not found
+ return compoundById(me->id);
+}
+
+ICompoundIterator *MainHandler::memberByName(const QString &name) const
+{
+ if (name.isEmpty()) return 0;
+ QList<CompoundEntry> *cel = m_memberNameDict[name];
+ if (cel==0) return 0; // name not found
+ return new CompoundEntryIterator(this,*cel);
+}
+
+IDoxygen *createObjectModel()
+{
+ compoundhandler_init();
+ sectionhandler_init();
+ memberhandler_init();
+ dochandler_init();
+ return new MainHandler;
+}
+
+void MainHandler::release()
+{
+ QDictIterator<CompoundHandler> chi(m_compoundsLoaded);
+ CompoundHandler *ch;
+ for (chi.toFirst();(ch=chi.current());++chi)
+ {
+ debug(1,"Compound %s not released\n",ch->name().data());
+ }
+ dochandler_exit();
+ memberhandler_exit();
+ sectionhandler_exit();
+ compoundhandler_exit();
+ delete this;
}
diff --git a/addon/doxmlparser/src/mainhandler.h b/addon/doxmlparser/src/mainhandler.h
index e466b6f..da7fe75 100644
--- a/addon/doxmlparser/src/mainhandler.h
+++ b/addon/doxmlparser/src/mainhandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -22,47 +22,60 @@
#include <doxmlintf.h>
#include "memberhandler.h"
+struct CompoundEntry;
+
+struct IndexEntry
+{
+ QString id;
+ QString name;
+};
+
+struct MemberEntry : public IndexEntry
+{
+ CompoundEntry *compound;
+};
+
+struct CompoundEntry : public IndexEntry
+{
+ CompoundEntry(int size) : memberDict(size)
+ { memberDict.setAutoDelete(TRUE); }
+ QDict<MemberEntry> memberDict;
+};
+
class MainHandler : public IDoxygen, public BaseHandler<MainHandler>
{
public:
virtual void startCompound(const QXmlAttributes& attrib);
+ virtual void startMember(const QXmlAttributes& attrib);
+ virtual void endMember();
+ virtual void startName(const QXmlAttributes& attrib);
+ virtual void endName();
MainHandler();
virtual ~MainHandler();
- ICompoundIterator *compounds() const
- {
- return new CompoundIterator(m_compounds);
- }
- ICompound *compoundById(const QString &id) const
- {
- return m_compoundDict[id];
- }
- virtual ICompound *compoundByName(const QString &name) const
- {
- return name.isEmpty() ? 0 : m_compoundNameDict[name];
- }
- virtual IMember *memberById(const QString &id) const
- {
- return m_memberDict[id];
- }
- virtual IMemberIterator *memberByName(const QString &name) const
- {
- QList<IMember> *ml = m_memberNameDict[name];
- if (ml==0) return 0;
- return new MemberIterator(*ml);
- }
- virtual void release() { delete this; }
- void insertMemberById(const QString &id,IMember *h);
- void insertMemberByName(const QString &name,IMember *h);
+ // IDoxygen
+ ICompoundIterator *compounds() const;
+ ICompound *compoundById(const QString &id) const;
+ virtual ICompound *compoundByName(const QString &name) const;
+ virtual ICompound *memberById(const QString &id) const;
+ virtual ICompoundIterator *memberByName(const QString &name) const;
- void initialize();
+ virtual void release();
+ void setDebugLevel(int level);
+ bool readXMLDir(const char *dirName);
+ void dump();
+ void unloadCompound(CompoundHandler *ch);
private:
- QList<ICompound> m_compounds;
- QDict<ICompound> m_compoundDict;
- QDict<ICompound> m_compoundNameDict;
- QDict<IMember> m_memberDict;
- QDict<QList<IMember> > m_memberNameDict;
+ CompoundEntry *m_curCompound;
+ MemberEntry *m_curMember;
+ QList<CompoundEntry> m_compounds;
+ QDict<CompoundEntry> m_compoundDict;
+ QDict<CompoundEntry> m_compoundNameDict;
+ QDict<MemberEntry> m_memberDict;
+ QDict<QList<CompoundEntry> > m_memberNameDict;
+ QString m_xmlDirName;
+ QDict<CompoundHandler> m_compoundsLoaded;
};
#endif
diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp
index f211f8e..d98035b 100644
--- a/addon/doxmlparser/src/memberhandler.cpp
+++ b/addon/doxmlparser/src/memberhandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -18,6 +18,53 @@
#include "dochandler.h"
#include "mainhandler.h"
#include "linkedtexthandler.h"
+#include "debug.h"
+
+//------------------------------------------------------------------------------
+
+class MemberTypeMap
+{
+ public:
+ MemberTypeMap()
+ {
+ m_map.setAutoDelete(TRUE);
+ m_map.insert("define",new int(IMember::Define));
+ m_map.insert("property",new int(IMember::Property));
+ m_map.insert("variable",new int(IMember::Variable));
+ m_map.insert("typedef",new int(IMember::Typedef));
+ m_map.insert("enum",new int(IMember::Enum));
+ m_map.insert("function",new int(IMember::Function));
+ m_map.insert("signal",new int(IMember::Signal));
+ m_map.insert("prototype",new int(IMember::Prototype));
+ m_map.insert("friend",new int(IMember::Friend));
+ m_map.insert("dcop",new int(IMember::DCOP));
+ m_map.insert("slot",new int(IMember::Slot));
+ }
+ IMember::MemberKind map(const QString &s)
+ {
+ int *val = m_map.find(s);
+ if (val==0)
+ {
+ debug(1,"Warning: `%s' is an invalid member type\n",s.data());
+ return IMember::Invalid;
+ }
+ else return (IMember::MemberKind)*val;
+ }
+ private:
+ QDict<int> m_map;
+};
+
+static MemberTypeMap *s_typeMap;
+
+void memberhandler_init()
+{
+ s_typeMap = new MemberTypeMap;
+}
+
+void memberhandler_exit()
+{
+ delete s_typeMap;
+}
//------------------------------------------------------------------------------
@@ -28,7 +75,8 @@ void MemberReference::initialize(MainHandler *mh)
IMember *MemberReference::member() const
{
- return m_mainHandler->memberById(m_memId);
+ //return m_mainHandler->memberById(m_memId);
+ return 0;
}
//------------------------------------------------------------------------------
@@ -77,8 +125,9 @@ void EnumValueHandler::endInitializer()
//------------------------------------------------------------------------------
MemberHandler::MemberHandler(IBaseHandler *parent)
- : m_parent(parent), m_brief(0), m_detailed(0)
+ : m_parent(parent), m_compound(0), m_brief(0), m_detailed(0)
{
+ //printf("MemberHandler::MemberHandler() %p\n",this);
addEndHandler("memberdef",this,&MemberHandler::endMember);
addStartHandler("type",this,&MemberHandler::startType);
@@ -110,6 +159,9 @@ MemberHandler::MemberHandler(IBaseHandler *parent)
addStartHandler("location",this,&MemberHandler::startLocation);
addEndHandler("location");
+ m_type.setAutoDelete(TRUE);
+ m_initializer.setAutoDelete(TRUE);
+ m_exception.setAutoDelete(TRUE);
m_params.setAutoDelete(TRUE);
m_references.setAutoDelete(TRUE);
m_referencedBy.setAutoDelete(TRUE);
@@ -124,22 +176,25 @@ MemberHandler::MemberHandler(IBaseHandler *parent)
MemberHandler::~MemberHandler()
{
+ debug(2,"MemberHandler::~MemberHandler() %p\n",this);
delete m_brief;
delete m_detailed;
delete m_linkedTextHandler;
+ delete m_reimplements;
}
void MemberHandler::startMember(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- m_kind = attrib.value("kind");
+ m_kindString = attrib.value("kind");
+ m_kind = s_typeMap->map(m_kindString);
m_id = attrib.value("id");
m_virtualness = attrib.value("virt");
m_protection = attrib.value("prot");
m_isConst = attrib.value("const")=="yes";
m_isVolatile = attrib.value("volatile")=="yes";
- printf("member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n",
- m_kind.data(),m_id.data(),m_protection.data(),m_virtualness.data());
+ debug(2,"member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n",
+ m_kindString.data(),m_id.data(),m_protection.data(),m_virtualness.data());
}
void MemberHandler::startBriefDesc(const QXmlAttributes& attrib)
@@ -226,7 +281,7 @@ void MemberHandler::endMember()
void MemberHandler::startType(const QXmlAttributes &)
{
- printf("startType!\n");
+ debug(2,"startType!\n");
delete m_linkedTextHandler;
m_linkedTextHandler = new LinkedTextHandler(this,m_type);
m_linkedTextHandler->start("type");
@@ -234,7 +289,7 @@ void MemberHandler::startType(const QXmlAttributes &)
void MemberHandler::startInitializer(const QXmlAttributes &)
{
- printf("startInitializer!\n");
+ debug(2,"startInitializer!\n");
delete m_linkedTextHandler;
m_linkedTextHandler = new LinkedTextHandler(this,m_initializer);
m_linkedTextHandler->start("initializer");
@@ -242,7 +297,7 @@ void MemberHandler::startInitializer(const QXmlAttributes &)
void MemberHandler::startException(const QXmlAttributes &)
{
- printf("startException!\n");
+ debug(2,"startException!\n");
delete m_linkedTextHandler;
m_linkedTextHandler = new LinkedTextHandler(this,m_exception);
m_linkedTextHandler->start("exception");
@@ -251,7 +306,7 @@ void MemberHandler::startException(const QXmlAttributes &)
void MemberHandler::endName()
{
m_name = m_curString.stripWhiteSpace();
- printf("member name=`%s'\n",m_name.data());
+ debug(2,"member name=`%s'\n",m_name.data());
}
void MemberHandler::startParam(const QXmlAttributes& attrib)
@@ -297,3 +352,25 @@ void MemberHandler::initialize(MainHandler *mh)
if (m_reimplements) m_reimplements->initialize(mh);
}
+void MemberHandler::setCompoundHandler(CompoundHandler *c)
+{
+ m_compound = c;
+}
+
+ICompound *MemberHandler::compound() const
+{
+ m_compound->addref();
+ return m_compound;
+}
+
+void MemberHandler::setSectionHandler(SectionHandler *c)
+{
+ m_section = c;
+}
+
+ISection *MemberHandler::section() const
+{
+ return m_section;
+}
+
+
diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h
index b599e2f..3232a4c 100644
--- a/addon/doxmlparser/src/memberhandler.h
+++ b/addon/doxmlparser/src/memberhandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -28,6 +28,8 @@
#include "dochandler.h"
class MainHandler;
+class CompoundHandler;
+class SectionHandler;
struct MemberReference : public IMemberReference
{
@@ -48,13 +50,6 @@ class MemberReferenceIterator : public BaseIterator<IMemberReferenceIterator,IMe
BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>(list) {}
};
-class MemberIterator : public BaseIterator<IMemberIterator,IMember,IMember>
-{
- public:
- MemberIterator(const QList<IMember> &list) :
- BaseIterator<IMemberIterator,IMember,IMember>(list) {}
-};
-
class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler>
{
public:
@@ -116,8 +111,12 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler>
virtual ~MemberHandler();
// IMember implementation
- virtual QString kind() const
+ virtual ICompound *compound() const;
+ virtual ISection *section() const;
+ virtual MemberKind kind() const
{ return m_kind; }
+ virtual QString kindString() const
+ { return m_kindString; }
virtual QString id() const
{ return m_id; }
virtual QString protection() const
@@ -132,6 +131,8 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler>
{ return m_isVolatile; }
virtual ILinkedTextIterator *type() const
{ return new LinkedTextIterator(m_type); }
+ virtual QString typeString() const
+ { return LinkedTextHandler::toString(m_type); }
virtual IParamIterator *params() const
{ return new ParamIterator(m_params); }
virtual IMemberReferenceIterator *references() const
@@ -162,10 +163,15 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler>
{ return m_detailed; }
void initialize(MainHandler *m);
+ void setCompoundHandler(CompoundHandler *c);
+ void setSectionHandler(SectionHandler *s);
private:
IBaseHandler *m_parent;
- QString m_kind;
+ CompoundHandler *m_compound;
+ SectionHandler *m_section;
+ MemberKind m_kind;
+ QString m_kindString;
QString m_id;
QString m_protection;
QString m_virtualness;
@@ -190,4 +196,14 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler>
QList<EnumValueHandler> m_enumValues;
};
+class MemberIterator : public BaseIterator<IMemberIterator,IMember,MemberHandler>
+{
+ public:
+ MemberIterator(const QList<MemberHandler> &list) :
+ BaseIterator<IMemberIterator,IMember,MemberHandler>(list) {}
+};
+
+void memberhandler_init();
+void memberhandler_exit();
+
#endif
diff --git a/addon/doxmlparser/src/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp
index 0cf00e4..8647546 100644
--- a/addon/doxmlparser/src/paramhandler.cpp
+++ b/addon/doxmlparser/src/paramhandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -15,6 +15,7 @@
#include "paramhandler.h"
#include "memberhandler.h"
+#include "debug.h"
ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent)
{
@@ -41,12 +42,13 @@ ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent)
ParamHandler::~ParamHandler()
{
+ delete m_linkedTextHandler;
}
void ParamHandler::startParam(const QXmlAttributes& /*attrib*/)
{
m_parent->setDelegate(this);
- printf("param\n");
+ debug(2,"param\n");
}
void ParamHandler::endParam()
@@ -59,39 +61,39 @@ void ParamHandler::startType(const QXmlAttributes& /*attrib*/)
delete m_linkedTextHandler;
m_linkedTextHandler = new LinkedTextHandler(this,m_type);
m_linkedTextHandler->start("type");
- printf("param type\n");
+ debug(2,"param type\n");
}
void ParamHandler::endDeclName()
{
m_declName = m_curString.stripWhiteSpace();
- printf("member declName=`%s'\n",m_declName.data());
+ debug(2,"member declName=`%s'\n",m_declName.data());
}
void ParamHandler::endDefName()
{
m_defName = m_curString.stripWhiteSpace();
- printf("member defName=`%s'\n",m_defName.data());
+ debug(2,"member defName=`%s'\n",m_defName.data());
}
void ParamHandler::endAttrib()
{
m_attrib = m_curString.stripWhiteSpace();
- printf("member attrib=`%s'\n",m_attrib.data());
+ debug(2,"member attrib=`%s'\n",m_attrib.data());
}
void ParamHandler::endArray()
{
m_array = m_curString.stripWhiteSpace();
- printf("member array=`%s'\n",m_array.data());
+ debug(2,"member array=`%s'\n",m_array.data());
}
void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/)
{
delete m_linkedTextHandler;
m_linkedTextHandler = new LinkedTextHandler(this,m_defVal);
- m_linkedTextHandler->start("type");
- printf("member defVal\n");
+ m_linkedTextHandler->start("defval");
+ debug(2,"member defVal\n");
}
diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h
index 6725a5e..ae02e96 100644
--- a/addon/doxmlparser/src/paramhandler.h
+++ b/addon/doxmlparser/src/paramhandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxmlparser/src/sectionhandler.cpp b/addon/doxmlparser/src/sectionhandler.cpp
index d1c7b1f..a1d9c44 100644
--- a/addon/doxmlparser/src/sectionhandler.cpp
+++ b/addon/doxmlparser/src/sectionhandler.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -16,9 +16,74 @@
#include "mainhandler.h"
#include "compoundhandler.h"
#include "sectionhandler.h"
+#include "debug.h"
+
+class SectionTypeMap
+{
+ public:
+ SectionTypeMap() : m_map(37)
+ {
+ m_map.setAutoDelete(TRUE);
+ m_map.insert("user-defined",new int(ISection::UserDefined));
+ m_map.insert("public-type",new int(ISection::PubTypes));
+ m_map.insert("public-func",new int(ISection::PubFuncs));
+ m_map.insert("public-attrib",new int(ISection::PubAttribs));
+ m_map.insert("public-slot",new int(ISection::PubSlots));
+ m_map.insert("signal",new int(ISection::Signals));
+ m_map.insert("dcop-func",new int(ISection::DCOPFuncs));
+ m_map.insert("property",new int(ISection::Properties));
+ m_map.insert("public-static-func",new int(ISection::PubStatFuncs));
+ m_map.insert("public-static-attrib",new int(ISection::PubStatAttribs));
+ m_map.insert("protected-type",new int(ISection::ProTypes));
+ m_map.insert("protected-func",new int(ISection::ProFuncs));
+ m_map.insert("protected-attrib",new int(ISection::ProAttribs));
+ m_map.insert("protected-slot",new int(ISection::ProSlots));
+ m_map.insert("protected-static-func",new int(ISection::ProStatFuncs));
+ m_map.insert("protected-static-attrib",new int(ISection::ProStatAttribs));
+ m_map.insert("private-type",new int(ISection::PriTypes));
+ m_map.insert("private-func",new int(ISection::PriFuncs));
+ m_map.insert("private-attrib",new int(ISection::PriAttribs));
+ m_map.insert("private-slot",new int(ISection::PriSlots));
+ m_map.insert("private-static-func",new int(ISection::PriStatFuncs));
+ m_map.insert("private-static-attrib",new int(ISection::PriStatAttribs));
+ m_map.insert("friend",new int(ISection::Friend));
+ m_map.insert("related",new int(ISection::Related));
+ m_map.insert("define",new int(ISection::Defines));
+ m_map.insert("prototype",new int(ISection::Prototypes));
+ m_map.insert("typedef",new int(ISection::Typedefs));
+ m_map.insert("enum",new int(ISection::Enums));
+ m_map.insert("func",new int(ISection::Functions));
+ m_map.insert("var",new int(ISection::Variables));
+ }
+ ISection::SectionKind map(const QString &s)
+ {
+ int *val = m_map.find(s);
+ if (val==0)
+ {
+ debug(1,"Warning: `%s' is an invalid section type\n",s.data());
+ return ISection::Invalid;
+ }
+ else return (ISection::SectionKind)*val;
+ }
+ private:
+ QDict<int> m_map;
+};
+
+static SectionTypeMap *s_typeMap;
+
+void sectionhandler_init()
+{
+ s_typeMap = new SectionTypeMap;
+}
+
+void sectionhandler_exit()
+{
+ delete s_typeMap;
+}
SectionHandler::SectionHandler(IBaseHandler *parent) : m_parent(parent)
{
+ //printf("SectionHandler::SectionHandler()\n");
m_members.setAutoDelete(TRUE);
addEndHandler("sectiondef",this,&SectionHandler::endSection);
addStartHandler("memberdef",this,&SectionHandler::startMember);
@@ -26,13 +91,15 @@ SectionHandler::SectionHandler(IBaseHandler *parent) : m_parent(parent)
SectionHandler::~SectionHandler()
{
+ debug(2,"SectionHandler::~SectionHandler()\n");
}
void SectionHandler::startSection(const QXmlAttributes& attrib)
{
m_parent->setDelegate(this);
- m_kind = attrib.value("kind");
- printf("section kind=`%s'\n",m_kind.data());
+ m_kindString = attrib.value("kind");
+ m_kind = s_typeMap->map(m_kindString);
+ debug(2,"section kind=`%s'\n",m_kindString.data());
}
void SectionHandler::endSection()
@@ -47,14 +114,15 @@ void SectionHandler::startMember(const QXmlAttributes& attrib)
m_members.append(memHandler);
}
-void SectionHandler::initialize(MainHandler *m)
+void SectionHandler::initialize(CompoundHandler *ch)
{
- QListIterator<IMember> mli(m_members);
+ QListIterator<MemberHandler> mli(m_members);
MemberHandler *mh;
- for (;(mh=(MemberHandler *)mli.current());++mli)
+ for (;(mh=mli.current());++mli)
{
- m->insertMemberById(mh->id(),mh);
- m->insertMemberByName(mh->name(),mh);
+ mh->setCompoundHandler(ch);
+ ch->insertMember(mh);
+ mh->setSectionHandler(this);
}
}
diff --git a/addon/doxmlparser/src/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h
index 234cce1..1f4b03a 100644
--- a/addon/doxmlparser/src/sectionhandler.h
+++ b/addon/doxmlparser/src/sectionhandler.h
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -47,16 +47,43 @@ class SectionHandler : public ISection, public BaseHandler<SectionHandler>
virtual ~SectionHandler();
// ISection
- virtual QString kind() const { return m_kind; }
+ virtual QString kindString() const
+ { return m_kindString; }
+ virtual SectionKind kind() const
+ { return m_kind; }
virtual IMemberIterator *members() const
{ return new MemberIterator(m_members); }
+ virtual bool isStatic() const
+ {
+ return m_kind==PubStatFuncs || m_kind==PubStatAttribs ||
+ m_kind==ProStatFuncs || m_kind==ProStatAttribs ||
+ m_kind==PriStatFuncs || m_kind==PriStatAttribs;
+ }
+ virtual bool isPublic() const
+ {
+ return !isProtected() && !isPrivate();
+ }
+ virtual bool isProtected() const
+ {
+ return m_kind==ProTypes || m_kind==ProFuncs || m_kind==ProAttribs ||
+ m_kind==ProSlots || m_kind==ProStatFuncs || m_kind==ProStatAttribs;
+ }
+ virtual bool isPrivate() const
+ {
+ return m_kind==PriTypes || m_kind==PriFuncs || m_kind==PriAttribs ||
+ m_kind==PriSlots || m_kind==PriStatFuncs || m_kind==PriStatAttribs;
+ }
- void initialize(MainHandler *m);
+ void initialize(CompoundHandler *c);
private:
IBaseHandler *m_parent;
- QString m_kind;
- QList<IMember> m_members;
+ SectionKind m_kind;
+ QString m_kindString;
+ QList<MemberHandler> m_members;
};
+void sectionhandler_init();
+void sectionhandler_exit();
+
#endif
diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp
index b94bc0a..092c025 100644
--- a/addon/doxmlparser/test/main.cpp
+++ b/addon/doxmlparser/test/main.cpp
@@ -3,7 +3,7 @@
* $Id$
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
@@ -312,11 +312,17 @@ int main(int argc,char **argv)
{
if (argc!=2)
{
- printf("Usage: %s file.xml\n",argv[0]);
+ printf("Usage: %s xmldir\n",argv[0]);
exit(1);
}
- IDoxygen *dox = createObjectModelFromXML(argv[1]);
+ IDoxygen *dox = createObjectModel();
+
+ if (!dox->readXMLDir(argv[1]))
+ {
+ printf("Error reading %s/index.xml\n",argv[1]);
+ exit(1);
+ }
ICompoundIterator *cli = dox->compounds();
ICompound *comp;
@@ -324,12 +330,12 @@ int main(int argc,char **argv)
for (cli->toFirst();(comp=cli->current());cli->toNext())
{
printf("Compound name=%s id=%s kind=%s\n",
- comp->name().data(),comp->id().data(),comp->kind().data());
+ comp->name().data(),comp->id().data(),comp->kindString().data());
ISectionIterator *sli = comp->sections();
ISection *sec;
for (sli->toFirst();(sec=sli->current());sli->toNext())
{
- printf(" Section kind=%s\n",sec->kind().data());
+ printf(" Section kind=%s\n",sec->kindString().data());
IMemberIterator *mli = sec->members();
IMember *mem;
for (mli->toFirst();(mem=mli->current());mli->toNext())
@@ -412,6 +418,7 @@ int main(int argc,char **argv)
printf("===== detailed description ==== \n");
DumpDoc(doc);
}
+ comp->release();
}
cli->release();
printf("---------------------------\n");
diff --git a/addon/doxywizard/Makefile.in b/addon/doxywizard/Makefile.in
index 31ed5e3..c382681 100644
--- a/addon/doxywizard/Makefile.in
+++ b/addon/doxywizard/Makefile.in
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (C) 1997-2001 by Dimitri van Heesch.
+# Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/Makefile.win_nmake.in b/addon/doxywizard/Makefile.win_nmake.in
index 5cb4e1c..69d1dbd 100644
--- a/addon/doxywizard/Makefile.win_nmake.in
+++ b/addon/doxywizard/Makefile.win_nmake.in
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (C) 1997-2001 by Dimitri van Heesch.
+# Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp
index 54b592e..5fbd5e4 100644
--- a/addon/doxywizard/doxywizard.cpp
+++ b/addon/doxywizard/doxywizard.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h
index be99539..17b54d1 100644
--- a/addon/doxywizard/doxywizard.h
+++ b/addon/doxywizard/doxywizard.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/doxywizard.pro.in b/addon/doxywizard/doxywizard.pro.in
index d36db53..d0748f7 100644
--- a/addon/doxywizard/doxywizard.pro.in
+++ b/addon/doxywizard/doxywizard.pro.in
@@ -1,7 +1,7 @@
#
#
#
-# Copyright (C) 1997-2001 by Dimitri van Heesch.
+# Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputbool.cpp b/addon/doxywizard/inputbool.cpp
index c77578e..43d994d 100644
--- a/addon/doxywizard/inputbool.cpp
+++ b/addon/doxywizard/inputbool.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputbool.h b/addon/doxywizard/inputbool.h
index 2b4d869..ab9728f 100644
--- a/addon/doxywizard/inputbool.h
+++ b/addon/doxywizard/inputbool.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputint.cpp b/addon/doxywizard/inputint.cpp
index 702988c..038f0d4 100644
--- a/addon/doxywizard/inputint.cpp
+++ b/addon/doxywizard/inputint.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputint.h b/addon/doxywizard/inputint.h
index 47fbf13..f9e28a1 100644
--- a/addon/doxywizard/inputint.h
+++ b/addon/doxywizard/inputint.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputstring.cpp b/addon/doxywizard/inputstring.cpp
index a20ba68..0ca9d15 100644
--- a/addon/doxywizard/inputstring.cpp
+++ b/addon/doxywizard/inputstring.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputstring.h b/addon/doxywizard/inputstring.h
index 1c4554d..a1d443c 100644
--- a/addon/doxywizard/inputstring.h
+++ b/addon/doxywizard/inputstring.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp
index 9ab9a5b..8b96dc7 100644
--- a/addon/doxywizard/inputstrlist.cpp
+++ b/addon/doxywizard/inputstrlist.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/inputstrlist.h b/addon/doxywizard/inputstrlist.h
index 115bad2..9595ff9 100644
--- a/addon/doxywizard/inputstrlist.h
+++ b/addon/doxywizard/inputstrlist.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/pagewidget.cpp b/addon/doxywizard/pagewidget.cpp
index 7e6920b..39ba7c9 100644
--- a/addon/doxywizard/pagewidget.cpp
+++ b/addon/doxywizard/pagewidget.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/pagewidget.h b/addon/doxywizard/pagewidget.h
index 6d238df..14ac6d9 100644
--- a/addon/doxywizard/pagewidget.h
+++ b/addon/doxywizard/pagewidget.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/pixmaps.cpp b/addon/doxywizard/pixmaps.cpp
index 5f2497b..b547b64 100644
--- a/addon/doxywizard/pixmaps.cpp
+++ b/addon/doxywizard/pixmaps.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/pixmaps.h b/addon/doxywizard/pixmaps.h
index 7ec854e..75d74e6 100644
--- a/addon/doxywizard/pixmaps.h
+++ b/addon/doxywizard/pixmaps.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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
diff --git a/addon/doxywizard/qtbc.h b/addon/doxywizard/qtbc.h
index 51f62dd..0f23e42 100644
--- a/addon/doxywizard/qtbc.h
+++ b/addon/doxywizard/qtbc.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ * Copyright (C) 1997-2002 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