Annotation of parser3/src/types/pa_vjunction.h, revision 1.38

1.3       paf         1: /**    @file
1.4       paf         2:        Parser: @b junction class decl.
1.3       paf         3: 
1.38    ! moko        4:        Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com)
        !             5:        Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.1       paf         6: */
                      7: 
                      8: #ifndef PA_VJUNCTION_H
                      9: #define PA_VJUNCTION_H
1.14      paf        10: 
1.38    ! moko       11: #define IDENT_PA_VJUNCTION_H "$Id: pa_vjunction.h,v 1.37 2020/12/15 17:10:41 moko Exp $"
1.20      paf        12: 
                     13: // include
1.1       paf        14: 
                     15: #include "pa_value.h"
1.20      paf        16: #include "pa_junction.h"
1.1       paf        17: 
1.30      misha      18: #define JUNCTION_CLASS_NAME "junction"
                     19: static const String junction_class_name(JUNCTION_CLASS_NAME);
                     20: 
1.4       paf        21: /// junction is method+self+context, implemented with Junction
1.20      paf        22: class VJunction: public Value {
1.1       paf        23: public: // VJunction
                     24: 
1.30      misha      25:        override const char* type() const { return JUNCTION_CLASS_NAME; }
1.13      paf        26: 
                     27:        /// VJunction: 0
1.20      paf        28:        override VStateless_class *get_class() { return 0; }
1.8       parser     29: 
1.18      paf        30:        /// VJunction: false
1.20      paf        31:        override bool is_defined() const { return false; }
1.8       parser     32: 
1.18      paf        33:        /// VJunction: false
1.32      moko       34:        override bool as_bool() const { return false; }
1.18      paf        35: 
                     36:        /// VJunction: false
1.32      moko       37:        override Value& as_expr_result();
1.1       paf        38: 
1.5       paf        39:        /// VJunction: method, root,self,rcontext, code
1.23      paf        40:        override Junction* get_junction() { return &fjunction; }
1.1       paf        41: 
1.35      moko       42:        // VJunction: CLASS, CLASS_NAME, name
1.30      misha      43:        override Value* get_element(const String& aname);
                     44: 
1.1       paf        45: public: // usage
                     46: 
1.23      paf        47:        /// Code-Junction constructor
                     48:        VJunction(Value& aself,
                     49:                const Method* amethod,
                     50:                VMethodFrame* amethod_frame,
                     51:                Value* arcontext,
                     52:                WContext* awcontext,
                     53:                ArrayOperation* acode): fjunction(aself, amethod, amethod_frame, arcontext, awcontext, acode) {}
                     54: 
                     55:        /// Method-Junction or Getter-Junction constructor
                     56:        VJunction(Value& aself,
                     57:                const Method* amethod,
1.26      misha      58:                bool ais_getter=false,
                     59:                String* aauto_name=0
                     60:        ): fjunction(aself, amethod, ais_getter, aauto_name) {}
1.23      paf        61: 
                     62:        const Junction& junction() const { return fjunction; }
1.1       paf        63: 
1.27      misha      64:        inline VJunction *get(Value& aself){
                     65:                return &(fjunction.self)==&aself?this:new VJunction(aself, fjunction.method);
                     66:        }
                     67: 
1.28      misha      68:        void reattach(WContext *new_wcontext);
                     69: 
1.1       paf        70: private:
                     71: 
1.23      paf        72:        Junction fjunction;
1.1       paf        73: };
                     74: 
                     75: 
                     76: #endif

E-mail: