1 //
2 // VMime library (http://www.vmime.org)
3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 3 of
8 // the License, or (at your option) any later version.
9 //
10 // This program 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 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Linking this library statically or dynamically with other modules is making
20 // a combined work based on this library.  Thus, the terms and conditions of
21 // the GNU General Public License cover the whole combination.
22 //
23 
24 #ifndef VMIME_CONTENTDISPOSITION_HPP_INCLUDED
25 #define VMIME_CONTENTDISPOSITION_HPP_INCLUDED
26 
27 
28 #include "vmime/base.hpp"
29 #include "vmime/headerFieldValue.hpp"
30 
31 
32 namespace vmime
33 {
34 
35 
36 /** Content disposition (basic type).
37   */
38 
39 class VMIME_EXPORT contentDisposition : public headerFieldValue
40 {
41 public:
42 
43 	contentDisposition();
44 	contentDisposition(const string& name);
45 	contentDisposition(const contentDisposition& disp);
46 
47 
48 	/** Return the content disposition type.
49 	  * See the constants in vmime::dispositionTypes.
50 	  *
51 	  * @return name of the disposition type (eg. "inline")
52 	  */
53 	const string& getName() const;
54 
55 	/** Set the content disposition type.
56 	  * See the constants in vmime::dispositionTypes.
57 	  *
58 	  * @param name name of the disposition type
59 	  */
60 	void setName(const string& name);
61 
62 	shared_ptr <component> clone() const;
63 	void copyFrom(const component& other);
64 	contentDisposition& operator=(const contentDisposition& other);
65 
66 	const std::vector <shared_ptr <component> > getChildComponents();
67 
68 
69 	contentDisposition& operator=(const string& name);
70 
71 	bool operator==(const contentDisposition& value) const;
72 	bool operator!=(const contentDisposition& value) const;
73 
74 private:
75 
76 	string m_name;
77 
78 protected:
79 
80 	// Component parsing & assembling
81 	void parseImpl
82 		(const parsingContext& ctx,
83 		 const string& buffer,
84 		 const size_t position,
85 		 const size_t end,
86 		 size_t* newPosition = NULL);
87 
88 	void generateImpl
89 		(const generationContext& ctx,
90 		 utility::outputStream& os,
91 		 const size_t curLinePos = 0,
92 		 size_t* newLinePos = NULL) const;
93 };
94 
95 
96 } // vmime
97 
98 
99 #endif // VMIME_CONTENTDISPOSITION_HPP_INCLUDED
100