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

1.1       paf         1: /*
1.7     ! paf         2:   $Id: pa_context.h,v 1.6 2001/02/14 13:40:54 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: class WContext : public Value {
                     15: public:
                     16: 
                     17:        // appends a string to result
                     18:        // until Value written, ignores afterwards
                     19:        void write(String& astring);
1.7     ! paf        20:        // if value.string!=0 writes string altogether[for showing class names, etc]
        !            21:        // writes Value; raises an error if already
1.1       paf        22:        void write(Value& avalue);
1.7     ! paf        23:        //void write(String_iterator& from, String_iterator& to);
1.1       paf        24: 
                     25:        // retrives the resulting value
                     26:        // that can be Text if value==0 or the Value object
                     27:        Value *value() const {
                     28:                return value?value:new Text(string);
                     29:        }
                     30:        
                     31: public: //implement by replicating to value->calls
                     32: 
1.7     ! paf        33:        const char *get_type() const { return "WContext"; }
        !            34: 
        !            35:        String *get_string() const { return &string };
        !            36:        void put_string(const String *astring) { check(value)->put_string(astring); };
1.1       paf        37: 
1.7     ! paf        38:        Method_ref *get_method_ref() const { return check(value)->get_method_ref(); }
1.3       paf        39: 
1.7     ! paf        40:        Value *get_element(const String& name) const { return check(value)->get_element(name); }
        !            41:        void put_element(const String& name, const Value *avalue){ check(value)->put_element(name, avalue); }
1.1       paf        42: 
1.7     ! paf        43:        Method *get_method(const String& name) const { return check(value)->get_method(name); }
1.4       paf        44: 
1.7     ! paf        45:        Class *get_class() const { return value?value->get_class():0; }
        !            46:        bool has_parent(Class *aparent) { return value?value->has_parent(aparent):false; }
1.1       paf        47: 
                     48: private:
                     49:        String& string;
                     50:        Value *value;
                     51: 
                     52: private:
                     53:        // raises an exception on 0 value
                     54:        Value *check(const Value *value);
                     55: };
                     56: 
                     57: #endif

E-mail: