Cutelee
6.1.0
|
Creates a simple marked up plain text document. More...
#include <cutelee/plaintextmarkupbuilder.h>
Public Member Functions | |
void | addNewline () override |
int | addReference (const QString &reference) |
void | appendLiteralText (const QString &text) override |
void | appendRawText (const QString &text) override |
void | beginAnchor (const QString &href={}, const QString &name={}) override |
void | beginBackground (const QBrush &brush) override |
void | beginEmph () override |
void | beginFontFamily (const QString &family) override |
void | beginFontPointSize (int size) override |
void | beginForeground (const QBrush &brush) override |
void | beginHeader (int level) override |
void | beginList (QTextListFormat::Style style) override |
void | beginListItem () override |
void | beginParagraph (Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0) override |
void | beginStrikeout () override |
void | beginStrong () override |
void | beginSubscript () override |
void | beginSuperscript () override |
void | beginTable (qreal cellpadding, qreal cellspacing, const QString &width) override |
void | beginTableCell (const QString &width, int colSpan, int rowSpan) override |
void | beginTableHeaderCell (const QString &width, int colSpan, int rowSpan) override |
void | beginTableRow () override |
void | beginUnderline () override |
void | endAnchor () override |
void | endBackground () override |
void | endEmph () override |
void | endFontFamily () override |
void | endFontPointSize () override |
void | endForeground () override |
void | endHeader (int level) override |
void | endList () override |
void | endListItem () override |
void | endParagraph () override |
void | endStrikeout () override |
void | endStrong () override |
void | endSubscript () override |
void | endSuperscript () override |
void | endTable () override |
void | endTableCell () override |
void | endTableHeaderCell () override |
void | endTableRow () override |
void | endUnderline () override |
QString | getResult () override |
void | insertHorizontalRule (int width=-1) override |
void | insertImage (const QString &src, qreal width, qreal height) override |
![]() | |
virtual | ~AbstractMarkupBuilder () |
This class creates a simple plain text markup.
Text that may be represented as
would be output as
The markup is intended to be simple, plain and easily human readable. No markup is created for different font-familiy, font-size, foreground or background colors.
Lists are marked up by preceding the list element with '*' for disc, 'o' for circle, 'X' for square, or a letter or number. Lists are also indented if nested. eg:
External references such as external urls and images are represented in the body text as a reference, and references are maintained at the bottom of the output.
Eg,
becomes:
Definition at line 106 of file plaintextmarkupbuilder.h.
|
overridevirtual |
Add a newline to the markup.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 224 of file plaintextmarkupbuilder.cpp.
int PlainTextMarkupBuilder::addReference | ( | const QString & | reference | ) |
Adds a reference to reference
to the internal list of references in the document.
Definition at line 238 of file plaintextmarkupbuilder.cpp.
Referenced by insertImage().
|
overridevirtual |
Append the plain text text
to the markup
text | The text to append. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 349 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Append the raw text text
to the markup. text
is added unescaped
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 355 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a url anchor element in the markup
href | The href of the anchor. |
name | The name of the anchor. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 199 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a decorarated background element in the markup (A text background color) using brush
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 370 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin an emphasised element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 163 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new font familiy element in the markup
family | The name of the font family to begin. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 375 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new font point size element in the markup
size | The point size to begin. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 380 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a decorarated foreground element in the markup (A text color) using brush
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 382 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a level level
header
level | An integer between 1 and 6 |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 387 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new list element in the markup. A list element contains list items, and may contain other lists.
style | The style of list to create. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 259 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new list item in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 275 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new paragraph in the markup
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. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 389 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a struck out element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 187 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a bold element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 151 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a subscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 337 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a superscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 325 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a table element.
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. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 400 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new table cell.
width | The width of the cell. |
colSpan | The column span of the cell. |
rowSpan | The row span of the cell. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 408 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new table header cell.
width | The width of the cell. |
colSpan | The column span of the cell. |
rowSpan | The row span of the cell. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 416 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin a new table row
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 424 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Begin an underlined element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 175 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the anchor element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 211 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the decorarated background element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 426 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the emphasised element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 169 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End font family element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 428 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End font point size element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 430 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the decorarated foreground element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 432 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End a level level
header
level | An integer between 1 and 6 |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 434 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the list.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 266 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End the list item
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 318 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the paragraph in the markup.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 218 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the struck out element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 193 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the bold element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 157 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End subscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 343 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End superscript element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 331 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End a table element
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 436 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End a table cell
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 438 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End a table header cell
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 440 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
End a table row
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 442 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Close the underlined element in the markup
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 181 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Returns the finalised plain text markup, including references at the end.
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 361 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Insert a horizontal rule into the markup.
width | The width of the rule. Default is full width. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 230 of file plaintextmarkupbuilder.cpp.
|
overridevirtual |
Insert a new image element into the markup.
url | The url of the image |
width | The width of the image |
height | The height of the image. |
Implements Cutelee::AbstractMarkupBuilder.
Definition at line 247 of file plaintextmarkupbuilder.cpp.
References addReference().