|
|
| version 1.24, 2001/03/08 17:14:51 | version 1.26, 2001/03/09 04:47:27 |
|---|---|
| Line 7 | Line 7 |
| #include "pa_valiased.h" | #include "pa_valiased.h" |
| #include "pa_vhash.h" | #include "pa_vhash.h" |
| #include "pa_vstring.h" | |
| #include "pa_vjunction.h" | #include "pa_vjunction.h" |
| #define CLASS_NAME "CLASS" | #define CLASS_NAME "CLASS" |
| Line 20 public: // Value | Line 19 public: // Value |
| const char *type() const { return "class"; } | const char *type() const { return "class"; } |
| // object_class: (field)=STATIC.value;(STATIC)=hash;(method)=method_ref with self=object_class | // object_class: (field)=STATIC.value;(STATIC)=hash;(method)=method_ref with self=object_class |
| Value *get_element(const String& aname) { | Value *get_element(const String& aname); |
| // $NAME=my name | |
| if(aname==NAME_NAME) | |
| return NEW VString(fclass_alias->name()); | |
| // $CLASS=my class=myself | |
| if(aname==CLASS_NAME) | |
| return fclass_alias; | |
| // $BASE=my parent | |
| if(aname==BASE_NAME) | |
| return fclass_alias->base(); | |
| // $method=junction(self+class+method) | |
| if(Junction *junction=get_junction(*this, aname)) | |
| return NEW VJunction(*junction); | |
| // $field=static field | |
| return get_field(aname); | |
| } | |
| // object_class, operator_class: (field)=value - static values only | // object_class, operator_class: (field)=value - static values only |
| void put_element(const String& name, Value *value) { | void put_element(const String& name, Value *value); |
| set_field(name, value); | |
| } | |
| // object_class, object_instance: object_class | // object_class, object_instance: object_class |
| VClass *get_class() { return this; } | VClass *get_class() { return this; } |
| Line 49 public: // usage | Line 31 public: // usage |
| VClass(Pool& apool) : VAliased(apool, *this), | VClass(Pool& apool) : VAliased(apool, *this), |
| fbase(0), | fbase(0), |
| ffields(*new(apool) Hash(apool)), | ffields(apool), |
| fmethods(*new(apool) Hash(apool)) { | fmethods(apool) { |
| } | |
| VClass(Pool& apool, | |
| VClass *abase, Hash& afields, Hash& amethods) : VAliased(apool, *this), | |
| fbase(abase), | |
| ffields(afields), | |
| fmethods(amethods) { | |
| } | } |
| void add_method(const String& name, Method& method) { | void add_method(const String& name, Method& method) { |
| Line 110 private: | Line 84 private: |
| private: | private: |
| VClass *fbase; | VClass *fbase; |
| Hash& ffields; | Hash ffields; |
| Hash& fmethods; | Hash fmethods; |
| }; | }; |
| #endif | #endif |