Annotation of parser3/src/types/pa_vobject.h, revision 1.7
1.6 paf 1: /** @file
1.7 ! paf 2: Parser: @b object class decl.
! 3:
1.1 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.7 ! paf 5:
1.2 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1 paf 7:
1.7 ! paf 8: $Id: pa_vobject.h,v 1.6 2001/04/26 14:55:35 paf Exp $
1.1 paf 9: */
10:
11: #ifndef PA_VOBJECT_H
12: #define PA_VOBJECT_H
13:
14: #include "pa_valiased.h"
15: #include "pa_vjunction.h"
16: #include "pa_vclass.h"
1.4 paf 17: #include "pa_vstateless_object.h"
1.1 paf 18:
1.6 paf 19:
20: /** parser class instance,
21: stores fields VObject::ffields (dynamic, not static, which are stored in class).
22: */
1.4 paf 23: class VObject : public VStateless_object {
1.1 paf 24: public: // Value
25:
1.6 paf 26: /// all: for error reporting after fail(), etc
1.1 paf 27: const char *type() const { return "object"; }
28:
1.6 paf 29: /// VObject : (field)=value;(CLASS)=vclass;(method)=method_ref
1.1 paf 30: Value *get_element(const String& name) {
1.3 paf 31: // $CLASS,$BASE,$method
1.4 paf 32: if(Value *result=VStateless_object::get_element(name))
1.3 paf 33: return result;
1.1 paf 34: // $field=ffields.field
35: return static_cast<Value *>(ffields.get(name));
36: }
37:
1.6 paf 38: /// VObject : (field)=value
1.1 paf 39: void put_element(const String& name, Value *value) {
40: // speed1:
41: // will not check for '$CLASS(subst)' trick
42: // will hope that user ain't THAT self-hating person
43: // speed2:
44: // will not check for '$method_name(subst)' trick
45: // -same-
46:
47: ffields.put(name, value);
48: }
49:
50: public: // creation
51:
1.5 paf 52: VObject(Pool& apool, VStateless_class& aclass_real) :
53: VStateless_object(apool, aclass_real),
54:
1.1 paf 55: ffields(apool) {
56: }
57:
58: private:
59:
60: Hash ffields;
61: };
62:
63: #endif
E-mail: