paramhandler.h 3.1 KB
Newer Older
dimitri's avatar
dimitri committed
1 2
/******************************************************************************
 *
dimitri's avatar
dimitri committed
3
 * $Id:$
dimitri's avatar
dimitri committed
4 5
 *
 *
dimitri's avatar
dimitri committed
6
 * Copyright (C) 1997-2006 by Dimitri van Heesch.
dimitri's avatar
dimitri 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's avatar
dimitri committed
16 17 18 19 20 21
#ifndef _PARAMHANDLER_H
#define _PARAMHANDLER_H

#include <qstring.h>
#include <qlist.h>
#include <qxml.h>
dimitri's avatar
dimitri committed
22
#include <doxmlintf.h>
dimitri's avatar
dimitri committed
23

dimitri's avatar
dimitri committed
24
#include "stringimpl.h"
dimitri's avatar
dimitri committed
25
#include "basehandler.h"
dimitri's avatar
dimitri committed
26
#include "baseiterator.h"
dimitri's avatar
dimitri committed
27 28 29

class LinkedTextImpl;
class LinkedTextHandler;
dimitri's avatar
dimitri committed
30
class DocHandler;
dimitri's avatar
dimitri committed
31

dimitri's avatar
dimitri committed
32

dimitri's avatar
dimitri committed
33
class ParamHandler : public IParam, public BaseHandler<ParamHandler>
dimitri's avatar
dimitri committed
34 35 36 37
{
  public:
    virtual void startParam(const QXmlAttributes& attrib);
    virtual void endParam();
dimitri's avatar
dimitri committed
38
    virtual void startType(const QXmlAttributes& attrib);
dimitri's avatar
dimitri committed
39 40 41 42
    virtual void endDeclName();
    virtual void endDefName();
    virtual void endAttrib();
    virtual void endArray();
dimitri's avatar
dimitri committed
43
    virtual void startDefVal(const QXmlAttributes& attrib);
dimitri's avatar
dimitri committed
44
    virtual void startBriefDesc(const QXmlAttributes& attrib);
dimitri's avatar
dimitri committed
45 46 47

    ParamHandler(IBaseHandler *parent);
    virtual ~ParamHandler();
dimitri's avatar
dimitri committed
48 49

    // IParam
dimitri's avatar
dimitri committed
50
    virtual ILinkedTextIterator *type() const;
dimitri's avatar
dimitri committed
51 52 53 54
    virtual const IString * declarationName() const { return &m_declName; }
    virtual const IString * definitionName() const { return &m_defName; }
    virtual const IString * attrib() const { return &m_attrib; } 
    virtual const IString * arraySpecifier() const { return &m_array; }
dimitri's avatar
dimitri committed
55
    virtual ILinkedTextIterator *defaultValue() const;
dimitri's avatar
dimitri committed
56
    virtual IDocRoot *briefDescription() const;
dimitri's avatar
dimitri committed
57

dimitri's avatar
dimitri committed
58
  private:
dimitri's avatar
dimitri committed
59 60 61 62 63 64 65 66 67 68 69 70

                                          // XML elements:
                                          // -------------
    QList<LinkedTextImpl> m_type;         // type
    StringImpl m_declName;                // declname
    StringImpl m_defName;                 // defname
    StringImpl m_array;                   // array
    QList<LinkedTextImpl> m_defVal;       // defval
    DocHandler  *m_brief;                 // briefdescription

    StringImpl m_attrib;                  // TODO: not yet in XML output

dimitri's avatar
dimitri committed
71
    IBaseHandler *m_parent;
dimitri's avatar
dimitri committed
72
    LinkedTextHandler *m_linkedTextHandler;
dimitri's avatar
dimitri committed
73 74
};

dimitri's avatar
dimitri committed
75 76 77 78 79 80 81
class ParamIterator : public BaseIterator<IParamIterator,IParam,ParamHandler>
{
  public:
    ParamIterator(const QList<ParamHandler> &list) : 
      BaseIterator<IParamIterator,IParam,ParamHandler>(list) {}
};

dimitri's avatar
dimitri committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
class TemplateParamListHandler : public BaseHandler<TemplateParamListHandler>
{
  public:

    virtual void startParam(const QXmlAttributes& attrib);
    virtual void endParam();

    virtual void startTemplateParamList(const QXmlAttributes& attrib);
    virtual void endTemplateParamList();

    TemplateParamListHandler(IBaseHandler *parent);
	virtual ~TemplateParamListHandler() {}

	ParamIterator* templateParams() { return new ParamIterator(m_templateParams); }

  protected:
    IBaseHandler *m_parent;
    QList<ParamHandler> m_templateParams;
};

dimitri's avatar
dimitri committed
102

dimitri's avatar
dimitri committed
103
#endif