summaryrefslogtreecommitdiff
path: root/icetray/icetray/mimeImpl.h
blob: 235d7478285762e27b2c0f5ad3bb307e08b3fdd6 (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
48
49
50
51
52
53
#ifndef ICETRAY_MIME_IMPL_H
#define ICETRAY_MIME_IMPL_H

#include <mime.h>
#include <visibility.h>

namespace IceTray::Mime {
	class DLL_PUBLIC PartHelper {
		protected:
			static void writeHeaders(const Headers & headers, const StreamPtr & ms);
	};

	class DLL_PUBLIC TextPart : public BasicSinglePart, PartHelper {
		public:
			TextPart(const Headers &, const std::string &, const std::string &);

			void write(const StreamPtr & ms, Ice::Int depth) const override;

			static void quotedPrintable(const std::string_view & input, FILE * ms,
					const size_t maxWidth = 74);

			const std::string payload;
	};

	class DLL_PUBLIC BinaryViewPart : public BasicSinglePart, PartHelper {
		public:
			BinaryViewPart(const Headers &, const std::string &, const std::basic_string_view<uint8_t> &);

			void write(const StreamPtr & ms, Ice::Int depth) const override;

			static void base64(const std::basic_string_view<uint8_t> & input, FILE * ms,
					const size_t maxWidth = 76);

			std::basic_string_view<uint8_t> payload;
	};

	class DLL_PUBLIC BinaryCopyPart : public BinaryViewPart {
		public:
			BinaryCopyPart(const Headers &, const std::string &, std::vector<uint8_t>);

			std::vector<uint8_t> payload;
	};

	class DLL_PUBLIC MultiPart : public BasicMultiPart, PartHelper {
		public:
			MultiPart(const Headers &, const std::string &, const Parts &);

			void write(const StreamPtr & ms, Ice::Int depth) const override;
	};
}

#endif