sectionhandler.h 3.12 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
 *
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6
 * Copyright (C) 1997-2014 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 20 21
#ifndef _SECTIONHANDLER_H
#define _SECTIONHANDLER_H

#include <qstring.h>
#include <qlist.h>
#include <qxml.h>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
22
#include <doxmlintf.h>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
23 24 25

#include "basehandler.h"

Dimitri van Heesch's avatar
Dimitri van Heesch committed
26
class SectionIterator : 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
27
     public BaseIterator<ISectionIterator,ISection,SectionHandler>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
28 29
{
  public:
Dimitri van Heesch's avatar
Dimitri van Heesch committed
30 31
    SectionIterator(const QList<SectionHandler> &list) : 
      BaseIterator<ISectionIterator,ISection,SectionHandler>(list) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
32 33 34
};


35
class SectionHandler : public IUserDefined, public BaseHandler<SectionHandler>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
36 37 38
{
  public:
    virtual void startMember(const QXmlAttributes& attrib);
39
    virtual void startHeader(const QXmlAttributes& attrib);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
40
    virtual void startSection(const QXmlAttributes& attrib);
41
    virtual void startDescription(const QXmlAttributes& attrib);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
42
    virtual void endSection();
43
    virtual void endHeader();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
44 45 46

    SectionHandler(IBaseHandler *parent);
    virtual ~SectionHandler();
47 48

    // ISection
49 50
    virtual const IString *kindString() const 
    { return &m_kindString; }
51 52
    virtual SectionKind kind() const 
    { return m_kind; }
53
    IDocRoot *description() const;
54
    virtual IMemberIterator *members() const;
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
    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;
    }
75

76
    void initialize(CompoundHandler *c);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
77

78 79 80 81 82 83
    // IUserDefined implementation
    virtual const IString *header() const 
    {
      return &m_header;
    }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
84 85
  private:
    IBaseHandler *m_parent;
86 87 88 89 90 91 92 93 94 95 96

                                               // XML elements:
                                               // -------------
    StringImpl m_header;                       // header
    DocHandler* m_description;                 // description
    QList<MemberHandler> m_members;            // memberdef

                                               // XML attributes:
                                               // ---------------
    SectionKind m_kind;                        // kind
    StringImpl m_kindString;                   // kind as a string
Dimitri van Heesch's avatar
Dimitri van Heesch committed
97 98
};

99 100 101
void sectionhandler_init();
void sectionhandler_exit();

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