Messagelib

bufferedhtmlwriter.h
1/*
2 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messageviewer_export.h"
10#include <MessageViewer/HtmlWriter>
11
12#include <QBuffer>
13#include <QByteArray>
14
15namespace MessageViewer
16{
17/**
18 * QBuffer-backed HtmlWriter
19 */
20class MESSAGEVIEWER_EXPORT BufferedHtmlWriter : public HtmlWriter
21{
22public:
23 BufferedHtmlWriter();
24 ~BufferedHtmlWriter() override;
25
26 void begin() override;
27 void end() override;
28 void reset() override;
29 [[nodiscard]] QIODevice *device() const override;
30
31 [[nodiscard]] QByteArray data() const;
32 void clear();
33
34 void setExtraHead(const QString &str) override;
35 void embedPart(const QByteArray &contentId, const QString &url) override;
36 void setStyleBody(const QString &styleBody) override;
37
38protected:
39 QByteArray m_data;
40
41private:
42 QBuffer m_buffer;
43};
44}
void reset() override
Stop all possibly pending processing in order to be able to call begin() again.
void begin() override
Signal the begin of stuff to write.
QIODevice * device() const override
Returns the QIODevice backing this HtmlWriter instance.
void embedPart(const QByteArray &contentId, const QString &url) override
Embed a part with Content-ID contentId, using url url.
void end() override
Signal the end of stuff to write.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:47:40 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.