|
|
| version 1.21, 2001/03/06 15:02:47 | version 1.27, 2001/03/10 12:12:50 |
|---|---|
| Line 9 | Line 9 |
| #include "pa_vstring.h" | #include "pa_vstring.h" |
| #include "pa_vhash.h" | #include "pa_vhash.h" |
| class Request; | |
| class WContext : public Value { | class WContext : public Value { |
| friend Request; | |
| public: // Value | public: // Value |
| // all: for error reporting after fail(), etc | // all: for error reporting after fail(), etc |
| const char *type() const { return "wcontext"; } | const char *type() const { return "wcontext"; } |
| // WContext: accumulated string | // WContext: accumulated fstring |
| String *get_string() { return &string; }; | const String *get_string() { return &fstring; }; |
| // WContext: none yet | transparent | // WContext: none yet | transparent |
| VClass *get_class() { return fvalue?fvalue->get_class():0; } | VClass *get_class() { return fvalue?fvalue->get_class():0; } |
| Line 24 public: // Value | Line 27 public: // Value |
| public: // WContext | public: // WContext |
| // appends a string to result | // appends a fstring to result |
| virtual void write(String *astring); | virtual void write(const String& astring, String::Untaint_lang lang); |
| // if value is VString writes string, | // if value is VString writes fstring, |
| // else writes Value; raises an error if already | // else writes Value; raises an error if already |
| virtual void write(Value *avalue); | virtual void write(Value& avalue, String::Untaint_lang lang); |
| public: // usage | public: // usage |
| WContext(Pool& apool, Value *avalue, bool aconstructing) : Value(apool), | WContext(Pool& apool, Value *avalue, bool aconstructing) : Value(apool), |
| fvalue(avalue), | fvalue(avalue), |
| fconstructing(aconstructing), | fconstructing(aconstructing), |
| string(*new(apool) String(apool)) { | fstring(*new(apool) String(apool)) { |
| } | } |
| bool constructing() { return fconstructing; } | bool constructing() { return fconstructing; } |
| // retrives the resulting value | // retrives the resulting value |
| Value *object() const { | |
| return fvalue; | |
| } | |
| // retrives the resulting value | |
| // that can be VString if value==0 or the Value object | // that can be VString if value==0 or the Value object |
| Value *result() const { | Value *result() const { |
| return fvalue?fvalue:NEW VString(string); | return fvalue?fvalue:NEW VString(fstring); |
| } | } |
| protected: | protected: |
| Value *fvalue; | Value *fvalue; |
| private: | private: |
| bool fconstructing; | bool fconstructing; |
| String& string; | String& fstring; |
| }; | }; |
| #endif | #endif |