Annotation of parser3/src/types/pa_vform.h, revision 1.14

1.10      paf         1: /** @file
                      2:        Parser: form class decls.
                      3: 
1.1       paf         4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.10      paf         5: 
1.1       paf         6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.14    ! paf         8:        $Id: pa_vform.h,v 1.13 2001/03/20 06:45:20 paf Exp $
1.1       paf         9: */
                     10: 
                     11: #ifndef PA_VFORM_H
                     12: #define PA_VFORM_H
                     13: 
1.8       paf        14: #include "pa_common.h"
1.1       paf        15: #include "pa_vstateless_class.h"
                     16: #include "_form.h"
                     17: 
1.4       paf        18: class Request;
                     19: 
1.10      paf        20: /**
1.13      paf        21:        derivates from VStateless_class so that :CLASS element referred to @a this.
1.10      paf        22: 
                     23:        and users could do such tricks:
                     24:        @verbatim
                     25:                ^rem{pass somebody something with elements}
                     26: 
                     27:                ^rem{this time that would be elements of a form}
1.12      paf        28:                ^somebody[$form:CLASS]
1.10      paf        29: 
                     30:                ^rem{this time that would be elements of a table record}
                     31:                $news[^table:sql[select * from news]]
                     32:                ^somebody[^news.record[]]
                     33:        @endverbatim
                     34: */
1.1       paf        35: class VForm : public VStateless_class {
                     36: public: // Value
                     37:        
                     38:        // all: for error reporting after fail(), etc
                     39:        const char *type() const { return "form"; }
1.2       paf        40: 
1.1       paf        41:        // form: CLASS,BASE,method,field
                     42:        Value *get_element(const String& aname) {
                     43:                // $CLASS,$BASE,$method
                     44:                if(Value *result=VStateless_class::get_element(aname))
                     45:                        return result;
                     46: 
                     47:                // $element
1.4       paf        48:                return static_cast<Value *>(fields.get(aname));
1.1       paf        49:        }
                     50: 
                     51: public: // usage
                     52: 
                     53:        VForm(Pool& apool) : VStateless_class(apool, form_base_class),
1.4       paf        54:                fields(apool) {
1.1       paf        55:        }
                     56: 
1.4       paf        57: //     Hash& fields() { return ffields; }
1.1       paf        58: 
1.14    ! paf        59:        void fill_fields(Request& request, size_t post_max_size);
1.7       paf        60: 
1.6       paf        61: private:
                     62: 
1.14    ! paf        63:        char *strpart(const char *str, size_t len);
        !            64:        char *getAttributeValue(const char *data,char *attr,size_t len);
        !            65:        void UnescapeChars(char **sp, const char *cp, size_t len);
1.6       paf        66:        void ParseGetFormInput(const char *query_string);
1.14    ! paf        67:        void ParsePostFormInput(const char *content_type, size_t post_size, bool mime_mode);
        !            68:        void ParseFormInput(const char *data, size_t length);
        !            69:        void ParseMimeInput(const char *content_type, const char *data, size_t length);
1.6       paf        70:        void AppendFormEntry(
                     71:                const char *name, 
1.14    ! paf        72:                const char *value_ptr, size_t value_size=0,
1.6       paf        73:                const char *file_name=0);
1.1       paf        74: 
                     75: private:
                     76: 
1.4       paf        77:        Hash fields;
1.1       paf        78: 
                     79: };
                     80: 
                     81: #endif

E-mail: