Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
contenttype.h
1 /***************************************************************************
2  copyright : (C) 2002-2008 by Stefano Barbato
3  email : stefano@codesink.org
4 
5  $Id: contenttype.h,v 1.13 2008-10-07 11:06:25 tat Exp $
6  ***************************************************************************/
7 #ifndef _MIMETIC_CONTENT_TYPE_H_
8 #define _MIMETIC_CONTENT_TYPE_H_
9 #include <string>
10 #include <mimetic/strutils.h>
11 #include <mimetic/rfc822/fieldvalue.h>
12 #include <mimetic/fieldparam.h>
13 
14 namespace mimetic
15 {
16 
17 /// Content-Type field value
18 class ContentType: public FieldValue
19 {
20 public:
21  static const char label[];
22  struct Boundary
23  {
24  Boundary();
25  operator const std::string&() const;
26  private:
27  std::string m_boundary;
28  static std::string ms_common_boundary;
29  static int ms_i;
30  };
31  typedef FieldParam Param;
32  typedef FieldParamList ParamList;
33 public:
34  ContentType();
35  ContentType(const char*);
36  ContentType(const std::string&);
37  ContentType(const std::string&, const std::string&);
38 
39  void set(const std::string&);
40  void set(const std::string&, const std::string&);
41 
42  bool isMultipart() const;
43 
44  const istring& type() const;
45  void type(const std::string&);
46 
47  void subtype(const std::string&);
48  const istring& subtype() const;
49 
50  const ParamList& paramList() const;
51  ParamList& paramList();
52 
53  const std::string& param(const std::string&) const;
54  void param(const std::string&, const std::string&);
55 
56  std::string str() const;
57 protected:
58  FieldValue* clone() const;
59 private:
60  istring m_type, m_subtype;
61  ParamList m_paramList;
62 };
63 
64 }
65 
66 #endif
Field param.
Definition: fieldparam.h:18
Content-Type field value.
Definition: contenttype.h:18
Value of an header field (base class)
Definition: fieldvalue.h:17
Definition: body.h:17