File indexing completed on 2024-06-23 05:19:20
0001 /* -*- mode: C++; c-file-style: "gnu" -*- 0002 bodypart.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 namespace KMime 0016 { 0017 class Content; 0018 } 0019 0020 namespace MimeTreeParser 0021 { 0022 class NodeHelper; 0023 class ObjectTreeParser; 0024 class ProcessResult; 0025 0026 namespace Interface 0027 { 0028 class ObjectTreeSource; 0029 0030 /** 0031 @short interface of classes that implement status for BodyPartFormatters. 0032 */ 0033 class MIMETREEPARSER_EXPORT BodyPartMemento 0034 { 0035 public: 0036 virtual ~BodyPartMemento(); 0037 0038 virtual void detach() = 0; 0039 }; 0040 0041 /** 0042 @short interface of message body parts. 0043 */ 0044 class MIMETREEPARSER_EXPORT BodyPart 0045 { 0046 public: 0047 virtual ~BodyPart(); 0048 0049 /** 0050 @return the BodyPartMemento set for this part, or null, if 0051 none is set. 0052 */ 0053 virtual BodyPartMemento *memento() const = 0; 0054 0055 /** Returns the KMime::Content node represented here. Makes most of the above obsolete 0056 and probably should be used in the interfaces in the first place. 0057 */ 0058 virtual KMime::Content *content() const = 0; 0059 0060 /** 0061 * Returns the top-level content. 0062 * Note that this is _not_ necessarily the same as content()->topLevel(), for example the later 0063 * will not work for "extra nodes", i.e. nodes in encrypted parts of the mail. 0064 * topLevelContent() will return the correct result in this case. Also note that 0065 * topLevelContent() 0066 */ 0067 virtual KMime::Content *topLevelContent() const = 0; 0068 0069 /** 0070 * Ok, this is ugly, exposing the node helper here, but there is too much useful stuff in there 0071 * for real-world plugins. Still, there should be a nicer way for this. 0072 */ 0073 virtual MimeTreeParser::NodeHelper *nodeHelper() const = 0; 0074 0075 /** 0076 * For making it easier to refactor, add objectTreeParser 0077 */ 0078 virtual MimeTreeParser::ObjectTreeParser *objectTreeParser() const = 0; 0079 virtual MimeTreeParser::Interface::ObjectTreeSource *source() const = 0; 0080 virtual MimeTreeParser::ProcessResult *processResult() const = 0; 0081 }; 0082 } // namespace Interface 0083 }