Annotation of parser3/src/types/pa_vstring.h, revision 1.1

1.1     ! paf         1: /*
        !             2:        Parser
        !             3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             4:        Author: Alexander Petrosyan <paf@design.ru>
        !             5: 
        !             6:        $Id: pa_vstring.h,v 1.17 2001/03/10 16:34:37 paf Exp $
        !             7: */
        !             8: 
        !             9: #ifndef PA_VSTRING_H
        !            10: #define PA_VSTRING_H
        !            11: 
        !            12: #include <stdlib.h>
        !            13: 
        !            14: #include "pa_value.h"
        !            15: #include "pa_vobject.h"
        !            16: #include "pa_vdouble.h"
        !            17: #include "_string.h"
        !            18: 
        !            19: class VString : public VObject {
        !            20: public: // Value
        !            21: 
        !            22:        // all: for error reporting after fail(), etc
        !            23:        const char *type() const { return "string"; }
        !            24:        // string: fvalue as VDouble
        !            25:        Value *get_expr_result() { return NEW VDouble(pool(), get_double()); }
        !            26:        // string: fvalue
        !            27:        const String *get_string() { return &fvalue; };
        !            28:        // string: fvalue
        !            29:        double get_double() { return atof(fvalue.cstr()); }
        !            30:        // string: empty or not
        !            31:        bool get_bool() { return fvalue.size()!=0; };
        !            32: 
        !            33: public: // usage
        !            34: 
        !            35:        VString(Pool& apool) : VObject(apool, *string_class), 
        !            36:                fvalue(*new(string_class->pool()) String(string_class->pool())) {
        !            37:        }
        !            38: 
        !            39:        VString(const String& avalue) : VObject(avalue.pool(), *string_class),
        !            40:                fvalue(avalue) {
        !            41:        }
        !            42: 
        !            43:        const String& value() { return fvalue; }
        !            44: 
        !            45: private:
        !            46:        const String& fvalue;
        !            47: 
        !            48: };
        !            49: 
        !            50: #endif

E-mail: