--- parser3/src/classes/classes.h 2001/04/28 08:45:15 1.2 +++ parser3/src/classes/classes.h 2003/01/29 11:06:42 1.23.2.4 @@ -1,52 +1,71 @@ /** @file Parser: @b Methoded class decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) +*/ - Author: Alexander Petrosyan (http://design.ru/paf) +#ifndef CLASSES_H +#define CLASSES_H - $Id: classes.h,v 1.2 2001/04/28 08:45:15 paf Exp $ -*/ +static const char* IDENT_CLASSES_H="$Date: 2003/01/29 11:06:42 $"; -#ifndef PA_METHODED_H -#define PA_METHODED_H +// include #include "pa_vstateless_class.h" #include "pa_array.h" /** Pure virtual base for configurable Methoded descendants + @see Methoded_array */ -class Methoded : public VStateless_class { +class Methoded: public VStateless_class { public: // Value - /// all: for error reporting after fail(), etc - const char *type() const { return "m_base"; } + override bool put_element(const String& /*name*/, Value * /*value*/, bool /*replace*/) { + return false; // fewer useless Exceptions + } public: // Methoded + /** should Methoded_array::register_directly_used register this class in + Request::classes() or not. + if not - global variable with Methoded descendant + is used in VStateless_class parameter + */ virtual bool used_directly() =0; - virtual void configure(Request& r) {} + /// use this method to read parameters from root "auto.p"; access r.main_class + virtual void configure_admin(Request& ) {} + /// use this method to read parameters from 'MAIN' class; access r.main_class + virtual void configure_user(Request& ) {} + /// use it to construct static variables. check some static so that would be only ONCE! + virtual void construct_statics() {} public: // usage - Methoded(Pool& pool) : VStateless_class(pool) { + Methoded(const char *aname, VStateless_classPtr abase=VStateless_classPtr(0)): + VStateless_class(ConstStringPtr(new String(aname)), abase) { } void register_directly_used(Request& r); }; +DECLARE_OBJECT_PTR(Methoded) -class Methoded_array : public Array { +/// all Methoded registered here in autogenerated classes.C +class Methoded_array: public Array { public: - Methoded_array(Pool& pool); + Methoded_array(); public: // Methoded for_each-es - void configure(Request& r); + /// @see Methoded::configure_admin + void configure_admin(Request& r); + /// @see Methoded::configure_user + void configure_user(Request& r); + /// @see Methoded::register_directly_used void register_directly_used(Request& r); }; -extern Methoded_array *methoded_array; -void init_methoded_array(Pool& pool); +extern Methoded_array methoded_array; #endif