Google
Web alhem.net

Form.h

Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 1999  Anders Hedstrom
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 // socket input buffer size
00040 #define IBUFSZ 10000
00041 
00042 namespace Cgi {
00043 
00049 typedef struct cgistruct
00050 {
00051 //      struct cgistruct *next; //!< Linked list ptr to next object
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         /* get names */
00085         bool getfirst(char *,short);
00086         bool getnext(char *,short);
00087 
00088         /* get names and values */
00089         bool getfirst(char *,short,char *,short);
00090         bool getnext(char *,short,char *,short);
00091 
00092         /* get value */
00093         int getvalue(const std::string&,char *,short);
00094         std::string getvalue(const std::string& );
00095         size_t getlength(char *);
00096 //      CGI *getbase() { return cgibase; }
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 //      CGI *cgibase;
00105         cgi_v m_cgi;
00106 //      CGI *current;
00107         cgi_v::iterator m_current;
00108         char *m_strBoundary;
00109         bool raw;
00110 };
00111 } // namespace
00112 
00113 #endif // _FORM_H

Generated for cgi++ by doxygen 1.3.7

Page, code, and content Copyright (C) 2004 by Anders Hedström