Skip to content
Newer
Older
100644 95 lines (68 sloc) 2.26 KB
0eb72d5 @ciyam Source files for base library.
ciyam authored Jan 7, 2012
1 // Copyright (c) 2010
2 //
3 // CIYAM Pty. Ltd.
4 // ACN 093 704 539
5 //
6 // ALL RIGHTS RESERVED
7 //
8 // Permission to use this software for non-commercial purposes is hereby granted. Permission to
9 // distribute this software privately is granted provided that the source code is unaltered and
10 // complete or that any alterations and omissions have been first approved by CIYAM. Commercial
11 // usage of this software is not permitted without first obtaining a license for such a purpose
12 // from CIYAM. This software may not be publicly distributed unless written permission to do so
13 // has been obtained from CIYAM.
14
15 #ifndef MIME_H
16 # define MIME_H
17
18 # ifndef HAS_PRECOMPILED_STD_HEADERS
19 # include <string>
20 # endif
21
22 struct mime_part
23 {
24 std::string id;
25 std::string type;
26 std::string subtype;
27 std::string encoding;
28
29 std::string attribute;
30
31 std::string data;
32 };
33
34 class mime_decoder
35 {
36 public:
37 mime_decoder( const std::string& mime_data );
38 ~mime_decoder( );
39
40 std::string get_type( ) const;
41 std::string get_subtype( ) const;
42 std::string get_encoding( ) const;
43 std::string get_attribute( ) const;
44 std::string get_text_data( ) const;
45
46 bool has_child( );
47 mime_decoder& get_child( );
48
49 size_t num_parts( ) const;
50
51 mime_part& get_part( size_t num ) const;
52
53 private:
54 mime_decoder( bool is_child, const std::string& mime_data );
55
56 struct impl;
57 friend struct impl;
58
59 impl* p_impl;
60 };
61
62 class mime_encoder
63 {
64 public:
65 mime_encoder( const char* p_multi_part_subtype = 0,
66 const char* p_multi_part_extra_subtype = 0, int max_chars_per_line = 0 );
67
68 ~mime_encoder( );
69
70 void add_text( const std::string& text,
71 const char* p_charset = 0, const char* p_encoding = 0, bool is_for_smtp = true );
72
73 void add_html( const std::string& html,
74 const char* p_charset = 0, const char* p_encoding = 0, bool is_for_smtp = true );
75
76 void add_file( const std::string& file_name, const char* p_encoding = 0 );
77
78 void add_image( const std::string& file_name, const char* p_path_prefix = 0, const char* p_encoding = 0 );
79
80 void create_child( const char* p_multi_part_subtype = 0, const char* p_multi_part_extra_subtype = 0 );
81
82 mime_encoder& get_child( );
83
84 std::string get_data( );
85
86 private:
87 struct impl;
88 friend struct impl;
89
90 impl* p_impl;
91 };
92
93 #endif
94
Something went wrong with that request. Please try again.