|
|
| version 1.13, 2001/02/23 17:12:57 | version 1.15, 2001/02/24 11:46:03 |
|---|---|
| Line 17 public: // Value | Line 17 public: // Value |
| // WContext: accumulated string | // WContext: accumulated string |
| String *get_string() { return string; }; | String *get_string() { return string; }; |
| public: // WContext | |
| // appends a string to result | |
| virtual void write(String *astring); | |
| // if value is VString writes string, | |
| // else writes Value; raises an error if already | |
| virtual void write(Value *avalue); | |
| public: // usage | public: // usage |
| WContext(Pool& apool, Value *avalue) : Value(apool), | WContext(Pool& apool, Value *avalue) : Value(apool), |
| Line 24 public: // usage | Line 33 public: // usage |
| string(new(apool) String(apool)) { | string(new(apool) String(apool)) { |
| } | } |
| // appends a string to result | // retrives the resulting value |
| void write(String *astring) { | Value *object() const { |
| if(!astring) | return fvalue; |
| return; | |
| *string+=*astring; | |
| } | |
| // if value is VString writes string, | |
| // else writes Value; raises an error if already | |
| void write(Value *avalue) { | |
| if(!avalue) | |
| return; | |
| String *string=avalue->get_string(); | |
| if(string) | |
| write(string); | |
| else | |
| if(fvalue) // already have value? | |
| THROW(0,0, // don't need to construct twice | |
| fvalue->name(), | |
| "value already assigned, use constructor to reassign it"); | |
| else | |
| fvalue=avalue; | |
| } | } |
| // retrives the resulting value | // 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 *value() const { | Value *result() const { |
| return fvalue?fvalue:NEW VString(string); | return fvalue?fvalue:NEW VString(string); |
| } | } |