Annotation of parser3/src/types/pa_vtable.h, revision 1.30
1.6 paf 1: /** @file
1.15 paf 2: Parser: @b table parser class decl.
1.6 paf 3:
1.1 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.6 paf 5:
1.1 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
7:
1.30 ! parser 8: $Id: pa_vtable.h,v 1.28.4.1 2001/09/07 16:51:43 parser Exp $
1.1 paf 9: */
10:
11: #ifndef PA_VTABLE_H
12: #define PA_VTABLE_H
13:
14: #include "pa_vstateless_object.h"
15: #include "pa_table.h"
1.26 parser 16: #include "pa_vvoid.h"
1.30 ! parser 17: #include "pa_vint.h"
1.1 paf 18:
1.27 parser 19: #define TABLE_FIELDS_ELEMENT_NAME "fields"
20:
1.16 paf 21: extern Methoded *table_class;
22:
1.6 paf 23: /// value of type 'table'. implemented with Table
1.1 paf 24: class VTable : public VStateless_object {
25: public: // Value
26:
27: const char *type() const { return "table"; }
1.29 parser 28: /// VTable: count!=0
29: bool is_defined() const { return table().size()!=0; }
1.6 paf 30: /// extract VTable
1.10 paf 31: Table *get_table() { return ftable; }
1.18 paf 32: /// VTable: columns,methods
1.27 parser 33: Value *get_element(const String& name);
1.7 paf 34:
35: protected: // VAliased
36:
1.9 paf 37: /// disable .CLASS element. @see VAliased::get_element
1.13 paf 38: bool hide_class() { return true; }
1.1 paf 39:
40: public: // usage
41:
1.12 paf 42: VTable(Pool& apool, Table* atable=0) : VStateless_object(apool, *table_class),
1.28 parser 43: ftable(atable) {
1.1 paf 44: }
1.14 paf 45: void set_table(Table& avalue) {
46: ftable=&avalue;
47: }
1.30 ! parser 48: Table& table() const {
1.4 paf 49: if(!ftable)
1.1 paf 50: bark("getting unset vtable value");
51:
1.4 paf 52: return *ftable;
1.1 paf 53: }
54:
55: private:
1.27 parser 56:
57: Value *fields_element();
1.1 paf 58:
1.18 paf 59: private:
60:
61: Table *ftable;
1.1 paf 62:
63: };
64:
65: #endif
E-mail: