Annotation of parser3/src/types/pa_vclass.h, revision 1.35
1.13 paf 1: /** @file
1.14 paf 2: Parser: @b class parser class decl.
1.13 paf 3:
1.23 paf 4: Copyright (c) 2001, 2002 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.35 ! paf 11: static const char* IDENT_VCLASS_H="$Date: 2002/08/13 15:19:40 $";
1.1 paf 12:
1.8 paf 13: #include "pa_vstateless_class.h"
1.1 paf 14: #include "pa_vjunction.h"
1.22 paf 15: #include "pa_vobject.h"
1.1 paf 16:
1.13 paf 17: /** stores
1.25 paf 18: - static fields: VClass::ffields
1.13 paf 19: */
1.8 paf 20: class VClass : public VStateless_class {
1.1 paf 21: public: // Value
22:
1.28 paf 23: const char *type() const { return name_cstr(); }
1.29 paf 24:
25: Value *as(const char *atype) {
26: if(Value *result=Value::as(atype))
27: return result;
28: else
29: return fbase?fbase->as(atype):0;
30: }
1.20 parser 31:
32: /// VClass: true
33: Value *as_expr_result(bool) { return NEW VBool(pool(), as_bool()); }
34: /// VClass: true
35: bool as_bool() const { return true; }
1.9 paf 36:
1.35 ! paf 37: /*override*/ Value *get_element(const String& aname, Value *aself, bool /*looking_down*/);
1.34 paf 38: /*override*/ bool put_element(const String& aname, Value *avalue, bool replace);
39: /*override*/ Value *create_new_value(Pool& );
1.1 paf 40:
41: public: // usage
42:
1.8 paf 43: VClass(Pool& apool) : VStateless_class(apool),
44: ffields(apool) {
1.1 paf 45: }
1.8 paf 46:
47: protected:
1.1 paf 48:
49: bool replace_field(const String& name, Value *value) {
50: return
51: (fbase && fbase->replace_field(name, value)) ||
52: ffields.put_replace(name, value);
53: }
1.4 paf 54:
1.25 paf 55: private: // self
1.1 paf 56:
57: Hash ffields;
1.25 paf 58:
1.1 paf 59: };
60:
61: #endif
E-mail: