Annotation of parser3/src/include/pa_wcontext.h, revision 1.14
1.1 paf 1: /*
1.14 ! paf 2: $Id: pa_wcontext.h,v 1.13 2001/02/23 17:12:57 paf Exp $
1.1 paf 3: */
4:
5: #ifndef PA_WCONTEXT_H
6: #define PA_WCONTEXT_H
7:
1.13 paf 8: #include "pa_value.h"
9: #include "pa_vstring.h"
10: #include "pa_vhash.h"
1.1 paf 11:
1.13 paf 12: class WContext : public Value {
1.2 paf 13: public: // Value
14:
15: // all: for error reporting after fail(), etc
1.5 paf 16: const char *type() const { return "WContext"; }
1.13 paf 17: // WContext: accumulated string
18: String *get_string() { return string; };
19:
1.14 ! paf 20: public: // WContext
! 21:
! 22: // appends a string to result
! 23: virtual void write(String *astring);
! 24:
! 25: // if value is VString writes string,
! 26: // else writes Value; raises an error if already
! 27: virtual void write(Value *avalue);
! 28:
1.13 paf 29: public: // usage
30:
31: WContext(Pool& apool, Value *avalue) : Value(apool),
32: fvalue(avalue),
33: string(new(apool) String(apool)) {
1.10 paf 34: }
35:
1.14 ! paf 36: // retrives the resulting value
! 37: Value *value() const {
! 38: return fvalue;
1.13 paf 39: }
40: // retrives the resulting value
41: // that can be VString if value==0 or the Value object
1.14 ! paf 42: Value *value_or_string() const {
1.13 paf 43: return fvalue?fvalue:NEW VString(string);
1.1 paf 44: }
1.13 paf 45:
46: protected:
47: Value *fvalue;
1.1 paf 48: private:
1.13 paf 49: String *string;
1.1 paf 50: };
51:
52: #endif
E-mail: