diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-01-22 17:56:24 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-01-22 17:56:24 (GMT) |
commit | 61e51f0c7b139596e54aaea4c4d684b59cbfae57 (patch) | |
tree | d15a4da33ccd88d9f7ebd50a6090a12c90ccbae4 /addon/doxmlparser/src/sectionhandler.cpp | |
parent | 9d4d8095cd70a06a3536eea20c32ca7bbddd9f3a (diff) | |
download | Doxygen-61e51f0c7b139596e54aaea4c4d684b59cbfae57.zip Doxygen-61e51f0c7b139596e54aaea4c4d684b59cbfae57.tar.gz Doxygen-61e51f0c7b139596e54aaea4c4d684b59cbfae57.tar.bz2 |
Doxygen-1.2.13-20020122
Diffstat (limited to 'addon/doxmlparser/src/sectionhandler.cpp')
-rw-r--r-- | addon/doxmlparser/src/sectionhandler.cpp | 84 |
1 files changed, 76 insertions, 8 deletions
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); } } |