File indexing completed on 2024-06-23 05:19:20

0001 /*  -*- mode: C++; c-file-style: "gnu" -*-
0002     bodypartformatter.h
0003 
0004     This file is part of KMail's plugin interface.
0005     SPDX-FileCopyrightText: 2004 Marc Mutz <mutz@kde.org>
0006     SPDX-FileCopyrightText: 2004 Ingo Kloecker <kloecker@kde.org>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #pragma once
0012 
0013 #include "mimetreeparser_export.h"
0014 
0015 #include <QSharedPointer>
0016 
0017 #include "mimetreeparser/objecttreeparser.h"
0018 
0019 namespace MimeTreeParser
0020 {
0021 class MessagePart;
0022 using MessagePartPtr = QSharedPointer<MessagePart>;
0023 
0024 namespace Interface
0025 {
0026 class BodyPart;
0027 /**
0028  * @brief The BodyPartFormatter class
0029  */
0030 class MIMETREEPARSER_EXPORT BodyPartFormatter
0031 {
0032 public:
0033     virtual ~BodyPartFormatter();
0034 
0035     virtual MimeTreeParser::MessagePartPtr process(BodyPart &part) const = 0;
0036 };
0037 
0038 /**
0039     @short interface for BodyPartFormatter plugins
0040 
0041     The interface is queried by for types, subtypes, and the
0042     corresponding bodypart formatter, and the result inserted into
0043     the bodypart formatter factory.
0044 
0045     Subtype alone or both type and subtype may be "*", which is
0046     taken as a wildcard, so that e.g. type=text subtype=* matches
0047     any text subtype, but with lesser specificity than a concrete
0048     mimetype such as text/plain. type=* is only allowed when
0049     subtype=*, too.
0050 */
0051 class MIMETREEPARSER_EXPORT BodyPartFormatterPlugin
0052 {
0053 public:
0054     virtual ~BodyPartFormatterPlugin();
0055 
0056     virtual const BodyPartFormatter *bodyPartFormatter(int idx) const = 0;
0057 };
0058 } // namespace Interface
0059 }
0060 
0061 Q_DECLARE_INTERFACE(MimeTreeParser::Interface::BodyPartFormatterPlugin, "org.kde.messageviewer.bodypartformatter/1.1")