Diff for /parser3/src/include/Attic/pa_wcontext.h between versions 1.1 and 1.14

version 1.1, 2001/02/21 16:11:49 version 1.14, 2001/02/24 11:20:32
Line 2 Line 2
   $Id$    $Id$
 */  */
   
 /*  
         data core  
 */  
   
 #ifndef PA_WCONTEXT_H  #ifndef PA_WCONTEXT_H
 #define PA_WCONTEXT_H  #define PA_WCONTEXT_H
   
 #include "pa_value.h"  #include "pa_value.h"
   #include "pa_vstring.h"
   #include "pa_vhash.h"
   
 class WContext : public Value {  class WContext : public Value {
 public:  public: // Value
         WContext(Pool& apool) : Pooled(apool), string(apool) {}  
   
         // appends a string to result  
         // until Value written, ignores afterwards  
         void write(String& astring);  
         // if value.string!=0 writes string altogether[for showing class names, etc]  
         // writes Value; raises an error if already  
         void write(Value& avalue);  
         //void write(String_iterator& from, String_iterator& to);  
   
         // retrives the resulting value  
         // that can be Text if value==0 or the Value object  
         Value *value() const {  
                 return value?value:new Text(string);  
         }  
           
 public: //implement by replicating to value->calls  
   
         const char *get_type() const { return "WContext"; }          // all: for error reporting after fail(), etc
           const char *type() const { return "WContext"; }
           // WContext: accumulated string
           String *get_string() { return string; };
   
         String *get_string() const { return &string };  public: // WContext
         void put_string(const String *astring) { check(value)->put_string(astring); };  
   
         Method_ref *get_method_ref() const { return check(value)->get_method_ref(); }          // appends a string to result
           virtual void write(String *astring);
   
         Value *get_element(const String& name) const { return check(value)->get_element(name); }          // if value is VString writes string,
         void put_element(const String& name, const Value *avalue){ check(value)->put_element(name, avalue); }          // else writes Value; raises an error if already
           virtual void write(Value *avalue);
   
         Method *get_method(const String& name) const { return check(value)->get_method(name); }  public: // usage
   
         Class *get_class() const { return value?value->get_class():0; }          WContext(Pool& apool, Value *avalue) : Value(apool), 
         bool has_parent(Class *aparent) { return value?value->has_parent(aparent):false; }                  fvalue(avalue),
                   string(new(apool) String(apool)) {
           }
   
 private:          // retrives the resulting value
         String string;          Value *value() const {
         Value *value;                  return fvalue;
           }
           // retrives the resulting value
           // that can be VString if value==0 or the Value object
           Value *value_or_string() const {
                   return fvalue?fvalue:NEW VString(string);
           }
   
   protected:
           Value *fvalue;
 private:  private:
         // raises an exception on 0 value          String *string;
         Value *check(const Value *value);  
 };  };
   
 #endif  #endif

Removed from v.1.1  
changed lines
  Added in v.1.14


E-mail: