aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/rfc822/MCAttachment.h
blob: 0fc4fc98a61ee4d9a5c4454ab04e6cc320d16d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __MAILCORE_MCATTACHMENT_H_

#define __MAILCORE_MCATTACHMENT_H_

#include <mailcore/MCBaseTypes.h>
#include <mailcore/MCAbstractPart.h>
#include <mailcore/MCAbstractMultipart.h>
#include <mailcore/MCMessageConstants.h>

namespace mailcore {
	
	class MessagePart;
	
	class Attachment : public AbstractPart {
	private:
		Data * mData;
		void init();
		static void fillMultipartSubAttachments(AbstractMultipart * multipart, struct mailmime * mime);
		static AbstractPart * attachmentsWithMIMEWithMain(struct mailmime * mime, bool isMain);
		static Attachment * attachmentWithSingleMIME(struct mailmime * mime);
		static MessagePart * attachmentWithMessageMIME(struct mailmime * mime);
		static Encoding encodingForMIMEEncoding(struct mailmime_mechanism * mechanism, int defaultMimeEncoding);

	public:
		static String * mimeTypeForFilename(String * filename);
		static Attachment * attachmentWithContentOfFile(String * filename);
		static Attachment * attachmentWithHTMLString(String * htmlString);
		static Attachment * attachmentWithRFC822Message(Data * messageData);
		static Attachment * attachmentWithText(String * text);
		
		Attachment();
		Attachment(Attachment * other);
		virtual ~Attachment();
		
		virtual String * description();
		//virtual String * className();
		virtual Object * copy();
		
		virtual void setData(Data * data);
		virtual Data * data();
		
		static AbstractPart * attachmentsWithMIME(struct mailmime * mime);
	};
	
}

#endif