Annotation of parser3/src/types/pa_vtable.h, revision 1.29

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.29    ! parser      8:        $Id: pa_vtable.h,v 1.28 2001/08/03 11:54:19 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.1       paf        17: 
1.27      parser     18: #define TABLE_FIELDS_ELEMENT_NAME "fields"
                     19: 
1.16      paf        20: extern Methoded *table_class;
                     21: 
1.6       paf        22: /// value of type 'table'. implemented with Table
1.1       paf        23: class VTable : public VStateless_object {
                     24: public: // Value
                     25: 
                     26:        const char *type() const { return "table"; }
1.29    ! parser     27:        /// VTable: count!=0
        !            28:        bool is_defined() const { return table().size()!=0; }
1.6       paf        29:        /// extract VTable
1.10      paf        30:        Table *get_table() { return ftable; }
1.18      paf        31:        /// VTable: columns,methods
1.27      parser     32:        Value *get_element(const String& name);
1.7       paf        33: 
                     34: protected: // VAliased
                     35: 
1.9       paf        36:        /// disable .CLASS element. @see VAliased::get_element
1.13      paf        37:        bool hide_class() { return true; }
1.1       paf        38: 
                     39: public: // usage
                     40: 
1.12      paf        41:        VTable(Pool& apool, Table* atable=0) : VStateless_object(apool, *table_class), 
1.28      parser     42:                ftable(atable) {
1.1       paf        43:        }
1.14      paf        44:        void set_table(Table& avalue) { 
                     45:                ftable=&avalue; 
                     46:        }
1.1       paf        47:        Table& table() { 
1.4       paf        48:                if(!ftable)
1.1       paf        49:                        bark("getting unset vtable value");
                     50: 
1.4       paf        51:                return *ftable; 
1.1       paf        52:        }
                     53: 
                     54: private:
1.27      parser     55: 
                     56:        Value *fields_element();
1.1       paf        57: 
1.18      paf        58: private:
                     59: 
                     60:        Table *ftable;
1.1       paf        61: 
                     62: };
                     63: 
                     64: #endif

E-mail: