Grantlee: textdocument/lib/bbcodebuilder.h Source File

Grantlee 5.3.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
26namespace Grantlee
27{
28
32 class BBCodeBuilder : public AbstractMarkupBuilder
33{
34public:
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 = {}, const QString &name = {}) override;
56 void endAnchor() override;
57
58 // Font family not supported by BBCode.
59
65 void beginFontPointSize(int size) override;
66 void endFontPointSize() override;
67
68 void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
69 qreal bottom = 0.0, qreal left = 0.0,
70 qreal right = 0.0) override;
71
72 void endParagraph() override;
73 void addNewline() override;
74
75 void insertImage(const QString &src, qreal width, qreal height) override;
76
77 void beginList(QTextListFormat::Style type) override;
78
79 void endList() override;
80
81 void beginListItem() override;
82
83 void beginSuperscript() override;
84
85 void endSuperscript() override;
86
87 void beginSubscript() override;
88
89 void endSubscript() override;
90
91 void beginTable(qreal, qreal, const QString &) override;
92
93 void beginTableRow() override;
94
95 void appendLiteralText(const QString &text) override;
96
100 const QString escape(const QString &text) const;
101
102 QString getResult() override;
103
104private:
105 QList<QTextListFormat::Style> m_currentListItemStyles;
106
107 QString m_text;
108
109 Qt::Alignment m_currentAlignment;
110};
111}
112
113#endif
Grantlee::AbstractMarkupBuilder
Interface for creating marked-up text output.
Definition abstractmarkupbuilder.h:52
Grantlee::BBCodeBuilder
Builder to create BBCode from a QTextDocument.
Definition bbcodebuilder.h:33
Grantlee::BBCodeBuilder::beginSuperscript
void beginSuperscript() override
Grantlee::BBCodeBuilder::endStrikeout
void endStrikeout() override
Grantlee::BBCodeBuilder::beginList
void beginList(QTextListFormat::Style type) override
Grantlee::BBCodeBuilder::endAnchor
void endAnchor() override
Grantlee::BBCodeBuilder::escape
const QString escape(const QString &text) const
Grantlee::BBCodeBuilder::endUnderline
void endUnderline() override
Grantlee::BBCodeBuilder::endFontPointSize
void endFontPointSize() override
Grantlee::BBCodeBuilder::beginAnchor
void beginAnchor(const QString &href={}, const QString &name={}) override
Grantlee::BBCodeBuilder::endSuperscript
void endSuperscript() override
Grantlee::BBCodeBuilder::endForeground
void endForeground() override
Grantlee::BBCodeBuilder::beginListItem
void beginListItem() 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::addNewline
void addNewline() override
Grantlee::BBCodeBuilder::beginForeground
void beginForeground(const QBrush &brush) override
Grantlee::BBCodeBuilder::beginTable
void beginTable(qreal, qreal, const QString &) override
Grantlee::BBCodeBuilder::beginStrikeout
void beginStrikeout() override
Grantlee::BBCodeBuilder::endList
void endList() override
Grantlee::BBCodeBuilder::beginEmph
void beginEmph() override
Grantlee::BBCodeBuilder::endParagraph
void endParagraph() override
Grantlee::BBCodeBuilder::beginTableRow
void beginTableRow() override
Grantlee::BBCodeBuilder::beginFontPointSize
void beginFontPointSize(int size) override
Grantlee::BBCodeBuilder::beginSubscript
void beginSubscript() override
Grantlee::BBCodeBuilder::endSubscript
void endSubscript() override
Grantlee::BBCodeBuilder::BBCodeBuilder
BBCodeBuilder()
Grantlee::BBCodeBuilder::endStrong
void endStrong() override
Grantlee::BBCodeBuilder::endEmph
void endEmph() override
Grantlee::BBCodeBuilder::beginUnderline
void beginUnderline() override
Grantlee::BBCodeBuilder::insertImage
void insertImage(const QString &src, qreal width, qreal height) override
Grantlee::BBCodeBuilder::beginStrong
void beginStrong() override
Grantlee::BBCodeBuilder::getResult
QString getResult() override
Grantlee::BBCodeBuilder::appendLiteralText
void appendLiteralText(const QString &text) override
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition Mainpage.dox:8