1/*
2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KMIME_CONTENT_P_H
21#define KMIME_CONTENT_P_H
22
23//@cond PRIVATE
24
25#include <boost/shared_ptr.hpp>
26
27namespace KMime {
28 class Message;
29 typedef boost::shared_ptr<Message> MessagePtr;
30}
31
32namespace KMime {
33
34class ContentPrivate
35{
36 public:
37 explicit ContentPrivate( Content *q ) :
38 parent( 0 ),
39 q_ptr( q ),
40 forceDefaultCS( false ),
41 frozen( false )
42 {
43 defaultCS = KMime::cachedCharset( "ISO-8859-1" );
44 }
45
46 virtual ~ContentPrivate()
47 {
48 qDeleteAll( multipartContents );
49 multipartContents.clear();
50 }
51
52 bool parseUuencoded();
53 bool parseYenc();
54 bool parseMultipart();
55 Headers::Generic *nextHeader( QByteArray &head );
56 void clearBodyMessage();
57
58 // This one returns the normal multipartContents for multipart contents, but returns
59 // a list with just bodyAsMessage in it for contents that are encapsulated messages.
60 // That makes it possible to handle encapsulated messages in a transparent way.
61 Content::List contents() const;
62
63 QByteArray head;
64 QByteArray body;
65 QByteArray frozenBody;
66 QByteArray defaultCS;
67 QByteArray preamble;
68 QByteArray epilogue;
69 Content *parent;
70
71 Content::List multipartContents;
72 MessagePtr bodyAsMessage;
73
74 Content* q_ptr;
75 Q_DECLARE_PUBLIC( Content )
76
77 bool forceDefaultCS : 1;
78 bool frozen : 1;
79};
80
81}
82
83//@endcond
84
85#endif
86