Public Member Functions | Private Member Functions | Private Attributes | List of all members
MarkupHandler Class Reference

Handles markup commands in the XML input. More...

#include <dochandler.h>

Inheritance diagram for MarkupHandler:
BaseFallBackHandler< MarkupHandler > ElementMapper< MarkupHandler > IFallBackHandler

Public Member Functions

 MarkupHandler (QList< DocImpl > &children, QString &curString)
 
virtual ~MarkupHandler ()
 
int markup () const
 
int headingLevel () const
 
virtual void startBold (const QXmlAttributes &attrib)
 
virtual void endBold ()
 
virtual void startEmphasis (const QXmlAttributes &attrib)
 
virtual void endEmphasis ()
 
virtual void startComputerOutput (const QXmlAttributes &attrib)
 
virtual void endComputerOutput ()
 
virtual void startCenter (const QXmlAttributes &attrib)
 
virtual void endCenter ()
 
virtual void startSmallFont (const QXmlAttributes &attrib)
 
virtual void endSmallFont ()
 
virtual void startSubscript (const QXmlAttributes &attrib)
 
virtual void endSubscript ()
 
virtual void startSuperscript (const QXmlAttributes &attrib)
 
virtual void endSuperscript ()
 
virtual void startPreformatted (const QXmlAttributes &attrib)
 
virtual void endPreformatted ()
 
virtual void startHeading1 (const QXmlAttributes &attrib)
 
virtual void endHeading1 ()
 
virtual void startHeading2 (const QXmlAttributes &attrib)
 
virtual void endHeading2 ()
 
virtual void startHeading3 (const QXmlAttributes &attrib)
 
virtual void endHeading3 ()
 
virtual void startHeading4 (const QXmlAttributes &attrib)
 
virtual void endHeading4 ()
 
virtual void startHeading5 (const QXmlAttributes &attrib)
 
virtual void endHeading5 ()
 
virtual void startHeading6 (const QXmlAttributes &attrib)
 
virtual void endHeading6 ()
 
- Public Member Functions inherited from BaseFallBackHandler< MarkupHandler >
 BaseFallBackHandler ()
 
virtual ~BaseFallBackHandler ()
 
bool handleStartElement (const QString &name, const QXmlAttributes &attrib)
 
bool handleEndElement (const QString &name)
 
- Public Member Functions inherited from ElementMapper< MarkupHandler >
 ElementMapper ()
 
virtual ~ElementMapper ()
 
void addStartHandler (const char *key)
 
void addStartHandler (const char *key, MarkupHandler *obj, void(MarkupHandler::*handler)(const QXmlAttributes &))
 
void addEndHandler (const char *key)
 
void addEndHandler (const char *key, MarkupHandler *obj, void(MarkupHandler::*handler)())
 
- Public Member Functions inherited from IFallBackHandler
virtual ~IFallBackHandler ()
 

Private Member Functions

void addTextNode ()
 

Private Attributes

QList< DocImpl > & m_children
 
QStringm_curString
 
int m_curMarkup
 
int m_headingLevel
 

Additional Inherited Members

- Public Types inherited from BaseFallBackHandler< MarkupHandler >
typedef ElementMapper< MarkupHandler >::StartElementHandlerT StartElementHandlerT
 
typedef ElementMapper< MarkupHandler >::EndElementHandlerT EndElementHandlerT
 
- Public Types inherited from ElementMapper< MarkupHandler >
typedef StartElementHandler StartElementHandlerT
 
typedef EndElementHandler EndElementHandlerT
 
- Protected Attributes inherited from ElementMapper< MarkupHandler >
QDict< StartElementHandlerTm_startHandlers
 
QDict< EndElementHandlerTm_endHandlers
 

Detailed Description

Handles markup commands in the XML input.

Definition at line 135 of file dochandler.h.

Constructor & Destructor Documentation

MarkupHandler::MarkupHandler ( QList< DocImpl > &  children,
QString curString 
)

Definition at line 100 of file dochandler.cpp.

101  : m_children(children), m_curString(curString),
103 {
106 
108  addEndHandler("emphasis",this,&MarkupHandler::endEmphasis);
109 
110  addStartHandler("computeroutput",this,&MarkupHandler::startComputerOutput);
111  addEndHandler("computeroutput",this,&MarkupHandler::endComputerOutput);
112 
114  addEndHandler("center",this,&MarkupHandler::endCenter);
115 
118 
120  addEndHandler("subscript",this,&MarkupHandler::endSubscript);
121 
123  addEndHandler("superscript",this,&MarkupHandler::endSuperscript);
124 
126  addEndHandler("preformatted",this,&MarkupHandler::endPreformatted);
127 
129  addEndHandler("heading1",this,&MarkupHandler::endHeading1);
130 
132  addEndHandler("heading2",this,&MarkupHandler::endHeading2);
133 
135  addEndHandler("heading3",this,&MarkupHandler::endHeading3);
136 
138  addEndHandler("heading4",this,&MarkupHandler::endHeading4);
139 
141  addEndHandler("heading5",this,&MarkupHandler::endHeading5);
142 
144  addEndHandler("heading6",this,&MarkupHandler::endHeading6);
145 }
virtual void endBold()
Definition: dochandler.cpp:168
virtual void endPreformatted()
Definition: dochandler.cpp:266
virtual void startHeading3(const QXmlAttributes &attrib)
Definition: dochandler.cpp:305
int m_headingLevel
Definition: dochandler.h:179
virtual void endHeading1()
Definition: dochandler.cpp:281
virtual void startSubscript(const QXmlAttributes &attrib)
Definition: dochandler.cpp:231
virtual void startHeading5(const QXmlAttributes &attrib)
Definition: dochandler.cpp:337
virtual void startEmphasis(const QXmlAttributes &attrib)
Definition: dochandler.cpp:175
virtual void startSuperscript(const QXmlAttributes &attrib)
Definition: dochandler.cpp:245
virtual void endComputerOutput()
Definition: dochandler.cpp:196
virtual void endCenter()
Definition: dochandler.cpp:210
QList< DocImpl > & m_children
Definition: dochandler.h:176
virtual void startHeading2(const QXmlAttributes &attrib)
Definition: dochandler.cpp:289
virtual void startSmallFont(const QXmlAttributes &attrib)
Definition: dochandler.cpp:217
virtual void endHeading4()
Definition: dochandler.cpp:329
virtual void endEmphasis()
Definition: dochandler.cpp:182
virtual void endHeading3()
Definition: dochandler.cpp:313
virtual void startCenter(const QXmlAttributes &attrib)
Definition: dochandler.cpp:203
virtual void endHeading5()
Definition: dochandler.cpp:345
virtual void endSuperscript()
Definition: dochandler.cpp:252
virtual void startComputerOutput(const QXmlAttributes &attrib)
Definition: dochandler.cpp:189
virtual void endHeading6()
Definition: dochandler.cpp:361
virtual void startBold(const QXmlAttributes &attrib)
Definition: dochandler.cpp:161
virtual void startHeading6(const QXmlAttributes &attrib)
Definition: dochandler.cpp:353
void addStartHandler(const char *key)
Definition: basehandler.h:91
virtual void endSubscript()
Definition: dochandler.cpp:238
virtual void startPreformatted(const QXmlAttributes &attrib)
Definition: dochandler.cpp:259
virtual void endHeading2()
Definition: dochandler.cpp:297
virtual void startHeading4(const QXmlAttributes &attrib)
Definition: dochandler.cpp:321
QString & m_curString
Definition: dochandler.h:177
virtual void startHeading1(const QXmlAttributes &attrib)
Definition: dochandler.cpp:273
void addEndHandler(const char *key)
Definition: basehandler.h:101
virtual void endSmallFont()
Definition: dochandler.cpp:224
MarkupHandler::~MarkupHandler ( )
virtual

Definition at line 147 of file dochandler.cpp.

148 {
149 }

Member Function Documentation

void MarkupHandler::addTextNode ( )
private

Definition at line 151 of file dochandler.cpp.

152 {
153  if (!m_curString.isEmpty())
154  {
156  debug(2,"addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup);
157  m_curString="";
158  }
159 }
bool isEmpty() const
Definition: qstring.h:682
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const char * data() const
Definition: qstring.h:542
QList< DocImpl > & m_children
Definition: dochandler.h:176
Node representing a piece of text.
Definition: dochandler.h:86
QString & m_curString
Definition: dochandler.h:177
void MarkupHandler::endBold ( )
virtual

Definition at line 168 of file dochandler.cpp.

169 {
170  addTextNode();
172  m_curMarkup &= ~IDocMarkup::Bold;
173 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endCenter ( )
virtual

Definition at line 210 of file dochandler.cpp.

211 {
212  addTextNode();
214  m_curMarkup &= ~IDocMarkup::Center;
215 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endComputerOutput ( )
virtual

Definition at line 196 of file dochandler.cpp.

197 {
198  addTextNode();
200  m_curMarkup &= ~IDocMarkup::ComputerOutput;
201 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endEmphasis ( )
virtual

Definition at line 182 of file dochandler.cpp.

183 {
184  addTextNode();
186  m_curMarkup &= ~IDocMarkup::Emphasis;
187 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading1 ( )
virtual

Definition at line 281 of file dochandler.cpp.

282 {
283  addTextNode();
285  m_curMarkup &= ~IDocMarkup::Heading;
286  m_headingLevel=0;
287 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading2 ( )
virtual

Definition at line 297 of file dochandler.cpp.

298 {
299  addTextNode();
301  m_curMarkup &= ~IDocMarkup::Heading;
302  m_headingLevel=0;
303 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading3 ( )
virtual

Definition at line 313 of file dochandler.cpp.

314 {
315  addTextNode();
317  m_curMarkup &= ~IDocMarkup::Heading;
318  m_headingLevel=0;
319 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading4 ( )
virtual

Definition at line 329 of file dochandler.cpp.

330 {
331  addTextNode();
333  m_curMarkup &= ~IDocMarkup::Heading;
334  m_headingLevel=0;
335 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading5 ( )
virtual

Definition at line 345 of file dochandler.cpp.

346 {
347  addTextNode();
349  m_curMarkup &= ~IDocMarkup::Heading;
350  m_headingLevel=0;
351 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endHeading6 ( )
virtual

Definition at line 361 of file dochandler.cpp.

362 {
363  addTextNode();
365  m_curMarkup &= ~IDocMarkup::Heading;
366  m_headingLevel=0;
367 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endPreformatted ( )
virtual

Definition at line 266 of file dochandler.cpp.

267 {
268  addTextNode();
270  m_curMarkup &= ~IDocMarkup::Preformatted;
271 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endSmallFont ( )
virtual

Definition at line 224 of file dochandler.cpp.

225 {
226  addTextNode();
228  m_curMarkup &= ~IDocMarkup::SmallFont;
229 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endSubscript ( )
virtual

Definition at line 238 of file dochandler.cpp.

239 {
240  addTextNode();
242  m_curMarkup &= ~IDocMarkup::Subscript;
243 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
void MarkupHandler::endSuperscript ( )
virtual

Definition at line 252 of file dochandler.cpp.

253 {
254  addTextNode();
256  m_curMarkup &= ~IDocMarkup::Superscript;
257 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
int MarkupHandler::headingLevel ( ) const
inline

Definition at line 141 of file dochandler.h.

141 { return m_headingLevel; }
int m_headingLevel
Definition: dochandler.h:179
int MarkupHandler::markup ( ) const
inline

Definition at line 140 of file dochandler.h.

140 { return m_curMarkup; }
void MarkupHandler::startBold ( const QXmlAttributes attrib)
virtual

Definition at line 161 of file dochandler.cpp.

162 {
163  addTextNode();
166 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startCenter ( const QXmlAttributes attrib)
virtual

Definition at line 203 of file dochandler.cpp.

204 {
205  addTextNode();
208 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startComputerOutput ( const QXmlAttributes attrib)
virtual

Definition at line 189 of file dochandler.cpp.

190 {
191  addTextNode();
194 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startEmphasis ( const QXmlAttributes attrib)
virtual

Definition at line 175 of file dochandler.cpp.

176 {
177  addTextNode();
180 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading1 ( const QXmlAttributes attrib)
virtual

Definition at line 273 of file dochandler.cpp.

274 {
275  addTextNode();
278  m_headingLevel=1;
279 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading2 ( const QXmlAttributes attrib)
virtual

Definition at line 289 of file dochandler.cpp.

290 {
291  addTextNode();
294  m_headingLevel=2;
295 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading3 ( const QXmlAttributes attrib)
virtual

Definition at line 305 of file dochandler.cpp.

306 {
307  addTextNode();
310  m_headingLevel=3;
311 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading4 ( const QXmlAttributes attrib)
virtual

Definition at line 321 of file dochandler.cpp.

322 {
323  addTextNode();
326  m_headingLevel=4;
327 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading5 ( const QXmlAttributes attrib)
virtual

Definition at line 337 of file dochandler.cpp.

338 {
339  addTextNode();
342  m_headingLevel=5;
343 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startHeading6 ( const QXmlAttributes attrib)
virtual

Definition at line 353 of file dochandler.cpp.

354 {
355  addTextNode();
358  m_headingLevel=6;
359 }
void append(const type *d)
Definition: qlist.h:73
int m_headingLevel
Definition: dochandler.h:179
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startPreformatted ( const QXmlAttributes attrib)
virtual

Definition at line 259 of file dochandler.cpp.

260 {
261  addTextNode();
264 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startSmallFont ( const QXmlAttributes attrib)
virtual

Definition at line 217 of file dochandler.cpp.

218 {
219  addTextNode();
222 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startSubscript ( const QXmlAttributes attrib)
virtual

Definition at line 231 of file dochandler.cpp.

232 {
233  addTextNode();
236 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371
void MarkupHandler::startSuperscript ( const QXmlAttributes attrib)
virtual

Definition at line 245 of file dochandler.cpp.

246 {
247  addTextNode();
250 }
void append(const type *d)
Definition: qlist.h:73
Node representing a change in the markup style.
Definition: dochandler.h:110
QList< DocImpl > & m_children
Definition: dochandler.h:176
void addTextNode()
Definition: dochandler.cpp:151
const bool TRUE
Definition: qglobal.h:371

Member Data Documentation

QList<DocImpl>& MarkupHandler::m_children
private

Definition at line 176 of file dochandler.h.

int MarkupHandler::m_curMarkup
private

Definition at line 178 of file dochandler.h.

QString& MarkupHandler::m_curString
private

Definition at line 177 of file dochandler.h.

int MarkupHandler::m_headingLevel
private

Definition at line 179 of file dochandler.h.


The documentation for this class was generated from the following files: