00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _SOCKETS_HttpdForm_H
00033 #define _SOCKETS_HttpdForm_H
00034
00035 #include "sockets-config.h"
00036 #include <string>
00037 #include <list>
00038
00039 #ifdef SOCKETS_NAMESPACE
00040 namespace SOCKETS_NAMESPACE {
00041 #endif
00042
00043
00044 class IFile;
00045
00048 class HttpdForm
00049 {
00055 struct CGI
00056 {
00057 CGI(const std::string& n,const std::string& v) : name(n),value(v) {}
00058 CGI(const std::string& n,const std::string& v,const std::string& p) : name(n),value(v),path(p) {}
00059 std::string name;
00060 std::string value;
00061 std::string path;
00062 };
00064 typedef std::list<CGI *> cgi_v;
00065
00066 public:
00072 HttpdForm(IFile *, const std::string& content_type, size_t content_length);
00079 HttpdForm(const std::string& query_string,size_t length);
00080 ~HttpdForm();
00081
00082 void EnableRaw(bool);
00083
00085 void strcpyval(std::string&,const char *) const;
00086
00087
00088 bool getfirst(std::string& n) const;
00089 bool getnext(std::string& n) const;
00090
00091
00092 bool getfirst(std::string& n,std::string& v) const;
00093 bool getnext(std::string& n,std::string& v) const;
00094
00095
00096 int getvalue(const std::string& ,std::string& ) const;
00097 std::string getvalue(const std::string& ) const;
00098 size_t getlength(const std::string& ) const;
00099 cgi_v& getbase();
00100
00101 const std::string& GetBoundary() const;
00102
00103 private:
00104 HttpdForm(const HttpdForm& ) {}
00105 HttpdForm& operator=(const HttpdForm& ) { return *this; }
00106 cgi_v m_cgi;
00107 mutable cgi_v::const_iterator m_current;
00108 std::string m_strBoundary;
00109 bool raw;
00110 };
00111
00112
00113 #ifdef SOCKETS_NAMESPACE
00114 }
00115 #endif
00116
00117 #endif // _SOCKETS_HttpdForm_H