--- parser3/src/include/Attic/pa_vstring.h 2001/02/22 13:52:25 1.2 +++ parser3/src/include/Attic/pa_vstring.h 2001/03/09 04:47:27 1.13 @@ -1,36 +1,40 @@ /* - $Id: pa_vstring.h,v 1.2 2001/02/22 13:52:25 paf Exp $ + $Id: pa_vstring.h,v 1.13 2001/03/09 04:47:27 paf Exp $ */ #ifndef PA_VSTRING_H #define PA_VSTRING_H +#include + #include "pa_value.h" +#include "pa_vobject.h" +#include "classes/_string.h" -class VString : public Value { +class VString : public VObject { public: // Value // all: for error reporting after fail(), etc - const char *type() const { return "VString"; } - // string: value - String *get_string() { return string; }; - // string: value - void put_string(String *astring) { string=astring; } + const char *type() const { return "string"; } + // value: fvalue + String *get_string() { return &fvalue; }; + // value: fvalue + double get_double() { return atof(fvalue.cstr()); } + // value: empty or not + bool get_bool() { return fvalue.size()!=0; }; public: // usage - VString(Pool& apool) : Value(apool), - string(new(apool) String(apool)) { + VString() : VObject(*string_class), + fvalue(*new(string_class->pool()) String(string_class->pool())) { } - VString(String *astring) : Value(astring->pool()), - string(astring) { + VString(String& avalue) : VObject(*string_class), + fvalue(avalue) { } - operator String() { return *string; } - private: - String *string; + String& fvalue; };