memberhandler.h 9.96 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2 3 4 5
/******************************************************************************
 *
 * $Id$
 *
 *
6
 * Copyright (C) 1997-2006 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * 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 _MEMBERHANDLER_H
#define _MEMBERHANDLER_H

#include <qstring.h>
#include <qlist.h>
#include <qxml.h>
#include <doxmlintf.h>

#include "basehandler.h"
#include "baseiterator.h"
26
#include "stringimpl.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
27 28

class MainHandler;
29 30
class CompoundHandler;
class SectionHandler;
31
class ParamHandler;
32 33 34
class LinkedTextImpl;
class LinkedTextHandler;
class DocHandler;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
35

36
class MemberReference : public IMemberReference
Dimitri van Heesch's avatar
Dimitri van Heesch committed
37
{
38 39 40
  public:
    virtual ~MemberReference() {}
    virtual IMember *member() const;
41 42 43 44 45
    virtual const IString *name() const { return &m_name; }
    virtual const IString *scope() const { return &m_scope; }
    virtual const IString *protection() const { return &m_protection; }
    virtual const IString *virtualness() const { return &m_virtualness; }
    virtual const IString *ambiguityScope() const { return &m_ambiguityScope; }
46
    void initialize(MainHandler *m);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
47

48 49
    QString      m_memId;
    StringImpl   m_name;
50 51 52 53
    StringImpl   m_scope;
    StringImpl   m_virtualness;
    StringImpl   m_protection;
    StringImpl   m_ambiguityScope;
54
    MainHandler *m_mainHandler;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
55 56 57 58 59 60 61 62 63
};

class MemberReferenceIterator : public BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>
{
  public:
    MemberReferenceIterator(const QList<MemberReference> &list) : 
      BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>(list) {}
};

64 65 66 67 68 69 70 71 72 73 74 75 76
class MemberHandler : public IDefine,
                      public IProperty, 
                      public IVariable,
                      public ITypedef,
                      public IFunction,
                      public ISignal,
                      public IPrototype,
                      public IFriend,
                      public IDCOP,
                      public ISlot,
                      public IEnum,
                      public IEnumValue,
                      public BaseHandler<MemberHandler>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
77 78 79 80 81 82
{
  public:
    virtual void startMember(const QXmlAttributes& attrib);
    virtual void endMember();
    virtual void startParam(const QXmlAttributes& attrib);
    virtual void startType(const QXmlAttributes& attrib);
83
    virtual void startName(const QXmlAttributes& attrib);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
84
    virtual void endName();
85 86 87 88 89 90 91 92
    virtual void startRead(const QXmlAttributes& attrib);
    virtual void endRead();
    virtual void startWrite(const QXmlAttributes& attrib);
    virtual void endWrite();
    virtual void startDefinition(const QXmlAttributes& attrib);
    virtual void endDefinition();
    virtual void startArgsString(const QXmlAttributes& attrib);
    virtual void endArgsString();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
93 94
    virtual void startBriefDesc(const QXmlAttributes& attrib);
    virtual void startDetailedDesc(const QXmlAttributes& attrib);
95
    virtual void startInbodyDesc(const QXmlAttributes& attrib);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
96 97 98 99 100 101 102 103 104 105 106 107
    virtual void startLocation(const QXmlAttributes& attrib);
    virtual void startReferences(const QXmlAttributes& attrib);
    virtual void endReferences();
    virtual void startReferencedBy(const QXmlAttributes& attrib);
    virtual void endReferencedBy();
    virtual void startReimplements(const QXmlAttributes& attrib);
    virtual void endReimplements();
    virtual void startReimplementedBy(const QXmlAttributes& attrib);
    virtual void endReimplementedBy();
    virtual void startInitializer(const QXmlAttributes& attrib);
    virtual void startException(const QXmlAttributes& attrib);
    virtual void startEnumValue(const QXmlAttributes& attrib);
108
    virtual void startEnumValue2(const QXmlAttributes& attrib);
109 110
    virtual void startTemplateParamList(const QXmlAttributes &attrib);
    virtual void endTemplateParamList();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
111 112 113 114 115

    MemberHandler(IBaseHandler *parent);
    virtual ~MemberHandler();

    // IMember implementation
116 117 118
    virtual ICompound *compound() const;
    virtual ISection *section() const;
    virtual MemberKind kind() const
Dimitri van Heesch's avatar
Dimitri van Heesch committed
119
    { return m_kind; }
120 121 122 123 124 125 126 127 128 129
    virtual const IString *kindString() const 
    { return &m_kindString; }
    virtual const IString *id() const 
    { return &m_id; }
    virtual const IString *protection() const 
    { return &m_protection; }
    virtual const IString *virtualness() const 
    { return &m_virtualness; }
    virtual const IString *name() const 
    { return &m_name; }
130 131 132 133 134 135 136 137
    virtual const IString *readAccessor() const 
    { return &m_read; }
    virtual const IString *writeAccessor() const 
    { return &m_write; }
    virtual const IString *definition() const 
    { return &m_definition; }
    virtual const IString *argsstring() const 
    { return &m_argsstring; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
138 139 140 141
    virtual bool isConst() const 
    { return m_isConst; }
    virtual bool isVolatile() const 
    { return m_isVolatile; }
142 143 144 145 146 147 148 149 150 151 152 153
    virtual bool isStatic() const 
    { return m_isStatic; }
    virtual bool isExplicit() const 
    { return m_isExplicit; }
    virtual bool isInline() const 
    { return m_isInline; }
    virtual bool isMutable() const 
    { return m_isMutable; }
    virtual bool isReadable() const 
    { return m_isReadable; }
    virtual bool isWritable() const 
    { return m_isWritable; }
154 155 156 157 158 159 160 161
    virtual ILinkedTextIterator *type() const;
    virtual const IString *typeString() const;
    virtual IParamIterator *parameters() const;
    virtual IParamIterator *templateParameters() const;
    virtual IMemberReferenceIterator *references() const;
    virtual IMemberReferenceIterator *referencedBy() const;
    virtual ILinkedTextIterator *initializer() const;
    virtual ILinkedTextIterator *exceptions() const;
162 163
    virtual const IString *bodyFile() const
    { return &m_bodyFile; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
164 165 166 167
    virtual int bodyStart() const 
    { return m_bodyStart; }
    virtual int bodyEnd() const 
    { return m_bodyEnd; }
168 169
    virtual const IString *definitionFile() const 
    { return &m_defFile; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
170 171 172 173
    virtual int definitionLine() const 
    { return m_defLine; }
    virtual IMemberReference *reimplements() const
    { return m_reimplements; }
174 175 176
    virtual IMemberReferenceIterator *reimplementedBy() const;
    virtual IDocRoot *briefDescription() const;
    virtual IDocRoot *detailedDescription() const;
177
    virtual IDocRoot *inbodyDescription() const;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
178

179 180 181
    // IEnum
    virtual IMemberIterator *enumValues() const;
    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
182
    void initialize(MainHandler *m);
183 184
    void setCompoundHandler(CompoundHandler *c);
    void setSectionHandler(SectionHandler *s);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
185 186

  private:
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
                                                     // XML elements:
                                                     // -----------------
    QList<ParamHandler> m_templateParams;            // templateparamlist
    QList<LinkedTextImpl> m_type;                    // type
    StringImpl m_definition;                         // definition
    StringImpl m_argsstring;                         // argsstring
    StringImpl m_name;                               // name
    StringImpl m_read;                               // read
    StringImpl m_write;                              // write
    MemberReference *m_reimplements;                 // reimplements
    QList<MemberReference> m_reimplementedBy;        // reimplementedby
    QList<ParamHandler> m_params;                    // param
    QList<MemberHandler> m_enumValues;               // enumvalue
    QList<LinkedTextImpl> m_initializer;             // initializer
    QList<LinkedTextImpl> m_exception;               // exceptions
    DocHandler  *m_brief;                            // briefdescription
    DocHandler  *m_detailed;                         // detaileddescription
    DocHandler  *m_inbody;                           // inbodydescription
                                                     // location
    StringImpl m_defFile;                            // - file
    int m_defLine;                                   // - line
    StringImpl m_bodyFile;                           // - bodyfile
    int m_bodyStart;                                 // - bodystart
    int m_bodyEnd;                                   // - bodyend
    QList<MemberReference> m_references;             // references
    QList<MemberReference> m_referencedBy;           // referencedby

                                                     // XML attributes:
                                                     // ---------------
    MemberKind m_kind;                               // kind
    StringImpl m_kindString;                         // kind as a string
    StringImpl m_id;                                 // id
    StringImpl m_protection;                         // prot
    bool m_isStatic;                                 // static
    bool m_isConst;                                  // const
    bool m_isExplicit;                               // explicit
    bool m_isInline;                                 // inline
    StringImpl m_virtualness;                        // virt
    bool m_isVolatile;                               // volatile
    bool m_isMutable;                                // mutable
    bool m_isReadable;                               // readable
    bool m_isWritable;                               // writable

230 231
    CompoundHandler *m_compound;
    SectionHandler *m_section;
232
    StringImpl m_typeString;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
233
    LinkedTextHandler *m_linkedTextHandler;
234 235
    bool m_insideTemplateParamList;
    bool m_hasTemplateParamList;
236
    IBaseHandler *m_parent;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
237 238
};

239 240 241 242
class MemberIterator : public BaseIteratorVia<IMemberIterator,
                                        IMember,
                                        MemberHandler,
                                        IFunction>
243 244 245
{
  public:
    MemberIterator(const QList<MemberHandler> &list) : 
246
      BaseIteratorVia<IMemberIterator,IMember,MemberHandler,IFunction>(list) {}
247 248 249 250 251
};

void memberhandler_init();
void memberhandler_exit();

Dimitri van Heesch's avatar
Dimitri van Heesch committed
252
#endif