--- parser3/src/classes/classes.h 2001/08/02 06:54:12 1.9 +++ parser3/src/classes/classes.h 2017/02/07 22:00:25 1.40 @@ -1,23 +1,28 @@ /** @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.9 2001/08/02 06:54:12 parser Exp $ + Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef CLASSES_H #define CLASSES_H +#define IDENT_CLASSES_H "$Id: classes.h,v 1.40 2017/02/07 22:00:25 moko Exp $" + +// 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 + + override const char* type() const { return ftype; } + public: // Methoded /** should Methoded_array::register_directly_used register this class in @@ -25,27 +30,28 @@ public: // Methoded if not - global variable with Methoded descendant is used in VStateless_class parameter */ - virtual bool used_directly() =0; + virtual bool used_directly() { return true; } /// 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) {} - /// use it to construct static variables. check some static so that would be only ONCE! - virtual void construct_statics() {} + virtual void configure_user(Request& ) {} + +private: + + const char* ftype; public: // usage - Methoded(Pool& pool) : VStateless_class(pool) { - } + Methoded(const char* atype): ftype(atype){} void register_directly_used(Request& r); }; /// 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 @@ -56,7 +62,13 @@ 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) \ + Methoded* name##_class=self #endif