00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _FORM_H
00026 #define _FORM_H
00027
00028 #include <stdio.h>
00029 #ifdef _WIN32
00030 #define STL_USING_STRING
00031 #define STL_USING_LIST
00032 #include <stlhelper.h>
00033 #else
00034 #include <string>
00035 #include <list>
00036 #endif
00037
00038
00039
00040 #define IBUFSZ 10000
00041
00042 namespace Cgi {
00043
00049 typedef struct cgistruct
00050 {
00051
00052 char *name;
00053 char *value;
00054 char *path;
00055 } CGI;
00056 typedef std::list<CGI *> cgi_v;
00057
00058
00060
00061 class Form
00062 {
00063 public:
00069 Form(FILE * = stdin);
00076 Form(char *query_string,int length);
00077
00078 ~Form();
00079
00080 void EnableRaw(bool);
00081
00082 void strcpyval(char *,char *,size_t);
00083
00084
00085 bool getfirst(char *,short);
00086 bool getnext(char *,short);
00087
00088
00089 bool getfirst(char *,short,char *,short);
00090 bool getnext(char *,short,char *,short);
00091
00092
00093 int getvalue(const std::string&,char *,short);
00094 std::string getvalue(const std::string& );
00095 size_t getlength(char *);
00096
00097 cgi_v& getbase() { return m_cgi; }
00098
00099 char *GetBoundary();
00100
00101 private:
00102 Form(const Form& ) {}
00103 Form& operator=(const Form& ) { return *this; }
00104
00105 cgi_v m_cgi;
00106
00107 cgi_v::iterator m_current;
00108 char *m_strBoundary;
00109 bool raw;
00110 };
00111 }
00112
00113 #endif // _FORM_H