--- parser3/src/classes/classes.h 2003/01/29 09:16:14 1.23.2.3 +++ parser3/src/classes/classes.h 2024/11/10 21:00:00 1.45 @@ -1,14 +1,14 @@ /** @file Parser: @b Methoded class decl. - Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef CLASSES_H #define CLASSES_H -static const char* IDENT_CLASSES_H="$Date: 2003/01/29 09:16:14 $"; +#define IDENT_CLASSES_H "$Id: classes.h,v 1.45 2024/11/10 21:00:00 moko Exp $" // include @@ -20,10 +20,8 @@ static const char* IDENT_CLASSES_H="$Dat */ class Methoded: public VStateless_class { public: // Value - - override bool put_element(const String& /*name*/, Value * /*value*/, bool /*replace*/) { - return false; // fewer useless Exceptions - } + + override const char* type() const { return ftype; } public: // Methoded @@ -32,28 +30,26 @@ 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& ) {} /// 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_classPtr abase=VStateless_classPtrZero): - VStateless_class(ConstStringPtr(new String(aname)), abase) { - } + Methoded(const char* atype): ftype(atype){} void register_directly_used(Request& r); }; -DECLARE_OBJECT_PTR(Methoded) - /// all Methoded registered here in autogenerated classes.C -class Methoded_array: public Array { +class Methoded_array: public Array { public: Methoded_array(); @@ -66,6 +62,14 @@ public: // Methoded for_each-es void register_directly_used(Request& r); }; -extern Methoded_array methoded_array; +// globals + +Methoded_array& methoded_array(); + +// defines + +#define DECLARE_CLASS_VAR(name, self) \ + Methoded* name##_class=self; \ + Methoded* name##_init(){ if(!name##_class){ name##_class=self; } return name##_class; } #endif