--- parser3/src/classes/classes.h 2002/08/15 13:49:15 1.22 +++ parser3/src/classes/classes.h 2016/04/06 16:08:19 1.38 @@ -1,13 +1,16 @@ /** @file Parser: @b Methoded class decl. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ + #ifndef CLASSES_H #define CLASSES_H -static const char* IDENT_CLASSES_H="$Date: 2002/08/15 13:49:15 $"; +#define IDENT_CLASSES_H "$Id: classes.h,v 1.38 2016/04/06 16:08:19 moko Exp $" + +// include #include "pa_vstateless_class.h" #include "pa_array.h" @@ -15,12 +18,10 @@ static const char* IDENT_CLASSES_H="$Dat /** Pure virtual base for configurable Methoded descendants @see Methoded_array */ -class Methoded : public VStateless_class { +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 @@ -29,7 +30,7 @@ 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 @@ -37,20 +38,22 @@ public: // Methoded /// 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(Pool& apool, const char *aname, VStateless_class *abase=0) : - VStateless_class(apool, new(apool) String(apool, aname), abase) { - } + 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 @@ -61,7 +64,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