Annotation of parser3/src/include/pa_wwrapper.h, revision 1.7
1.1 paf 1: /*
1.7 ! paf 2: $Id: pa_wwrapper.h,v 1.6 2001/02/25 09:42:03 paf Exp $
1.1 paf 3: */
4:
5: #ifndef PA_WWRAPPER_H
6: #define PA_WWRAPPER_H
7:
8: #include "pa_wcontext.h"
1.3 paf 9: #include "pa_exception.h"
1.1 paf 10:
11: class WWrapper : public WContext {
12: public: // Value
13:
14: // all: for error reporting after fail(), etc
15: const char *type() const { return "WWrapper"; }
1.4 paf 16: // wwrapper: transparent
1.1 paf 17: Value *get_element(const String& name) { return check_value()->get_element(name); }
1.4 paf 18: // wwrapper: transparent
1.1 paf 19: void put_element(const String& name, Value *avalue){
20: if(!fvalue)
21: fvalue=NEW VHash(pool());
22: fvalue->put_element(name, avalue);
23: }
24:
1.4 paf 25: // wwrapper: none yet | transparent
1.6 paf 26: VClass *get_class() { return fvalue?fvalue->get_class():0; }
1.1 paf 27:
28: public: // usage
29:
1.7 ! paf 30: WWrapper(Pool& apool, Value *avalue, bool aconstructed) :
! 31: WContext(apool, avalue, aconstructed) {
1.1 paf 32: }
33:
34: private:
35: // raises an exception on 0 value
36: Value *check_value() const {
37: if(!fvalue)
38: THROW(0,0,
39: 0,
1.3 paf 40: "accessing wrapper without value");
1.1 paf 41:
42: return fvalue;
43: }
44: };
45:
46: #endif
E-mail: