Annotation of parser3/src/types/pa_vform.h, revision 1.19
1.10 paf 1: /** @file
1.16 paf 2: Parser: @b form class decls.
1.10 paf 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.19 ! paf 8: $Id: pa_vform.h,v 1.18 2001/04/28 13:49:27 paf Exp $
1.1 paf 9: */
10:
11: #ifndef PA_VFORM_H
12: #define PA_VFORM_H
13:
1.19 ! paf 14: #include "classes.h"
1.8 paf 15: #include "pa_common.h"
1.17 paf 16:
17: extern Methoded *form_base_class;
1.1 paf 18:
1.4 paf 19: class Request;
20:
1.10 paf 21: /**
1.13 paf 22: derivates from VStateless_class so that :CLASS element referred to @a this.
1.10 paf 23:
24: and users could do such tricks:
25: @verbatim
26: ^rem{pass somebody something with elements}
27:
28: ^rem{this time that would be elements of a form}
1.12 paf 29: ^somebody[$form:CLASS]
1.10 paf 30:
31: ^rem{this time that would be elements of a table record}
32: $news[^table:sql[select * from news]]
33: ^somebody[^news.record[]]
34: @endverbatim
35: */
1.1 paf 36: class VForm : public VStateless_class {
37: public: // Value
38:
39: // all: for error reporting after fail(), etc
40: const char *type() const { return "form"; }
1.2 paf 41:
1.1 paf 42: // form: CLASS,BASE,method,field
43: Value *get_element(const String& aname) {
44: // $CLASS,$BASE,$method
45: if(Value *result=VStateless_class::get_element(aname))
46: return result;
47:
48: // $element
1.4 paf 49: return static_cast<Value *>(fields.get(aname));
1.1 paf 50: }
51:
52: public: // usage
53:
54: VForm(Pool& apool) : VStateless_class(apool, form_base_class),
1.4 paf 55: fields(apool) {
1.1 paf 56: }
57:
1.4 paf 58: // Hash& fields() { return ffields; }
1.1 paf 59:
1.15 paf 60: void fill_fields(Request& request);
1.7 paf 61:
1.6 paf 62: private:
63:
1.14 paf 64: char *strpart(const char *str, size_t len);
65: char *getAttributeValue(const char *data,char *attr,size_t len);
66: void UnescapeChars(char **sp, const char *cp, size_t len);
1.6 paf 67: void ParseGetFormInput(const char *query_string);
1.14 paf 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: