Grantlee: textdocument/lib/bbcodebuilder.h Source File

Grantlee 5.1.0

bbcodebuilder.h
1 /*
2 This file is part of the Grantlee template system.
3
4 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either version
9 2.1 of the Licence, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef GRANTLEE_BBCODEBUILDER_H
22 #define GRANTLEE_BBCODEBUILDER_H
23
24 #include "abstractmarkupbuilder.h"
25
26 namespace Grantlee
27 {
28
32 class BBCodeBuilder : public AbstractMarkupBuilder
33 {
34 public:
38 BBCodeBuilder();
39
40 ~BBCodeBuilder() override;
41
42 void beginStrong() override;
43 void endStrong() override;
44 void beginEmph() override;
45 void endEmph() override;
46 void beginUnderline() override;
47 void endUnderline() override;
48 void beginStrikeout() override;
49 void endStrikeout() override;
50 void beginForeground(const QBrush &brush) override;
51 void endForeground() override;
52
53 // Background colour not supported by BBCode.
54
55 void beginAnchor(const QString &href = QString(),
56 const QString &name = QString()) override;
57 void endAnchor() override;
58
59 // Font family not supported by BBCode.
60
68 void beginFontPointSize(int size) override;
69 void endFontPointSize() override;
70
71 void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
72 qreal bottom = 0.0, qreal left = 0.0,
73 qreal right = 0.0) override;
74
75 void endParagraph() override;
76 void addNewline() override;
77
78 void insertImage(const QString &src, qreal width, qreal height) override;
79
80 void beginList(QTextListFormat::Style type) override;
81
82 void endList() override;
83
84 void beginListItem() override;
85
86 void beginSuperscript() override;
87
88 void endSuperscript() override;
89
90 void beginSubscript() override;
91
92 void endSubscript() override;
93
94 void beginTable(qreal, qreal, const QString &) override;
95
96 void beginTableRow() override;
97
98 void appendLiteralText(const QString &text) override;
99
103 const QString escape(const QString &text) const;
104
105 QString getResult() override;
106
107 private:
108 QList<QTextListFormat::Style> m_currentListItemStyles;
109
110 QString m_text;
111
112 Qt::Alignment m_currentAlignment;
113 };
114 }
115
116 #endif
Grantlee::BBCodeBuilder
Builder to create BBCode from a QTextDocument.
Definition: bbcodebuilder.h:32
Grantlee::BBCodeBuilder::beginSuperscript
void beginSuperscript() override
Grantlee::BBCodeBuilder::beginForeground
void beginForeground(const QBrush &brush) override
Grantlee::BBCodeBuilder::beginTableRow
void beginTableRow() override
Grantlee::BBCodeBuilder::beginParagraph
void beginParagraph(Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0) override
Grantlee::BBCodeBuilder::insertImage
void insertImage(const QString &src, qreal width, qreal height) override
Grantlee::BBCodeBuilder::endForeground
void endForeground() override
Grantlee::BBCodeBuilder::appendLiteralText
void appendLiteralText(const QString &text) override
Grantlee::BBCodeBuilder::getResult
QString getResult() override
Grantlee::BBCodeBuilder::beginEmph
void beginEmph() override
Grantlee::BBCodeBuilder::endList
void endList() override
Grantlee::BBCodeBuilder::endStrikeout
void endStrikeout() override
Grantlee::BBCodeBuilder::beginFontPointSize
void beginFontPointSize(int size) override
Grantlee::BBCodeBuilder::endParagraph
void endParagraph() override
Grantlee::BBCodeBuilder::beginStrikeout
void beginStrikeout() override
Grantlee::BBCodeBuilder::beginAnchor
void beginAnchor(const QString &href=QString(), const QString &name=QString()) override
Grantlee::BBCodeBuilder::beginStrong
void beginStrong() override
Grantlee::BBCodeBuilder::beginSubscript
void beginSubscript() override
Grantlee::BBCodeBuilder::escape
const QString escape(const QString &text) const
Grantlee::BBCodeBuilder::endAnchor
void endAnchor() override
Grantlee::BBCodeBuilder::beginListItem
void beginListItem() override
Grantlee::BBCodeBuilder::endSubscript
void endSubscript() override
Grantlee::BBCodeBuilder::endFontPointSize
void endFontPointSize() override
Grantlee::BBCodeBuilder::beginUnderline
void beginUnderline() override
Grantlee::BBCodeBuilder::endEmph
void endEmph() override
Grantlee::BBCodeBuilder::endSuperscript
void endSuperscript() override
Grantlee::BBCodeBuilder::addNewline
void addNewline() override
Grantlee::BBCodeBuilder::BBCodeBuilder
BBCodeBuilder()
Grantlee::BBCodeBuilder::endStrong
void endStrong() override
Grantlee::BBCodeBuilder::beginTable
void beginTable(qreal, qreal, const QString &) override
Grantlee::AbstractMarkupBuilder
The AbstractMarkupBuilder class serves as a base class for creating marked up plain text output.
Definition: abstractmarkupbuilder.h:52
Grantlee::BBCodeBuilder::beginList
void beginList(QTextListFormat::Style type) override
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7
Grantlee::BBCodeBuilder::endUnderline
void endUnderline() override