Annotation of parser3/src/include/pa_context.h, revision 1.4

1.1       paf         1: /*
1.4     ! paf         2:   $Id: pa_context.h,v 1.3 2001/02/12 11:44:41 paf Exp $
1.1       paf         3: */
                      4: 
                      5: /*
                      6:        data core
                      7: */
                      8: 
                      9: #ifndef PA_CONTEXT_H
                     10: #define PA_CONTEXT_H
                     11: 
                     12: #include "pa_value.h"
                     13: 
                     14: typedef Value RContext;
                     15: 
                     16: class WContext : public Value {
                     17: public:
                     18: 
                     19:        // appends a string to result
                     20:        // until Value written, ignores afterwards
                     21:        void write(String& astring);
                     22:        // if value.string!=0 writes just string, not Value
                     23:        // raises an error if already
                     24:        void write(Value& avalue);
                     25: 
                     26:        // retrives the resulting value
                     27:        // that can be Text if value==0 or the Value object
                     28:        Value *value() const {
                     29:                return value?value:new Text(string);
                     30:        }
                     31:        
                     32: public: //implement by replicating to value->calls
                     33: 
                     34:        virtual String *get_string() const { return &string };
                     35:        virtual void put_string(const String *astring) { check(value)->put_string(astring); };
                     36: 
1.3       paf        37:        virtual Method_ref *get_method_ref() const { return check(value)->get_method_ref(); }
                     38: 
1.1       paf        39:        virtual Value *get_element(const String& name) const { return check(value)->get_element(name); }
                     40:        virtual void put_element(const String& name, const Value *avalue){ check(value)->put_element(name, avalue); }
                     41: 
1.2       paf        42:        virtual Method *get_method(const String& name) const { return check(value)->get_method(name); }
1.4     ! paf        43: 
        !            44:        virtual Class *get_class() const { return check(value)->get_class(); }
1.1       paf        45: 
                     46: private:
                     47:        String& string;
                     48:        Value *value;
                     49: 
                     50: private:
                     51:        // raises an exception on 0 value
                     52:        Value *check(const Value *value);
                     53: };
                     54: 
                     55: #endif

E-mail: