Annotation of parser3/src/include/pa_wcontext.h, revision 1.23
1.1 paf 1: /*
1.23 ! paf 2: $Id: pa_wcontext.h,v 1.22 2001/03/08 12:19:20 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.21 paf 16: const char *type() const { return "wcontext"; }
1.22 paf 17: // WContext: accumulated fstring
18: String *get_string() { return &fstring; };
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:
1.22 paf 27: // appends a fstring to result
1.23 ! paf 28: virtual void write(String& astring);
1.14 paf 29:
1.22 paf 30: // if value is VString writes fstring,
1.14 paf 31: // else writes Value; raises an error if already
1.23 ! paf 32: virtual void write(Value& avalue);
1.14 paf 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.22 paf 39: fstring(*new(apool) String(apool)) {
1.10 paf 40: }
41:
1.17 paf 42: bool constructing() { return fconstructing; }
43:
1.23 ! paf 44: /* // retrives the resulting value
1.15 paf 45: Value *object() const {
1.14 paf 46: return fvalue;
1.23 ! paf 47: }*/
1.13 paf 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.22 paf 51: return fvalue?fvalue:NEW VString(fstring);
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.22 paf 58: String& fstring;
1.1 paf 59: };
60:
61: #endif
E-mail: