diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-29 16:17:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-06-04 12:57:04 +0200 |
commit | e452707fdfbd61be1e5633b516b653b7337e7865 (patch) | |
tree | 1e1d4b48ebf8d381f292436f2ba04b8763edc5de /framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h | |
parent | 5a1033bdace740799a6e03389bee30e5a4de5d44 (diff) | |
download | kube-e452707fdfbd61be1e5633b516b653b7337e7865.tar.gz kube-e452707fdfbd61be1e5633b516b653b7337e7865.zip |
Reduced the messagetreeparser to aproximately what we actually require
While in a much more managable state it's still not pretty.
However, further refactoring can now gradually happen as we need to do
further work on it.
Things that should happen eventually:
* Simplify the logic that creates the messageparts (we don't need the whole formatter plugin complexity)
* Get rid of the nodehelper (let the parts hold the necessary data)
* Get rid of partmetadata (let the part handleit)
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h b/framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h new file mode 100644 index 00000000..2bba551d --- /dev/null +++ b/framework/src/domain/mime/mimetreeparser/bodypartformatterbasefactory.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | bodypartformatterfactory.h | ||
3 | |||
4 | This file is part of KMail, the KDE mail client. | ||
5 | Copyright (c) 2004 Marc Mutz <mutz@kde.org>, | ||
6 | Ingo Kloecker <kloecker@kde.org> | ||
7 | |||
8 | KMail is free software; you can redistribute it and/or modify it | ||
9 | under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | KMail is distributed in the hope that it will be useful, but | ||
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | |||
22 | In addition, as a special exception, the copyright holders give | ||
23 | permission to link the code of this program with any edition of | ||
24 | the Qt library by Trolltech AS, Norway (or with modified versions | ||
25 | of Qt that use the same license as Qt), and distribute linked | ||
26 | combinations including the two. You must obey the GNU General | ||
27 | Public License in all respects for all of the code used other than | ||
28 | Qt. If you modify this file, you may extend this exception to | ||
29 | your version of the file, but you are not obligated to do so. If | ||
30 | you do not wish to do so, delete this exception statement from | ||
31 | your version. | ||
32 | */ | ||
33 | |||
34 | #ifndef __MIMETREEPARSER_BODYPARTFORMATTERBASEFACTORY_H__ | ||
35 | #define __MIMETREEPARSER_BODYPARTFORMATTERBASEFACTORY_H__ | ||
36 | |||
37 | #include <map> | ||
38 | #include <QByteArray> | ||
39 | |||
40 | namespace MimeTreeParser | ||
41 | { | ||
42 | |||
43 | namespace Interface | ||
44 | { | ||
45 | class BodyPartFormatter; | ||
46 | } | ||
47 | |||
48 | struct ltstr { | ||
49 | bool operator()(const char *s1, const char *s2) const | ||
50 | { | ||
51 | return qstricmp(s1, s2) < 0; | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | typedef std::multimap<const char *, const Interface::BodyPartFormatter *, ltstr> SubtypeRegistry; | ||
56 | typedef std::map<const char *, MimeTreeParser::SubtypeRegistry, MimeTreeParser::ltstr> TypeRegistry; | ||
57 | |||
58 | class BodyPartFormatterBaseFactoryPrivate; | ||
59 | |||
60 | class BodyPartFormatterBaseFactory | ||
61 | { | ||
62 | public: | ||
63 | BodyPartFormatterBaseFactory(); | ||
64 | virtual ~BodyPartFormatterBaseFactory(); | ||
65 | |||
66 | SubtypeRegistry::const_iterator createForIterator(const char *type, const char *subtype) const; | ||
67 | const SubtypeRegistry &subtypeRegistry(const char *type) const; | ||
68 | |||
69 | protected: | ||
70 | void insert(const char *type, const char *subtype, const Interface::BodyPartFormatter *formatter); | ||
71 | virtual void loadPlugins(); | ||
72 | private: | ||
73 | static BodyPartFormatterBaseFactory *mSelf; | ||
74 | |||
75 | BodyPartFormatterBaseFactoryPrivate *d; | ||
76 | friend class BodyPartFormatterBaseFactoryPrivate; | ||
77 | private: | ||
78 | // disabled | ||
79 | const BodyPartFormatterBaseFactory &operator=(const BodyPartFormatterBaseFactory &); | ||
80 | BodyPartFormatterBaseFactory(const BodyPartFormatterBaseFactory &); | ||
81 | }; | ||
82 | |||
83 | } | ||
84 | |||
85 | #endif // __MIMETREEPARSER_BODYPARTFORMATTERFACTORY_H__ | ||