Annotation of parser3/src/types/pa_vclass.h, revision 1.48.2.2
1.13 paf 1: /** @file
1.14 paf 2: Parser: @b class parser class decl.
1.13 paf 3:
1.43 paf 4: Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com)
1.24 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
8: #ifndef PA_VCLASS_H
9: #define PA_VCLASS_H
1.26 paf 10:
1.48.2.2! paf 11: static const char * const IDENT_VCLASS_H="$Date: 2005/07/27 07:35:51 $";
1.40 paf 12:
13: // includes
1.1 paf 14:
1.8 paf 15: #include "pa_vstateless_class.h"
1.1 paf 16: #include "pa_vjunction.h"
1.22 paf 17: #include "pa_vobject.h"
1.1 paf 18:
1.13 paf 19: /** stores
1.25 paf 20: - static fields: VClass::ffields
1.13 paf 21: */
1.40 paf 22: class VClass: public VStateless_class {
1.1 paf 23: public: // Value
24:
1.40 paf 25: const char* type() const { return name_cstr(); }
1.29 paf 26:
1.40 paf 27: override Value* as(const char* atype, bool looking_up);
1.20 parser 28:
29: /// VClass: true
1.40 paf 30: override Value& as_expr_result(bool) { return *new VBool(as_bool()); }
1.20 parser 31: /// VClass: true
1.40 paf 32: override bool as_bool() const { return true; }
1.1 paf 33:
1.40 paf 34: override Value* get_element(const String& aname, Value& aself, bool /*looking_up*/);
1.48.2.2! paf 35: override const Junction* put_element(Value& self, const String& name, Value* value, bool replace);
1.48.2.1 paf 36: override Value* create_new_value(Pool& apool, HashStringValue& afields);
1.8 paf 37:
1.47 paf 38: public: // VStateless_class
1.46 paf 39:
1.47 paf 40: /// override to pre-cache property accessors into fields
41: override void add_method(const String& name, Method& method);
1.46 paf 42:
1.8 paf 43: protected:
1.1 paf 44:
1.40 paf 45: bool replace_field(const String& name, Value* value) {
1.1 paf 46: return
47: (fbase && fbase->replace_field(name, value)) ||
1.48 paf 48: ffields.put_replaced(name, value);
1.1 paf 49: }
1.47 paf 50:
51: private:
52:
53: Property& add_property(const String& aname);
1.4 paf 54:
1.25 paf 55: private: // self
1.1 paf 56:
1.40 paf 57: HashStringValue ffields;
1.25 paf 58:
1.1 paf 59: };
60:
61: #endif
E-mail: