1 | /* |
2 | kmime_header_factory.h |
3 | |
4 | KMime, the KDE Internet mail/usenet news message library. |
5 | Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com> |
6 | |
7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. |
11 | |
12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | */ |
22 | /** |
23 | @file |
24 | This file is part of the API for handling @ref MIME data and |
25 | defines the HeaderFactory class. |
26 | |
27 | @brief |
28 | Defines the HeaderFactory class. |
29 | |
30 | @authors Constantin Berzan \<exit3219@gmail.com\> |
31 | */ |
32 | |
33 | #ifndef __KMIME_HEADERFACTORY_H__ |
34 | #define __KMIME_HEADERFACTORY_H__ |
35 | |
36 | #include "kmime_export.h" |
37 | |
38 | #include <QtCore/QByteArray> |
39 | |
40 | namespace KMime { |
41 | |
42 | namespace Headers { |
43 | class ; |
44 | } |
45 | |
46 | class |
47 | { |
48 | public: |
49 | virtual () {} |
50 | virtual Headers::Base *() const = 0; |
51 | }; |
52 | |
53 | template <typename T> |
54 | class : public HeaderMakerBase |
55 | { |
56 | public: |
57 | virtual Headers::Base *() const |
58 | { |
59 | return new T; |
60 | } |
61 | }; |
62 | |
63 | class ; |
64 | |
65 | /** |
66 | docu TODO |
67 | */ |
68 | class |
69 | { |
70 | public: |
71 | static HeaderFactory* (); |
72 | |
73 | template<typename T> inline bool () |
74 | { |
75 | T dummy; |
76 | return registerHeaderMaker( QByteArray( dummy.type() ), new HeaderMaker<T>() ); |
77 | } |
78 | |
79 | Headers::Base *( const QByteArray &type ); |
80 | |
81 | private: |
82 | explicit ( HeaderFactoryPrivate *dd ); |
83 | ( const HeaderFactory &other ); // undefined |
84 | HeaderFactory& ( const HeaderFactory &other ); // undefined |
85 | (); |
86 | |
87 | bool ( const QByteArray &type, HeaderMakerBase *maker ); |
88 | |
89 | friend class HeaderFactoryPrivate; |
90 | HeaderFactoryPrivate *const ; |
91 | }; |
92 | |
93 | } // namespace KMime |
94 | |
95 | #endif /* __KMIME_HEADERFACTORY_H__ */ |
96 | |