Projet Bee-Honey't  1.0
BTS SN 2019
mimepart.h
Aller à la documentation de ce fichier.
1 /*
2  Copyright (c) 2011-2012 - Tőkés Attila
3  Copyright (C) 2015 Daniel Nicoletti <dantti12@gmail.com>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  See the LICENSE file for more details.
16 */
17 
18 #ifndef MIMEPART_H
19 #define MIMEPART_H
20 
21 #include <QtCore/QSharedDataPointer>
22 #include <QtCore/QMetaType>
23 
24 #include "mimecontentformatter.h"
25 
26 #include "smtpexports.h"
27 
28 class QIODevice;
29 namespace SimpleMail {
30 
31 class MimePartPrivate;
33 {
34 public:
35  enum Encoding {
40  };
41 
42  MimePart();
43  MimePart(const MimePart &other);
44  virtual ~MimePart();
45 
46  MimePart &operator=(const MimePart &other);
47 
48  QByteArray header() const;
49  QByteArray content() const;
50 
51  void setContent(const QByteArray &content);
52  void setHeader(const QByteArray &header);
53 
54  void addHeaderLine(const QByteArray &line);
55 
56  void setContentId(const QByteArray &cId);
57  QByteArray contentId() const;
58 
59  void setContentName(const QByteArray &contentName);
60  QByteArray contentName() const;
61 
62  void setContentType(const QByteArray &contentType);
63  QByteArray contentType() const;
64 
65  void setCharset(const QByteArray &charset);
66  QByteArray charset() const;
67 
68  void setEncoding(Encoding enc);
69  Encoding encoding() const;
70 
71  void setData(const QString &data);
72  QString data() const;
73 
74  MimeContentFormatter *contentFormatter();
75 
76  bool write(QIODevice *device);
77 
78 protected:
80  virtual bool writeData(QIODevice *device);
81 
82  QSharedDataPointer<MimePartPrivate> d_ptr;
83 
84  // Q_DECLARE_PRIVATE equivalent for shared data pointers
85  MimePartPrivate* d_func();
86  inline const MimePartPrivate* d_func() const
87  {
88  return d_ptr.constData();
89  }
90 };
91 
92 }
93 
94 Q_DECLARE_METATYPE(SimpleMail::MimePart*)
95 
96 #endif // MIMEPART_H
Definition: mimecontentformatter.h:27
Definition: mimepart.h:36
Encoding
Definition: mimepart.h:35
QSharedDataPointer< MimePartPrivate > d_ptr
Definition: mimepart.h:82
#define SMTP_EXPORT
Definition: smtpexports.h:7
Definition: mimepart.h:38
Definition: mimepart.h:37
Definition: quotedprintable.h:27
Definition: mimepart.h:32
Definition: mimepart_p.h:28
Definition: emailaddress.h:26
const MimePartPrivate * d_func() const
Definition: mimepart.h:86