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