HTTPPart.h

00001 // $Id: HTTPPart.h 21 2010-09-05 04:18:17Z cschwarz1 $
00002 
00003 #ifndef BASE_HTTP_HTTPPART_H
00004 #define BASE_HTTP_HTTPPART_H
00005 
00006 #include <map>
00007 #include "libppbase/base/MemFile.h"
00008 
00009 namespace base_http {
00011 
00015     class PPBASE_HTTP_EXPORT HTTPPart: public base::MemFile {
00016     public:
00018 
00022         HTTPPart(bool mime, size_t memlimit = 1048576);
00023 
00025 
00029         bool getContentType(base::String &type);
00030 
00032 
00038         bool getContentType(base::String &type, base::String &subtype, std::map<base::String, base::String> *args = NULL);
00039 
00041 
00045         bool getFileName(base::String &filename);
00046 
00048 
00053         bool getHeader(const base::String &name, base::String &hret);
00054 
00056 
00060         bool getID(base::String &idret);
00061 
00063 
00066         const std::map<base::String, base::String> *getHeaders() const;
00067 
00069 
00072         bool isMIME() const;
00073 
00075 
00081         void parseHeader(const base::String &header, char delim, base::String &token, std::map<base::String, base::String> *args = NULL);
00082 
00084 
00087         void removeHeader(const base::String &name);
00088 
00090 
00094         void setHeader(const base::String &name, const base::String &value);
00095 
00097 
00100         void setMIME(bool mime = true);
00101 
00103 
00106         size_t size() const;
00107 
00108     private:
00109         std::map<base::String, base::String> _headers;   
00110         bool                               _mime;      
00111     };
00112 }
00113 
00114 #endif