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

1.10      paf         1: /** @file
1.16      paf         2:        Parser: @b form class decls.
1.10      paf         3: 
1.50      paf         4:        Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
1.33      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: */
                      7: 
                      8: #ifndef PA_VFORM_H
                      9: #define PA_VFORM_H
1.36      paf        10: 
1.52    ! misha      11: static const char * const IDENT_VFORM_H="$Date: 2007/04/17 18:13:16 $";
1.46      paf        12: 
                     13: // includes
1.1       paf        14: 
1.19      paf        15: #include "classes.h"
1.8       paf        16: #include "pa_common.h"
1.46      paf        17: #include "pa_value.h"
                     18: 
                     19: // defines
1.17      paf        20: 
1.22      parser     21: #define FORM_FIELDS_ELEMENT_NAME "fields"
1.24      parser     22: #define FORM_TABLES_ELEMENT_NAME "tables"
1.42      paf        23: #define FORM_IMAP_ELEMENT_NAME "imap"
1.51      misha      24: #define FORM_FILES_ELEMENT_NAME "files"
1.22      parser     25: 
1.46      paf        26: // forwards
                     27: 
                     28: class Request_info;
                     29: class Request_charsets;
1.4       paf        30: 
1.10      paf        31: /**
1.13      paf        32:        derivates from VStateless_class so that :CLASS element referred to @a this.
1.10      paf        33: 
                     34:        and users could do such tricks:
                     35:        @verbatim
                     36:                ^rem{pass somebody something with elements}
                     37: 
                     38:                ^rem{this time that would be elements of a form}
1.12      paf        39:                ^somebody[$form:CLASS]
1.10      paf        40: 
                     41:                ^rem{this time that would be elements of a table record}
                     42:                $news[^table:sql[select * from news]]
                     43:                ^somebody[^news.record[]]
                     44:        @endverbatim
                     45: */
1.46      paf        46: class VForm: public VStateless_class {
1.1       paf        47: public: // Value
                     48:        
1.46      paf        49:        const char* type() const { return "form"; }
1.24      parser     50:        
1.35      paf        51:        // form: CLASS,method,field,tables field
1.46      paf        52:        Value* get_element(const String& aname, Value& aself, bool /*looking_up*/);
1.1       paf        53: 
                     54: public: // usage
                     55: 
1.48      paf        56:        VForm(Request_charsets& acharsets, Request_info& arequest_info);
1.31      paf        57:        
1.6       paf        58: private:
                     59: 
1.48      paf        60:        Request_charsets& fcharsets;
                     61:        Request_info& frequest_info;
1.46      paf        62: 
                     63:        char *getAttributeValue(const char* data,char *attr,size_t len);
                     64:        void UnescapeChars(char **sp, const char* cp, size_t len);
                     65:        void ParseGetFormInput(const char* query_string, size_t length);
                     66:        void ParseFormInput(const char* data, size_t length);
                     67:        void ParseMimeInput(char *content_type, const char* data, size_t length);
1.6       paf        68:        void AppendFormEntry(
1.46      paf        69:                const char* cname_cstr, 
1.51      misha      70:                const char* raw_cvalue_ptr, const size_t raw_cvalue_size);
                     71:        void AppendFormFileEntry(
                     72:                const char* cname_cstr, 
1.46      paf        73:                const char* raw_cvalue_ptr, const size_t raw_cvalue_size,
1.51      misha      74:                const char* file_name_cstr);
1.1       paf        75: 
1.51      misha      76:        bool should_refill_fields_tables_and_files();
                     77:        void refill_fields_tables_and_files();
1.48      paf        78: 
1.1       paf        79: private:
                     80: 
1.48      paf        81:        Charset* filled_source;
                     82:        Charset* filled_client;
1.52    ! misha      83:        Charset* filled_post; // charset which was specified in content-type in incoming POST
1.46      paf        84:        HashStringValue fields;
                     85:        HashStringValue tables;
1.51      misha      86:        HashStringValue files;
1.46      paf        87:        HashStringValue imap;
1.30      paf        88: 
                     89: private:
                     90: 
1.46      paf        91:        String::C transcode(const char* client, size_t client_size);
1.1       paf        92: 
                     93: };
                     94: 
                     95: #endif

E-mail: