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

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.4.8.1 ! paf         6:        $Id: pa_vobject.h,v 1.4 2001/03/11 21:23:59 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.4       paf        15: #include "pa_vstateless_object.h"
1.1       paf        16: 
1.4       paf        17: class VObject : public VStateless_object {
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
1.4       paf        26:                if(Value *result=VStateless_object::get_element(name))
1.3       paf        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.4.8.1 ! paf        46:        VObject(Pool& apool, VStateless_class& aclass_real) : 
        !            47:                VStateless_object(apool, aclass_real), 
        !            48: 
1.1       paf        49:                ffields(apool) {
                     50:        }
                     51: 
                     52: private:
                     53: 
                     54:        Hash ffields;
                     55: };
                     56: 
                     57: #endif

E-mail: