00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _MIMETIC_CONTENT_TYPE_H_
00017 #define _MIMETIC_CONTENT_TYPE_H_
00018 #include <string>
00019 #include <mimetic/strutils.h>
00020 #include <mimetic/rfc822/fieldvalue.h>
00021 #include <mimetic/fieldparam.h>
00022
00023 namespace mimetic
00024 {
00025
00026
00027 class ContentType: public FieldValue
00028 {
00029 public:
00030 static const char label[];
00031 struct Boundary
00032 {
00033 Boundary();
00034 operator const std::string&() const;
00035 private:
00036 std::string m_boundary;
00037 static std::string ms_common_boundary;
00038 static int ms_i;
00039 };
00040 typedef FieldParam Param;
00041 typedef FieldParamList ParamList;
00042 public:
00043 ContentType();
00044 ContentType(const char*);
00045 ContentType(const std::string&);
00046 ContentType(const std::string&, const std::string&);
00047
00048 void set(const std::string&);
00049 void set(const std::string&, const std::string&);
00050
00051 bool isMultipart() const;
00052
00053 const istring& type() const;
00054 void type(const std::string&);
00055
00056 void subtype(const std::string&);
00057 const istring& subtype() const;
00058
00059 const ParamList& paramList() const;
00060 ParamList& paramList();
00061
00062 const std::string& param(const std::string&) const;
00063 void param(const std::string&, const std::string&);
00064
00065 std::string str() const;
00066 protected:
00067 FieldValue* clone() const;
00068 private:
00069 istring m_type, m_subtype;
00070 ParamList m_paramList;
00071 };
00072
00073 }
00074
00075 #endif