Annotation of parser3/src/types/pa_vcaller_wrapper.h, revision 1.1

1.1     ! moko        1: /** @file
        !             2:        Parser: VCaller class decl. as wrapper for $caller access
        !             3: 
        !             4:        Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)
        !             5: */
        !             6: 
        !             7: #ifndef PA_VCALLER_WRAPPER_H
        !             8: #define PA_VCALLER_WRAPPER_H
        !             9: 
        !            10: #include "pa_value.h"
        !            11: #include "pa_vmethod_frame.h"
        !            12: 
        !            13: #define IDENT_PA_VCALLER_WRAPPER_H "$Id: pa_vcaller.h,v 1.1 2016/11/03 16:17:38 moko Exp $"
        !            14: 
        !            15: class VCallerWrapper: public Value {
        !            16:        VMethodFrame &fcaller;
        !            17: 
        !            18: public: // Value
        !            19: 
        !            20:        override const char* type() const { return "caller"; }
        !            21: 
        !            22:        /// VCaller: transparent
        !            23:        override VStateless_class* get_class() { return caller().get_class(); }
        !            24: 
        !            25:        /// VCaller: transparent
        !            26:        override VStateless_class* base() { return caller().base(); }
        !            27: 
        !            28:        /// VCaller: empty string to disable $backup[$caller]
        !            29:        override const String* get_string() { return &String::Empty; }
        !            30: 
        !            31:        /// VCaller: method or transparent
        !            32:        override Value* get_element(const String& aname) {
        !            33:                if(SYMBOLS_EQ(aname,METHOD_SYMBOL))
        !            34:                        return caller().method.get_vjunction(caller().self());
        !            35: 
        !            36:                return caller().get_element(aname);
        !            37:        }
        !            38: 
        !            39:        /// VCaller: transparent
        !            40:        override const VJunction* put_element(const String& aname, Value* avalue) { return caller().put_element(aname, avalue); }
        !            41: 
        !            42: public: // usage
        !            43: 
        !            44:        VCallerWrapper(VMethodFrame &acaller): fcaller(acaller) {}
        !            45: 
        !            46:        VMethodFrame &caller() { return fcaller; }
        !            47: 
        !            48: };
        !            49: 
        !            50: #endif

E-mail: