Grantlee 5.3.0

Public Member Functions | List of all members
Grantlee::AbstractMarkupBuilder Class Referenceabstract

Interface for creating marked-up text output. More...

`#include <grantlee/abstractmarkupbuilder.h>`

Inheritance diagram for Grantlee::AbstractMarkupBuilder:
[legend]

## Public Member Functions
virtual | ~AbstractMarkupBuilder ()
virtual void | addNewline ()=0
virtual void | appendLiteralText (const QString &text)=0
virtual void | appendRawText (const QString &text)=0
virtual void | beginAnchor (const QString &href={}, const QString &name={})=0
virtual void | beginBackground (const QBrush &brush)=0
virtual void | beginEmph ()=0
virtual void | beginFontFamily (const QString &family)=0
virtual void | beginFontPointSize (int size)=0
virtual void | beginForeground (const QBrush &brush)=0
virtual void | beginHeader (int level)=0
virtual void | beginList (QTextListFormat::Style style)=0
virtual void | beginListItem ()=0
virtual void | beginParagraph (Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0)=0
virtual void | beginStrikeout ()=0
virtual void | beginStrong ()=0
virtual void | beginSubscript ()=0
virtual void | beginSuperscript ()=0
virtual void | beginTable (qreal cellpadding, qreal cellspacing, const QString &width)=0
virtual void | beginTableCell (const QString &width, int colSpan, int rowSpan)=0
virtual void | beginTableHeaderCell (const QString &width, int colSpan, int rowSpan)=0
virtual void | beginTableRow ()=0
virtual void | beginUnderline ()=0
virtual void | endAnchor ()=0
virtual void | endBackground ()=0
virtual void | endEmph ()=0
virtual void | endFontFamily ()=0
virtual void | endFontPointSize ()=0
virtual void | endForeground ()=0
virtual void | endHeader (int level)=0
virtual void | endList ()=0
virtual void | endListItem ()=0
virtual void | endParagraph ()=0
virtual void | endStrikeout ()=0
virtual void | endStrong ()=0
virtual void | endSubscript ()=0
virtual void | endSuperscript ()=0
virtual void | endTable ()=0
virtual void | endTableCell ()=0
virtual void | endTableHeaderCell ()=0
virtual void | endTableRow ()=0
virtual void | endUnderline ()=0
virtual QString | getResult ()=0
virtual void | insertHorizontalRule (int width=-1)=0
virtual void | insertImage (const QString &url, qreal width, qreal height)=0

## Detailed Description

The AbstractMarkupBuilder is used by a MarkupDirector to create marked-up output such as html or markdown.

See PlainTextMarkupBuilder and TextHTMLBuilder for example implementations.

This interface can be extended to handle custom format types in a QTextDocument.

See also
  Handling custom QTextObjects

Author
  Stephen Kelly steve.nosp@m.ire@.nosp@m.gmail.nosp@m..com

Definition at line 51 of file abstractmarkupbuilder.h.

## Constructor & Destructor Documentation

## ◆ ~AbstractMarkupBuilder()

virtual Grantlee::AbstractMarkupBuilder::~AbstractMarkupBuilder | ( |  | ) |
| inline virtual

Destructor

Definition at line 55 of file abstractmarkupbuilder.h.

## Member Function Documentation

## ◆ addNewline()

virtual void Grantlee::AbstractMarkupBuilder::addNewline | ( |  | ) |
| pure virtual

Add a newline to the markup.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ appendLiteralText()

virtual void Grantlee::AbstractMarkupBuilder::appendLiteralText | ( | const QString & | text | ) |
| pure virtual

Append the plain text `text` to the markup

Parameters

  text | The text to append.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ appendRawText()

virtual void Grantlee::AbstractMarkupBuilder::appendRawText | ( | const QString & | text | ) |
| pure virtual

Append the raw text `text` to the markup. `text` is added unescaped

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginAnchor()

virtual void Grantlee::AbstractMarkupBuilder::beginAnchor | ( | const QString & | href = `{}`,
|  | const QString & | name = `{}`
| ) |  |
| pure virtual

Begin a url anchor element in the markup

Parameters

  href | The href of the anchor.
  name | The name of the anchor.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginBackground()

virtual void Grantlee::AbstractMarkupBuilder::beginBackground | ( | const QBrush & | brush | ) |
| pure virtual

Begin a decorarated background element in the markup (A text background color) using `brush`

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginEmph()

virtual void Grantlee::AbstractMarkupBuilder::beginEmph | ( |  | ) |
| pure virtual

Begin an emphasised element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginFontFamily()

virtual void Grantlee::AbstractMarkupBuilder::beginFontFamily | ( | const QString & | family | ) |
| pure virtual

Begin a new font familiy element in the markup

Parameters

  family | The name of the font family to begin.

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginFontPointSize()

virtual void Grantlee::AbstractMarkupBuilder::beginFontPointSize | ( | int | size | ) |
| pure virtual

Begin a new font point size element in the markup

Parameters

  size | The point size to begin.

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginForeground()

virtual void Grantlee::AbstractMarkupBuilder::beginForeground | ( | const QBrush & | brush | ) |
| pure virtual

Begin a decorarated foreground element in the markup (A text color) using `brush`

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginHeader()

virtual void Grantlee::AbstractMarkupBuilder::beginHeader | ( | int | level | ) |
| pure virtual

Begin a level `level` header

Parameters

  level | An integer between 1 and 6

Implemented in Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginList()

virtual void Grantlee::AbstractMarkupBuilder::beginList | ( | QTextListFormat::Style | style | ) |
| pure virtual

Begin a new list element in the markup. A list element contains list items, and may contain other lists.

Parameters

  style | The style of list to create.

Implemented in Grantlee::PlainTextMarkupBuilder, Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginListItem()

virtual void Grantlee::AbstractMarkupBuilder::beginListItem | ( |  | ) |
| pure virtual

Begin a new list item in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginParagraph()

virtual void Grantlee::AbstractMarkupBuilder::beginParagraph | ( | Qt::Alignment | a = `Qt::AlignLeft`,
|  | qreal | top = `0.0`,
|  | qreal | bottom = `0.0`,
|  | qreal | left = `0.0`,
|  | qreal | right = `0.0`
| ) |  |
| pure virtual

Begin a new paragraph in the markup

Parameters

  a | The alignment of the new paragraph.
  top | The top margin of the new paragraph.
  bottom | The bottom margin of the new paragraph.
  left | The left margin of the new paragraph.
  right | The right margin of the new paragraph.

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginStrikeout()

virtual void Grantlee::AbstractMarkupBuilder::beginStrikeout | ( |  | ) |
| pure virtual

Begin a struck out element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginStrong()

virtual void Grantlee::AbstractMarkupBuilder::beginStrong | ( |  | ) |
| pure virtual

Begin a bold element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginSubscript()

virtual void Grantlee::AbstractMarkupBuilder::beginSubscript | ( |  | ) |
| pure virtual

Begin a subscript element

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginSuperscript()

virtual void Grantlee::AbstractMarkupBuilder::beginSuperscript | ( |  | ) |
| pure virtual

Begin a superscript element

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginTable()

virtual void Grantlee::AbstractMarkupBuilder::beginTable | ( | qreal | cellpadding,
|  | qreal | cellspacing,
|  | const QString & | width
| ) |  |
| pure virtual

Begin a table element.

Parameters

  cellpadding | The padding attribute for the table.
  cellspacing | The spacing attribute for the table.
  width | The width of the table. May be either an integer, or a percentage value.

Implemented in Grantlee::PlainTextMarkupBuilder, Grantlee::TextHTMLBuilder, and Grantlee::BBCodeBuilder.

## ◆ beginTableCell()

virtual void Grantlee::AbstractMarkupBuilder::beginTableCell | ( | const QString & | width,
|  | int | colSpan,
|  | int | rowSpan
| ) |  |
| pure virtual

Begin a new table cell.

Parameters

  width | The width of the cell.
  colSpan | The column span of the cell.
  rowSpan | The row span of the cell.

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginTableHeaderCell()

virtual void Grantlee::AbstractMarkupBuilder::beginTableHeaderCell | ( | const QString & | width,
|  | int | colSpan,
|  | int | rowSpan
| ) |  |
| pure virtual

Begin a new table header cell.

Parameters

  width | The width of the cell.
  colSpan | The column span of the cell.
  rowSpan | The row span of the cell.

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginTableRow()

virtual void Grantlee::AbstractMarkupBuilder::beginTableRow | ( |  | ) |
| pure virtual

Begin a new table row

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ beginUnderline()

virtual void Grantlee::AbstractMarkupBuilder::beginUnderline | ( |  | ) |
| pure virtual

Begin an underlined element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endAnchor()

virtual void Grantlee::AbstractMarkupBuilder::endAnchor | ( |  | ) |
| pure virtual

Close the anchor element

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endBackground()

virtual void Grantlee::AbstractMarkupBuilder::endBackground | ( |  | ) |
| pure virtual

Close the decorarated background element in the markup

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endEmph()

virtual void Grantlee::AbstractMarkupBuilder::endEmph | ( |  | ) |
| pure virtual

Close the emphasised element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endFontFamily()

virtual void Grantlee::AbstractMarkupBuilder::endFontFamily | ( |  | ) |
| pure virtual

End font family element

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endFontPointSize()

virtual void Grantlee::AbstractMarkupBuilder::endFontPointSize | ( |  | ) |
| pure virtual

End font point size element

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endForeground()

virtual void Grantlee::AbstractMarkupBuilder::endForeground | ( |  | ) |
| pure virtual

Close the decorarated foreground element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endHeader()

virtual void Grantlee::AbstractMarkupBuilder::endHeader | ( | int | level | ) |
| pure virtual

End a level `level` header

Parameters

  level | An integer between 1 and 6

Implemented in Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endList()

virtual void Grantlee::AbstractMarkupBuilder::endList | ( |  | ) |
| pure virtual

Close the list.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endListItem()

virtual void Grantlee::AbstractMarkupBuilder::endListItem | ( |  | ) |
| pure virtual

End the list item

Implemented in Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endParagraph()

virtual void Grantlee::AbstractMarkupBuilder::endParagraph | ( |  | ) |
| pure virtual

Close the paragraph in the markup.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endStrikeout()

virtual void Grantlee::AbstractMarkupBuilder::endStrikeout | ( |  | ) |
| pure virtual

Close the struck out element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endStrong()

virtual void Grantlee::AbstractMarkupBuilder::endStrong | ( |  | ) |
| pure virtual

Close the bold element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endSubscript()

virtual void Grantlee::AbstractMarkupBuilder::endSubscript | ( |  | ) |
| pure virtual

End subscript element

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endSuperscript()

virtual void Grantlee::AbstractMarkupBuilder::endSuperscript | ( |  | ) |
| pure virtual

End superscript element

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endTable()

virtual void Grantlee::AbstractMarkupBuilder::endTable | ( |  | ) |
| pure virtual

End a table element

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endTableCell()

virtual void Grantlee::AbstractMarkupBuilder::endTableCell | ( |  | ) |
| pure virtual

End a table cell

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endTableHeaderCell()

virtual void Grantlee::AbstractMarkupBuilder::endTableHeaderCell | ( |  | ) |
| pure virtual

End a table header cell

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endTableRow()

virtual void Grantlee::AbstractMarkupBuilder::endTableRow | ( |  | ) |
| pure virtual

End a table row

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ endUnderline()

virtual void Grantlee::AbstractMarkupBuilder::endUnderline | ( |  | ) |
| pure virtual

Close the underlined element in the markup

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ getResult()

virtual QString Grantlee::AbstractMarkupBuilder::getResult | ( |  | ) |
| pure virtual

Return the fully marked up result of the building process.

This may contain metadata etc, such as a head element in html.

Returns
  The fully marked up text.

Implemented in Grantlee::BBCodeBuilder, Grantlee::MediaWikiMarkupBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ insertHorizontalRule()

virtual void Grantlee::AbstractMarkupBuilder::insertHorizontalRule | ( | int | width = `-1` | ) |
| pure virtual

Insert a horizontal rule into the markup.

Parameters

  width | The width of the rule. Default is full width.

Implemented in Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.

## ◆ insertImage()

virtual void Grantlee::AbstractMarkupBuilder::insertImage | ( | const QString & | url,
|  | qreal | width,
|  | qreal | height
| ) |  |
| pure virtual

Insert a new image element into the markup.

Parameters

  url | The url of the image
  width | The width of the image
  height | The height of the image.

Implemented in Grantlee::BBCodeBuilder, Grantlee::PlainTextMarkupBuilder, and Grantlee::TextHTMLBuilder.