--- parser3/src/classes/classes.h 2012/03/16 09:24:06 1.34 +++ parser3/src/classes/classes.h 2026/05/28 14:33:49 1.49 @@ -1,14 +1,14 @@ /** @file Parser: @b Methoded class decl. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef CLASSES_H #define CLASSES_H -#define IDENT_CLASSES_H "$Id: classes.h,v 1.34 2012/03/16 09:24:06 moko Exp $" +#define IDENT_CLASSES_H "$Id: classes.h,v 1.49 2026/05/28 14:33:49 moko Exp $" // include @@ -19,6 +19,10 @@ @see Methoded_array */ 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 @@ -29,16 +33,14 @@ public: // Methoded 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& ) {} - /// 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() {} + +private: + + const char* ftype; public: // usage - Methoded(const char* aname, VStateless_class* abase=0): - VStateless_class(new String(aname), abase) { - } + Methoded(const char* atype): ftype(atype){} void register_directly_used(Request& r); @@ -64,8 +66,12 @@ Methoded_array& methoded_array(); // defines -#define DECLARE_CLASS_VAR(name, self, base) \ - Methoded* name##_class=self; \ - Methoded* name##_base_class=base +#define DECLARE_CLASS_VAR(name, self) \ + Methoded* name##_class=NULL; \ + Methoded* name##_instance(){ if(!name##_class){ name##_class=self; } return name##_class; } + +#define ADD_CLASS_VAR(name) \ + extern Methoded* name##_instance(); \ + *this+=name##_instance(); #endif