--- parser3/src/include/Attic/pa_vclass.h 2001/02/24 11:20:32 1.10 +++ parser3/src/include/Attic/pa_vclass.h 2001/02/24 14:17:08 1.13 @@ -1,5 +1,5 @@ /* - $Id: pa_vclass.h,v 1.10 2001/02/24 11:20:32 paf Exp $ + $Id: pa_vclass.h,v 1.13 2001/02/24 14:17:08 paf Exp $ */ #ifndef PA_VCLASS_H @@ -7,6 +7,7 @@ #include "pa_value.h" #include "pa_vhash.h" +#include "pa_vstring.h" #include "pa_vjunction.h" class VClass : public Value { @@ -17,9 +18,15 @@ public: // Value // object_class: (field)=STATIC.value;(STATIC)=hash;(method)=method_ref with self=object_class Value *get_element(const String& name) { + // $NAME=name() + if(name==NAME_NAME) + return NEW VString(VClass::name()); + // $PARENTS=parents table + if(name==PARENTS_NAME) + return 0;// TODO: table of parents // $STATIC=STATIC hash - if(name==STATIC_NAME) - return &STATIC; + if(name==STATICS_NAME) + return &STATICS; // $method=junction(this+method) if(Method *method=static_cast(methods.get(name))) { @@ -31,12 +38,12 @@ public: // Value } // $field=STATIC.field - return STATIC.get_element(name); + return STATICS.get_element(name); } // object_class, operator_class: (field)=value - static values only void put_element(const String& name, Value *value) { - STATIC.put_element(name, value); + STATICS.put_element(name, value); } // object_class, object_instance: object_class @@ -47,40 +54,35 @@ public: // Value if(this==&ancestor) return true; // it's me - return parents_hash.get(ancestor.name())!=0; + return parents_hash.get(*ancestor.name())!=0; } public: // usage - - const String& name() const { return *fname; } - -public: // creation - VClass(Pool& apool, String& aname, const Array& immediate_parents) : + VClass(Pool& apool, const Array& immediate_parents) : Value(apool), - fname(&aname), - STATIC(apool), + STATICS(apool), methods(apool), parents(apool), parents_hash(apool) { // TODO: monkey immediate_parents // fill parents & parents_hash } - - void rename(String *aname) { fname=aname; } void add_method(const String& name, Method& method) { methods.put(name, &method); } void add_parent(VClass& parent) { parents+=&parent; - parents_hash.put(parent.name(), &parent); + parents_hash.put(*parent.name(), &parent); } +public: //usage + + VHash STATICS; + private: - String *fname; - VHash STATIC; Hash methods; Array parents; Hash parents_hash; };