• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KMIME Library

  • kmime
kmime_headerfactory_p.h
Go to the documentation of this file.
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*/
33#ifndef __KMIME_HEADERFACTORY_H__
34#define __KMIME_HEADERFACTORY_H__
35
36#include "kmime_export.h"
37
38#include <QtCore/QByteArray>
39
40namespace KMime {
41
42namespace Headers {
43 class Base;
44}
45
46class HeaderMakerBase
47{
48 public:
49 virtual ~HeaderMakerBase() {}
50 virtual Headers::Base *create() const = 0;
51};
52
53template <typename T>
54class HeaderMaker : public HeaderMakerBase
55{
56 public:
57 virtual Headers::Base *create() const
58 {
59 return new T;
60 }
61};
62
63class HeaderFactoryPrivate;
64
68class HeaderFactory
69{
70 public:
71 static HeaderFactory* self();
72
73 template<typename T> inline bool registerHeader()
74 {
75 T dummy;
76 return registerHeaderMaker( QByteArray( dummy.type() ), new HeaderMaker<T>() );
77 }
78
79 Headers::Base *createHeader( const QByteArray &type );
80
81 private:
82 explicit HeaderFactory( HeaderFactoryPrivate *dd );
83 HeaderFactory( const HeaderFactory &other ); // undefined
84 HeaderFactory& operator=( const HeaderFactory &other ); // undefined
85 ~HeaderFactory();
86
87 bool registerHeaderMaker( const QByteArray &type, HeaderMakerBase *maker );
88
89 friend class HeaderFactoryPrivate;
90 HeaderFactoryPrivate *const d;
91};
92
93} // namespace KMime
94
95#endif /* __KMIME_HEADERFACTORY_H__ */
KMime::HeaderFactory
docu TODO
Definition: kmime_headerfactory_p.h:69
KMime::Headers::Base
Baseclass of all header-classes.
Definition: kmime_headers.h:125
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal