Annotation of parser3/src/include/pa_vstring.h, revision 1.13

1.1       paf         1: /*
1.13    ! paf         2:   $Id: pa_vstring.h,v 1.12.2.2 2001/03/08 17:59:27 paf Exp $
1.1       paf         3: */
                      4: 
                      5: #ifndef PA_VSTRING_H
                      6: #define PA_VSTRING_H
                      7: 
1.6       paf         8: #include <stdlib.h>
                      9: 
1.1       paf        10: #include "pa_value.h"
1.13    ! paf        11: #include "pa_vobject.h"
        !            12: #include "classes/_string.h"
1.1       paf        13: 
1.13    ! paf        14: class VString : public VObject {
1.1       paf        15: public: // Value
                     16: 
                     17:        // all: for error reporting after fail(), etc
1.9       paf        18:        const char *type() const { return "string"; }
1.13    ! paf        19:        // value: fvalue
1.10      paf        20:        String *get_string() { return &fvalue; };
1.13    ! paf        21:        // value: fvalue
1.10      paf        22:        double get_double() { return atof(fvalue.cstr()); }
1.13    ! paf        23:        // value: empty or not
1.10      paf        24:        bool get_bool() { return fvalue.size()!=0; };
1.1       paf        25: 
                     26: public: // usage
                     27: 
1.13    ! paf        28:        VString() : VObject(*string_class), 
        !            29:                fvalue(*new(string_class->pool()) String(string_class->pool())) {
1.2       paf        30:        }
                     31: 
1.13    ! paf        32:        VString(String& avalue) : VObject(*string_class),
1.10      paf        33:                fvalue(avalue) {
1.1       paf        34:        }
                     35: 
                     36: private:
1.10      paf        37:        String& fvalue;
1.1       paf        38: 
                     39: };
                     40: 
                     41: #endif

E-mail: