diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 19:13:13 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 19:13:13 +0200 |
commit | b968ea8ed364238c57c3e74cf2c122cb897cfbea (patch) | |
tree | 7a2dca2199906413a2d0b7d075ded0e4d5ffb69f /framework/src/domain/mimetreeparser/otp/htmlwriter.h | |
parent | c1ca732bafc60f5c140ef5516e32bd46503bf68c (diff) | |
download | kube-b968ea8ed364238c57c3e74cf2c122cb897cfbea.tar.gz kube-b968ea8ed364238c57c3e74cf2c122cb897cfbea.zip |
Builds but doesn't link, no formatters yet
Diffstat (limited to 'framework/src/domain/mimetreeparser/otp/htmlwriter.h')
-rw-r--r-- | framework/src/domain/mimetreeparser/otp/htmlwriter.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/framework/src/domain/mimetreeparser/otp/htmlwriter.h b/framework/src/domain/mimetreeparser/otp/htmlwriter.h new file mode 100644 index 00000000..382c80fb --- /dev/null +++ b/framework/src/domain/mimetreeparser/otp/htmlwriter.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* -*- c++ -*- | ||
2 | interfaces/htmlwriter.h | ||
3 | |||
4 | This file is part of KMail's plugin interface. | ||
5 | Copyright (c) 2003 Marc Mutz <mutz@kde.org> | ||
6 | |||
7 | KMail is free software; you can redistribute it and/or modify it | ||
8 | under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | KMail is distributed in the hope that it will be useful, but | ||
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | |||
21 | In addition, as a special exception, the copyright holders give | ||
22 | permission to link the code of this program with any edition of | ||
23 | the Qt library by Trolltech AS, Norway (or with modified versions | ||
24 | of Qt that use the same license as Qt), and distribute linked | ||
25 | combinations including the two. You must obey the GNU General | ||
26 | Public License in all respects for all of the code used other than | ||
27 | Qt. If you modify this file, you may extend this exception to | ||
28 | your version of the file, but you are not obligated to do so. If | ||
29 | you do not wish to do so, delete this exception statement from | ||
30 | your version. | ||
31 | */ | ||
32 | |||
33 | #ifndef __MIMETREEPARSER_INTERFACES_HTMLWRITER_H__ | ||
34 | #define __MIMETREEPARSER_INTERFACES_HTMLWRITER_H__ | ||
35 | |||
36 | class QByteArray; | ||
37 | class QString; | ||
38 | |||
39 | namespace MimeTreeParser | ||
40 | { | ||
41 | /** | ||
42 | * @short An interface for HTML sinks. | ||
43 | * @author Marc Mutz <mutz@kde.org> | ||
44 | * | ||
45 | */ | ||
46 | namespace Interface | ||
47 | { | ||
48 | class HtmlWriter | ||
49 | { | ||
50 | public: | ||
51 | virtual ~HtmlWriter(); | ||
52 | |||
53 | /** Signal the begin of stuff to write, and give the CSS definitions */ | ||
54 | virtual void begin(const QString &cssDefinitions) = 0; | ||
55 | /** Write out a chunk of text. No HTML escaping is performed. */ | ||
56 | virtual void write(const QString &html) = 0; | ||
57 | /** Signal the end of stuff to write. */ | ||
58 | virtual void end() = 0; | ||
59 | }; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * @short An interface to HTML sinks | ||
64 | * @author Marc Mutz <mutz@kde.org> | ||
65 | * | ||
66 | * @deprecated KMail should be ported to Interface::HtmlWriter. This | ||
67 | * interface exposes internal working models. The queuing | ||
68 | * vs. writing() issues exposed here should be hidden by using two | ||
69 | * different implementations of KHTMLPartHtmlWriter: one for | ||
70 | * queuing, and one for writing. This should be fixed before the | ||
71 | * release, so we an keep the plugin interface stable. | ||
72 | * | ||
73 | * Operate this interface in one and only one of the following two | ||
74 | * modes: | ||
75 | * | ||
76 | * @section Sync Mode | ||
77 | * | ||
78 | * In sync mode, use #begin() to initiate a session, then | ||
79 | * #write() some chunks of HTML code and finally #end() the session. | ||
80 | * | ||
81 | * @section Async Mode | ||
82 | * | ||
83 | * In async mode, use #begin() to initialize a session, then | ||
84 | * #queue() some chunks of HTML code and finally end the | ||
85 | * session by calling #flush(). | ||
86 | * | ||
87 | * Queued HTML code is fed to the html sink using a timer. For this | ||
88 | * to work, control must return to the event loop so timer events | ||
89 | * are delivered. | ||
90 | * | ||
91 | * @section Combined mode | ||
92 | * | ||
93 | * You may combine the two modes in the following way only. Any | ||
94 | * number of #write() calls can precede #queue() calls, | ||
95 | * but once a chunk has been queued, you @em must @em not | ||
96 | * #write() more data, only #queue() it. | ||
97 | * | ||
98 | * Naturally, whenever you queued data in a given session, that | ||
99 | * session must be ended by calling #flush(), not #end(). | ||
100 | */ | ||
101 | class HtmlWriter : public Interface::HtmlWriter | ||
102 | { | ||
103 | public: | ||
104 | virtual ~HtmlWriter(); | ||
105 | |||
106 | /** Stop all possibly pending processing in order to be able to | ||
107 | * call #begin() again. */ | ||
108 | virtual void reset() = 0; | ||
109 | |||
110 | virtual void queue(const QString &str) = 0; | ||
111 | /** (Start) flushing internal buffers, if any. */ | ||
112 | virtual void flush() = 0; | ||
113 | |||
114 | /** | ||
115 | * Embed a part with Content-ID @p contentId, using url @p url. | ||
116 | */ | ||
117 | virtual void embedPart(const QByteArray &contentId, const QString &url) = 0; | ||
118 | |||
119 | virtual void extraHead(const QString &str) = 0; | ||
120 | }; | ||
121 | |||
122 | } | ||
123 | |||
124 | #endif // __MIMETREEPARSER_INTERFACES_HTMLWRITER_H__ | ||
125 | |||