Annotation of parser3/src/types/pa_vtable.h, revision 1.5
1.1 paf 1: /*
2: Parser
3: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
4: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
5:
1.5 ! paf 6: $Id: pa_vtable.h,v 1.4 2001/03/16 09:26:45 paf Exp $
1.1 paf 7: */
8:
9: #ifndef PA_VTABLE_H
10: #define PA_VTABLE_H
11:
12: #include "pa_vstateless_object.h"
13: #include "pa_table.h"
14: #include "_table.h"
15: #include "pa_vunknown.h"
16:
17: class VTable : public VStateless_object {
18: public: // Value
19:
20: // all: for error reporting after fail(), etc
21: const char *type() const { return "table"; }
22: // table: column
23: Value *get_element(const String& name) {
1.3 paf 24: // methods
1.2 paf 25: if(Value *result=VStateless_object::get_element(name))
26: return result;
27:
1.4 paf 28: if(ftable)
29: if(const String *string=ftable->item(name))
1.1 paf 30: return NEW VString(*string);
31:
32: return NEW VUnknown(pool());
33: }
34:
35: public: // usage
36:
37: VTable(Pool& apool) : VStateless_object(apool, *table_class),
1.4 paf 38: ftable(0) {
1.1 paf 39: }
1.4 paf 40: void set_table(Table& avalue) { ftable=&avalue; }
1.1 paf 41: Table& table() {
1.4 paf 42: if(!ftable)
1.1 paf 43: bark("getting unset vtable value");
44:
1.4 paf 45: return *ftable;
1.1 paf 46: }
47:
48: private:
49:
1.4 paf 50: Table *ftable;
1.1 paf 51:
52: };
53:
54: #endif
E-mail: