diff options
Diffstat (limited to 'framework/src/domain/mimetreeparser/otp/queuehtmlwriter.h')
-rw-r--r-- | framework/src/domain/mimetreeparser/otp/queuehtmlwriter.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/framework/src/domain/mimetreeparser/otp/queuehtmlwriter.h b/framework/src/domain/mimetreeparser/otp/queuehtmlwriter.h new file mode 100644 index 00000000..9e7a4659 --- /dev/null +++ b/framework/src/domain/mimetreeparser/otp/queuehtmlwriter.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | Copyright (c) 2015 Sandro Knauß <sknauss@kde.org> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef __MIMETREEPARSER_QUEUEHTMLWRITER_H__ | ||
21 | #define __MIMETREEPARSER_QUEUEHTMLWRITER_H__ | ||
22 | |||
23 | #include "htmlwriter.h" | ||
24 | |||
25 | #include<QVector> | ||
26 | #include<QVariant> | ||
27 | |||
28 | class QString; | ||
29 | class QByteArray; | ||
30 | |||
31 | namespace MimeTreeParser | ||
32 | { | ||
33 | /** | ||
34 | \brief Cache HTML output and not write them directy. | ||
35 | |||
36 | This class is needed to make it possible to first process the mime tree and | ||
37 | afterwards render the HTML. | ||
38 | |||
39 | Please do not use this class - it is only added to make it possible to slowly | ||
40 | move ObjectTreeParser to a process fist / render later. | ||
41 | |||
42 | */ | ||
43 | struct Command { | ||
44 | enum { Begin, End, Reset, Write, Queue, Flush, EmbedPart, ExtraHead } type; | ||
45 | QString s; | ||
46 | QByteArray b; | ||
47 | }; | ||
48 | |||
49 | class QueueHtmlWriter : public HtmlWriter | ||
50 | { | ||
51 | public: | ||
52 | explicit QueueHtmlWriter(MimeTreeParser::HtmlWriter *base); | ||
53 | virtual ~QueueHtmlWriter(); | ||
54 | |||
55 | void setBase(HtmlWriter *base); | ||
56 | |||
57 | void begin(const QString &cssDefs) Q_DECL_OVERRIDE; | ||
58 | void end() Q_DECL_OVERRIDE; | ||
59 | void reset() Q_DECL_OVERRIDE; | ||
60 | void write(const QString &str) Q_DECL_OVERRIDE; | ||
61 | void queue(const QString &str) Q_DECL_OVERRIDE; | ||
62 | void flush() Q_DECL_OVERRIDE; | ||
63 | void embedPart(const QByteArray &contentId, const QString &url) Q_DECL_OVERRIDE; | ||
64 | void extraHead(const QString &str) Q_DECL_OVERRIDE; | ||
65 | |||
66 | void replay(); | ||
67 | |||
68 | private: | ||
69 | HtmlWriter *mBase; | ||
70 | QVector<Command> mQueue; | ||
71 | }; | ||
72 | |||
73 | } // namespace MimeTreeParser | ||
74 | |||
75 | #endif // __MIMETREEPARSER_QUEUEHTMLWRITER_H__ | ||