--- parser3/src/include/Attic/pa_vstring.h 2001/02/22 09:36:18 1.1 +++ parser3/src/include/Attic/pa_vstring.h 2001/03/06 17:03:17 1.9 @@ -1,30 +1,38 @@ /* - $Id: pa_vstring.h,v 1.1 2001/02/22 09:36:18 paf Exp $ + $Id: pa_vstring.h,v 1.9 2001/03/06 17:03:17 paf Exp $ */ #ifndef PA_VSTRING_H #define PA_VSTRING_H +#include + #include "pa_value.h" class VString : public Value { public: // Value // all: for error reporting after fail(), etc - /*virtual*/ const char *type() const { return "VString"; } - // string: value - /*virtual*/ String *get_string() { return string; }; - // string: value - void put_string(String *astring) { string=astring; } + const char *type() const { return "string"; } + // value: value + String *get_string() { return &value; }; + // value: value + double get_double() { return atof(value.cstr()); } + // value: empty or not + bool get_bool() { return value.size()!=0; }; public: // usage - VString(String *astring) : Value(astring->pool()), - string(astring) { + VString(Pool& apool) : Value(apool), + value(*new(apool) String(apool)) { + } + + VString(String& avalue) : Value(avalue.pool()), + value(avalue) { } private: - String *string; + String& value; };