|
|
| version 1.1, 2001/03/13 17:54:12 | version 1.4, 2001/04/28 08:43:47 |
|---|---|
| Line 1 | Line 1 |
| /* | /** @file |
| Parser | Parser: @b form parser class. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | $Id$ |
| */ | */ |
| #include "classes.h" | |
| #include "pa_request.h" | #include "pa_request.h" |
| #include "_form.h" | |
| #include "pa_vform.h" | #include "pa_vform.h" |
| // global var | // defines |
| #define FORM_CLASS_NAME "form" | |
| // class | |
| VStateless_class *form_base_class; | class MForm : public Methoded { |
| public: | |
| MForm(Pool& pool); | |
| bool used_directly() { return false; } | |
| }; | |
| // methods | // methods |
| static void _fields(Request& r, const String&, Array *params) { | // constructor |
| Pool& pool=r.pool(); | |
| VForm *vform=static_cast<VForm *>(r.self); | MForm::MForm(Pool& apool) : Methoded(apool) { |
| r.write_no_lang(*new(pool) VHash(pool, &vform->fields())); | set_name(*NEW String(pool(), FORM_CLASS_NAME)); |
| } | } |
| // initialize | // global variable |
| Methoded *form_base_class; | |
| // creator | |
| void initialize_form_base_class(Pool& pool, VStateless_class& vclass) { | Methoded *MForm_create(Pool& pool) { |
| // ^form:fields[] | return form_base_class=new(pool) MForm(pool); |
| vclass.add_native_method("fields", _fields, 0, 0); | |
| } | } |