--- parser3/src/classes/classes.h 2001/05/17 18:26:22 1.8 +++ parser3/src/classes/classes.h 2009/08/08 13:30:20 1.32 @@ -1,23 +1,24 @@ /** @file Parser: @b Methoded class decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: classes.h,v 1.8 2001/05/17 18:26:22 parser Exp $ + Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef CLASSES_H #define CLASSES_H +static const char * const IDENT_CLASSES_H="$Date: 2009/08/08 13:30:20 $"; + +// 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: // Methoded /** should Methoded_array::register_directly_used register this class in @@ -27,13 +28,16 @@ public: // Methoded */ virtual bool used_directly() =0; /// use this method to read parameters from root "auto.p"; access r.main_class - virtual void configure_admin(Request& r) {} + virtual void configure_admin(Request& ) {} /// use this method to read parameters from 'MAIN' class; access r.main_class - virtual void configure_user(Request& r) {} + 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_class* abase=0): + VStateless_class(new String(aname), abase) { } void register_directly_used(Request& r); @@ -41,9 +45,9 @@ public: // usage }; /// all Methoded registered here in autogenerated classes.C -class Methoded_array : public Array { +class Methoded_array: public Array { public: - Methoded_array(Pool& pool); + Methoded_array(); public: // Methoded for_each-es /// @see Methoded::configure_admin @@ -54,7 +58,14 @@ public: // Methoded for_each-es void register_directly_used(Request& r); }; -extern Methoded_array *methoded_array; -void init_methoded_array(Pool& pool); +// globals + +Methoded_array& methoded_array(); + +// defines + +#define DECLARE_CLASS_VAR(name, self, base) \ + Methoded* name##_class=self; \ + Methoded* name##_base_class=base #endif