Annotation of parser3/src/types/pa_vobject.h, revision 1.3

1.1       paf         1: /*
                      2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.2       paf         4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1       paf         5: 
1.3     ! paf         6:        $Id: pa_vobject.h,v 1.2 2001/03/11 08:16:38 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #ifndef PA_VOBJECT_H
                     10: #define PA_VOBJECT_H
                     11: 
                     12: #include "pa_valiased.h"
                     13: #include "pa_vjunction.h"
                     14: #include "pa_vclass.h"
1.3     ! paf        15: #include "pa_vobject_base.h"
1.1       paf        16: 
1.3     ! paf        17: class VObject : public VObject_base {
1.1       paf        18: public: // Value
                     19:        
                     20:        // all: for error reporting after fail(), etc
                     21:        const char *type() const { return "object"; }
                     22: 
                     23:        // object_instance: (field)=value;(CLASS)=vclass;(method)=method_ref
                     24:        Value *get_element(const String& name) {
1.3     ! paf        25:                // $CLASS,$BASE,$method
        !            26:                if(Value *result=VObject_base::get_element(name))
        !            27:                        return result;
1.1       paf        28:                // $field=ffields.field
                     29:                return static_cast<Value *>(ffields.get(name));
                     30:        }
                     31: 
                     32:        // object_instance: (field)=value
                     33:        void put_element(const String& name, Value *value) {
                     34:                // speed1:
                     35:                //   will not check for '$CLASS(subst)' trick
                     36:                //   will hope that user ain't THAT self-hating person
                     37:                // speed2:
                     38:                //   will not check for '$method_name(subst)' trick
                     39:                //   -same-
                     40: 
                     41:                ffields.put(name, value);
                     42:        }
                     43: 
                     44: public: // creation
                     45: 
1.3     ! paf        46:        VObject(Pool& apool, VClass& aclass_real) : VObject_base(apool, aclass_real), 
1.1       paf        47:                ffields(apool) {
                     48:        }
                     49: 
                     50: private:
                     51: 
                     52:        Hash ffields;
                     53: };
                     54: 
                     55: #endif

E-mail: