Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  

contenttype.h

00001 /***************************************************************************
00002     copyright            : (C) 2002-2008 by Stefano Barbato
00003     email                : stefano@codesink.org
00004 
00005     $Id: contenttype.h,v 1.13 2008-10-07 11:06:25 tat Exp $
00006  ***************************************************************************/
00007 #ifndef _MIMETIC_CONTENT_TYPE_H_
00008 #define _MIMETIC_CONTENT_TYPE_H_
00009 #include <string>
00010 #include <mimetic/strutils.h>
00011 #include <mimetic/rfc822/fieldvalue.h>
00012 #include <mimetic/fieldparam.h>
00013 
00014 namespace mimetic
00015 {
00016 
00017 /// Content-Type field value
00018 class ContentType: public FieldValue
00019 {
00020 public:
00021     static const char label[];
00022     struct Boundary
00023     {
00024         Boundary();
00025         operator const std::string&() const;
00026     private:
00027         std::string m_boundary;
00028         static std::string ms_common_boundary;
00029         static int ms_i;
00030     };
00031     typedef FieldParam Param;
00032     typedef FieldParamList ParamList;
00033 public:
00034     ContentType();
00035     ContentType(const char*);
00036     ContentType(const std::string&);
00037     ContentType(const std::string&, const std::string&);
00038 
00039     void set(const std::string&);
00040     void set(const std::string&, const std::string&);
00041 
00042     bool isMultipart() const;
00043 
00044     const istring& type() const;
00045     void type(const std::string&);
00046 
00047     void subtype(const std::string&);
00048     const istring& subtype() const;
00049 
00050     const ParamList& paramList() const;
00051     ParamList& paramList();
00052 
00053     const std::string& param(const std::string&) const;
00054     void param(const std::string&, const std::string&);
00055 
00056     std::string str() const;
00057 protected:
00058     FieldValue* clone() const;
00059 private:
00060     istring m_type, m_subtype;
00061     ParamList m_paramList;
00062 };
00063 
00064 }
00065 
00066 #endif