Annotation of parser3/src/include/pa_wcontext.h, revision 1.20
1.1 paf 1: /*
1.20 ! paf 2: $Id: pa_wcontext.h,v 1.19 2001/02/25 17:33:43 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.18 paf 19:
20: // WContext: none yet | transparent
21: VClass *get_class() { return fvalue?fvalue->get_class():0; }
1.19 paf 22: // wcontext: transparent
1.20 ! paf 23: VAliased *get_aliased() { return fvalue?fvalue->get_aliased():0; }
1.13 paf 24:
1.14 paf 25: public: // WContext
26:
27: // appends a string to result
28: virtual void write(String *astring);
29:
30: // if value is VString writes string,
31: // else writes Value; raises an error if already
32: virtual void write(Value *avalue);
33:
1.13 paf 34: public: // usage
35:
1.17 paf 36: WContext(Pool& apool, Value *avalue, bool aconstructing) : Value(apool),
1.13 paf 37: fvalue(avalue),
1.17 paf 38: fconstructing(aconstructing),
1.16 paf 39: string(*new(apool) String(apool)) {
1.10 paf 40: }
41:
1.17 paf 42: bool constructing() { return fconstructing; }
43:
1.14 paf 44: // retrives the resulting value
1.15 paf 45: Value *object() const {
1.14 paf 46: return fvalue;
1.13 paf 47: }
48: // retrives the resulting value
49: // that can be VString if value==0 or the Value object
1.15 paf 50: Value *result() const {
1.13 paf 51: return fvalue?fvalue:NEW VString(string);
1.1 paf 52: }
1.13 paf 53:
54: protected:
55: Value *fvalue;
1.1 paf 56: private:
1.17 paf 57: bool fconstructing;
1.16 paf 58: String& string;
1.1 paf 59: };
60:
61: #endif
E-mail: