Annotation of parser3/src/types/pa_vform.h, revision 1.13
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.13 ! paf 8: $Id: pa_vform.h,v 1.12 2001/03/19 23:07:24 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.7 paf 59: void fill_fields(Request& request, int post_max_size);
60:
1.6 paf 61: private:
62:
63: char *strpart(const char *str, int len);
64: char *getAttributeValue(const char *data,char *attr,int len);
65: void UnescapeChars(char **sp, const char *cp, int len);
66: void ParseGetFormInput(const char *query_string);
67: void ParsePostFormInput(const char *content_type, int post_size, bool mime_mode);
68: void ParseFormInput(const char *data, int length);
69: void ParseMimeInput(const char *content_type, const char *data, int length);
70: void AppendFormEntry(
71: const char *name,
72: const char *value_ptr, int value_size=0,
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: