Annotation of parser3/src/types/pa_vform.h, revision 1.16.2.1
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.16.2.1! paf 8: $Id: pa_vform.h,v 1.16 2001/04/26 15:01:51 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"
1.16.2.1! paf 17:
! 18: extern Methoded *form_base_class;
1.1 paf 19:
1.4 paf 20: class Request;
21:
1.10 paf 22: /**
1.13 paf 23: derivates from VStateless_class so that :CLASS element referred to @a this.
1.10 paf 24:
25: and users could do such tricks:
26: @verbatim
27: ^rem{pass somebody something with elements}
28:
29: ^rem{this time that would be elements of a form}
1.12 paf 30: ^somebody[$form:CLASS]
1.10 paf 31:
32: ^rem{this time that would be elements of a table record}
33: $news[^table:sql[select * from news]]
34: ^somebody[^news.record[]]
35: @endverbatim
36: */
1.1 paf 37: class VForm : public VStateless_class {
38: public: // Value
39:
40: // all: for error reporting after fail(), etc
41: const char *type() const { return "form"; }
1.2 paf 42:
1.1 paf 43: // form: CLASS,BASE,method,field
44: Value *get_element(const String& aname) {
45: // $CLASS,$BASE,$method
46: if(Value *result=VStateless_class::get_element(aname))
47: return result;
48:
49: // $element
1.4 paf 50: return static_cast<Value *>(fields.get(aname));
1.1 paf 51: }
52:
53: public: // usage
54:
55: VForm(Pool& apool) : VStateless_class(apool, form_base_class),
1.4 paf 56: fields(apool) {
1.1 paf 57: }
58:
1.4 paf 59: // Hash& fields() { return ffields; }
1.1 paf 60:
1.15 paf 61: void fill_fields(Request& request);
1.7 paf 62:
1.6 paf 63: private:
64:
1.14 paf 65: char *strpart(const char *str, size_t len);
66: char *getAttributeValue(const char *data,char *attr,size_t len);
67: void UnescapeChars(char **sp, const char *cp, size_t len);
1.6 paf 68: void ParseGetFormInput(const char *query_string);
1.14 paf 69: void ParseFormInput(const char *data, size_t length);
70: void ParseMimeInput(const char *content_type, const char *data, size_t length);
1.6 paf 71: void AppendFormEntry(
72: const char *name,
1.14 paf 73: const char *value_ptr, size_t value_size=0,
1.6 paf 74: const char *file_name=0);
1.1 paf 75:
76: private:
77:
1.4 paf 78: Hash fields;
1.1 paf 79:
80: };
81:
82: #endif
E-mail: