Annotation of parser3/src/include/pa_wwrapper.h, revision 1.12
1.1 paf 1: /*
1.12 ! paf 2: $Id: pa_wwrapper.h,v 1.11 2001/03/07 13:55:46 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
1.9 paf 15: const char *type() const { return "wwrapper"; }
1.4 paf 16: // wwrapper: transparent
1.11 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());
1.12 ! paf 22:
1.1 paf 23: fvalue->put_element(name, avalue);
24: }
25:
26: public: // usage
27:
1.7 paf 28: WWrapper(Pool& apool, Value *avalue, bool aconstructed) :
29: WContext(apool, avalue, aconstructed) {
1.1 paf 30: }
31:
32: private:
33: // raises an exception on 0 value
34: Value *check_value() const {
35: if(!fvalue)
36: THROW(0,0,
37: 0,
1.3 paf 38: "accessing wrapper without value");
1.1 paf 39:
40: return fvalue;
41: }
42: };
43:
44: #endif
E-mail: