Annotation of parser3/src/include/pa_wcontext.h, revision 1.17
1.1 paf 1: /*
1.17 ! paf 2: $Id: pa_wcontext.h,v 1.16 2001/02/25 13:23:01 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
1.16 paf 18: String *get_string() { return &string; };
1.13 paf 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:
1.17 ! paf 31: WContext(Pool& apool, Value *avalue, bool aconstructing) : Value(apool),
1.13 paf 32: fvalue(avalue),
1.17 ! paf 33: fconstructing(aconstructing),
1.16 paf 34: string(*new(apool) String(apool)) {
1.10 paf 35: }
36:
1.17 ! paf 37: bool constructing() { return fconstructing; }
! 38:
1.14 paf 39: // retrives the resulting value
1.15 paf 40: Value *object() const {
1.14 paf 41: return fvalue;
1.13 paf 42: }
43: // retrives the resulting value
44: // that can be VString if value==0 or the Value object
1.15 paf 45: Value *result() const {
1.13 paf 46: return fvalue?fvalue:NEW VString(string);
1.1 paf 47: }
1.13 paf 48:
49: protected:
50: Value *fvalue;
1.1 paf 51: private:
1.17 ! paf 52: bool fconstructing;
1.16 paf 53: String& string;
1.1 paf 54: };
55:
56: #endif
E-mail: