summaryrefslogtreecommitdiffstats
path: root/addon/doxmlparser/src/mainhandler.h
blob: 64f36cf632d088c159989579cce6b45869e09d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/******************************************************************************
 *
 * $Id$
 *
 *
 * Copyright (C) 1997-2004 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 */

#ifndef _MAINHANDLER_H
#define _MAINHANDLER_H

#include <qlist.h>

#include <doxmlintf.h>
#include "basehandler.h"

class CompoundHandler;
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();

    // IDoxygen
    ICompoundIterator *compounds() const;
    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;

    virtual void release();
    void setDebugLevel(int level);
    bool readXMLDir(const char *dirName);
    void dump();
    void unloadCompound(CompoundHandler *ch);

  private:
    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;
    bool                         m_insideMember;
};

#endif