Annotation of parser3/src/include/pa_wwrapper.h, revision 1.2
1.1 paf 1: /*
1.2 ! paf 2: $Id: pa_wwrapper.h,v 1.1 2001/02/23 17:12:58 paf Exp $
1.1 paf 3: */
4:
5: #ifndef PA_WWRAPPER_H
6: #define PA_WWRAPPER_H
7:
8: #include "pa_wcontext.h"
9:
10: class WWrapper : public WContext {
11: public: // Value
12:
13: // all: for error reporting after fail(), etc
14: const char *type() const { return "WWrapper"; }
15: // wcontext: transparent
16: Value *get_element(const String& name) { return check_value()->get_element(name); }
17: // wcontext: transparent
18: void put_element(const String& name, Value *avalue){
19: if(!fvalue)
20: fvalue=NEW VHash(pool());
21: fvalue->put_element(name, avalue);
22: }
23:
24: // wcontext: none yet | transparent
25: VClass *get_class() const { return fvalue?fvalue->get_class():0; }
26: // wcontext: none yet | transparent
27: bool is_or_derived_from(VClass& ancestor) { return fvalue?fvalue->is_or_derived_from(ancestor):false; }
28:
29: public: // usage
30:
31: WWrapper(Pool& apool, Value *avalue) : WContext(apool, avalue) {
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,
40: "accessing wcontext without value");
41:
42: return fvalue;
43: }
44: };
45:
46: #endif
E-mail: