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