--- parser3/src/include/Attic/pa_vhash.h 2001/02/22 16:21:49 1.1 +++ parser3/src/include/Attic/pa_vhash.h 2001/03/08 16:54:25 1.7 @@ -1,34 +1,44 @@ /* - $Id: pa_vhash.h,v 1.1 2001/02/22 16:21:49 paf Exp $ + $Id: pa_vhash.h,v 1.7 2001/03/08 16:54:25 paf Exp $ */ #ifndef PA_VHASH_H #define PA_VHASH_H #include "pa_value.h" +#include "pa_hash.h" class VHash : public Value { public: // value // all: for error reporting after fail(), etc - const char *type() const { return "Hash"; } + const char *type() const { return "fvalue"; } + // clone + Value *clone() { return NEW VHash(pool(), fvalue); }; - // hash: (key)=value + // fvalue: (key)=value Value *get_element(const String& name) { - return static_cast(hash.get(name)); + return static_cast(fvalue.get(name)); } - // hash: (key)=value + // fvalue: (key)=value void put_element(const String& name, Value *value) { - hash.put(name, value); + fvalue.put(name, value); } + // fvalue: size!=0 + bool get_bool() { return fvalue.size()!=0; } + public: // usage - VHash(Pool& apool) : Value(apool), hash(apool) {} + VHash(Pool& apool) : Value(apool), + fvalue(*new(apool) Hash(apool)) {} + + VHash(Pool& apool, Hash& avalue) : Value(apool), + fvalue(avalue) {} private: - Hash hash; + Hash& fvalue; }; #endif