mainhandler.h 2.28 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * $Id$
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4 5
 *
 *
6
 * Copyright (C) 1997-2013 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
7 8 9 10 11 12 13 14 15
 *
 * 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.
 *
 */

Dimitri van Heesch's avatar
Dimitri van Heesch committed
16 17 18 19
#ifndef _MAINHANDLER_H
#define _MAINHANDLER_H

#include <qlist.h>
20

Dimitri van Heesch's avatar
Dimitri van Heesch committed
21
#include <doxmlintf.h>
22
#include "basehandler.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
23

24
class CompoundHandler;
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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;
};

45
class MainHandler : public IDoxygen, public BaseHandler<MainHandler>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
46 47 48
{
  public:
    virtual void startCompound(const QXmlAttributes& attrib);
49 50 51 52
    virtual void startMember(const QXmlAttributes& attrib);
    virtual void endMember();
    virtual void startName(const QXmlAttributes& attrib);
    virtual void endName();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
53 54
    MainHandler();
    virtual ~MainHandler();
55

56 57
    // IDoxygen
    ICompoundIterator *compounds() const;
58 59 60 61
    ICompound *compoundById(const char *id) const;
    virtual ICompound *compoundByName(const char *name) const;
    virtual ICompound *memberById(const char *id) const;
    virtual ICompoundIterator *memberByName(const char *name) const;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
62

63 64 65 66 67
    virtual void release();
    void setDebugLevel(int level);
    bool readXMLDir(const char *dirName);
    void dump();
    void unloadCompound(CompoundHandler *ch);
68

Dimitri van Heesch's avatar
Dimitri van Heesch committed
69
  private:
70 71 72 73 74 75 76 77 78
    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;
79
    bool                         m_insideMember;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
80 81 82
};

#endif