summaryrefslogtreecommitdiff
path: root/addon/doxmlparser/src/paramhandler.cpp
blob: 4b57e5060135d4b954716e10bfeadce1fd34f2c2 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/******************************************************************************
 *
 * $Id$
 *
 *
 * Copyright (C) 1997-2013 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.
 *
 */

#include "paramhandler.h"
#include "memberhandler.h"
#include "linkedtexthandler.h"
#include "debug.h"
#include "dochandler.h"

TemplateParamListHandler::TemplateParamListHandler(IBaseHandler *parent) : m_parent(parent)
{
  addStartHandler("param",this,&TemplateParamListHandler::startParam);

  addEndHandler("templateparamlist",this,&TemplateParamListHandler::endTemplateParamList);
}

void TemplateParamListHandler::startParam(const QXmlAttributes& attrib)
{
  ParamHandler *ph = new ParamHandler(this);
  ph->startParam(attrib);
  m_templateParams.append(ph);
}

void TemplateParamListHandler::endParam()
{
}

void TemplateParamListHandler::startTemplateParamList(const QXmlAttributes& /*attrib*/)
{
  m_parent->setDelegate(this);
  debug(2,"templateparamlist\n");
}

void TemplateParamListHandler::endTemplateParamList()
{
  m_parent->setDelegate(0);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////

ParamHandler::ParamHandler(IBaseHandler *parent) : m_brief(0), m_parent(parent)
{
  addEndHandler("param",this,&ParamHandler::endParam);

  addStartHandler("type",this,&ParamHandler::startType);

  addStartHandler("declname");
  addEndHandler("declname",this,&ParamHandler::endDeclName);

  addStartHandler("defname");
  addEndHandler("defname",this,&ParamHandler::endDefName);

  addStartHandler("array");
  addEndHandler("array",this,&ParamHandler::endArray);

  addStartHandler("attribute");
  addEndHandler("attribute",this,&ParamHandler::endAttrib);

  addStartHandler("briefdescription",this,&ParamHandler::startBriefDesc);
  
  addStartHandler("defval",this,&ParamHandler::startDefVal);

  m_linkedTextHandler = 0;
}

ParamHandler::~ParamHandler()
{
  delete m_brief;
  delete m_linkedTextHandler;
}

void ParamHandler::startParam(const QXmlAttributes& /*attrib*/)
{
  m_parent->setDelegate(this);
  debug(2,"param\n");
}

void ParamHandler::endParam()
{
  m_parent->setDelegate(0);
}

void ParamHandler::startType(const QXmlAttributes& /*attrib*/)
{
  delete m_linkedTextHandler;
  m_linkedTextHandler = new LinkedTextHandler(this,m_type);
  m_linkedTextHandler->start("type");
  debug(2,"param type\n");
}

void ParamHandler::endDeclName()
{
  m_declName = m_curString.stripWhiteSpace();
  debug(2,"member declName=`%s'\n",m_declName.data());
}

void ParamHandler::endDefName()
{
  m_defName = m_curString.stripWhiteSpace();
  debug(2,"member defName=`%s'\n",m_defName.data());
}

void ParamHandler::endAttrib()
{
  m_attrib = m_curString.stripWhiteSpace();
  debug(2,"member attrib=`%s'\n",m_attrib.data());
}

void ParamHandler::endArray()
{
  m_array = m_curString.stripWhiteSpace();
  debug(2,"member array=`%s'\n",m_array.data());
}

void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/)
{
  delete m_linkedTextHandler;
  m_linkedTextHandler = new LinkedTextHandler(this,m_defVal);
  m_linkedTextHandler->start("defval");
  debug(2,"member defVal\n");
}

void ParamHandler::startBriefDesc(const QXmlAttributes& attrib)
{
  DocHandler *docHandler = new DocHandler(this);
  docHandler->startDoc(attrib);
  m_brief = docHandler;
}

ILinkedTextIterator *ParamHandler::type() const 
{ 
  return new LinkedTextIterator(m_type); 
}

ILinkedTextIterator *ParamHandler::defaultValue() const 
{ 
  return new LinkedTextIterator(m_defVal); 
}

IDocRoot *ParamHandler::briefDescription() const
{ 
  return m_brief; 
}