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

1.6       paf         1: /** @file
                      2:        Parser: table parser class decl.
                      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.11    ! paf         8:        $Id: pa_vtable.h,v 1.10 2001/03/27 16:35:57 paf 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"
                     16: #include "_table.h"
                     17: #include "pa_vunknown.h"
                     18: 
1.6       paf        19: /// value of type 'table'. implemented with Table
1.1       paf        20: class VTable : public VStateless_object {
                     21: public: // Value
                     22: 
1.6       paf        23:        /// all: for error reporting after fail(), etc
1.1       paf        24:        const char *type() const { return "table"; }
1.6       paf        25:        /// extract VTable
1.10      paf        26:        Table *get_table() { return ftable; }
1.6       paf        27:        /// VTable: column
1.1       paf        28:        Value *get_element(const String& name) {
1.3       paf        29:                // methods
1.2       paf        30:                if(Value *result=VStateless_object::get_element(name))
                     31:                        return result;
                     32: 
1.4       paf        33:                if(ftable)
                     34:                        if(const String *string=ftable->item(name))
1.1       paf        35:                                return NEW VString(*string);
                     36: 
                     37:                return NEW VUnknown(pool());
                     38:        }
1.7       paf        39: 
1.11    ! paf        40: public:
        !            41: 
        !            42:        bool last_locate_was_successful;
        !            43: 
1.7       paf        44: protected: // VAliased
                     45: 
1.9       paf        46:        /// disable .CLASS element. @see VAliased::get_element
                     47:        bool are_static_calls_disabled() { return true; }
1.1       paf        48: 
                     49: public: // usage
                     50: 
                     51:        VTable(Pool& apool) : VStateless_object(apool, *table_class), 
1.11    ! paf        52:                ftable(0),
        !            53:                last_locate_was_successful(false) {
1.1       paf        54:        }
1.4       paf        55:        void set_table(Table& avalue) { ftable=&avalue; }
1.1       paf        56:        Table& table() { 
1.4       paf        57:                if(!ftable)
1.1       paf        58:                        bark("getting unset vtable value");
                     59: 
1.4       paf        60:                return *ftable; 
1.1       paf        61:        }
                     62: 
                     63: private:
                     64: 
1.4       paf        65:        Table *ftable;
1.1       paf        66: 
                     67: };
                     68: 
                     69: #endif

E-mail: