Annotation of parser3/src/types/pa_vcode_frame.h, revision 1.9

1.2       paf         1: /**    @file
1.3       paf         2:        Parser: @b code_frame write wrapper write context
1.2       paf         3: 
1.1       paf         4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      5:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      6: 
1.9     ! parser      7:        $Id: pa_vcode_frame.h,v 1.8 2001/09/26 10:32:26 parser Exp $
1.1       paf         8: */
                      9: 
                     10: #ifndef PA_VCODE_FRAME_H
                     11: #define PA_VCODE_FRAME_H
                     12: 
1.9     ! parser     13: #include "pa_wcontext.h"
1.6       parser     14: #include "pa_vvoid.h"
1.1       paf        15: 
1.9     ! parser     16: /// specialized write wrapper, completely transparent, but intercepting string writes
        !            17: class VCodeFrame : public WContext {
1.1       paf        18: public: // Value
                     19: 
                     20:        const char *type() const { return "code_frame"; }
1.9     ! parser     21:        /// VCodeFrame: twice transparent
        !            22:        Value *get_element(const String& name) { return wcontext.get_element(name); }
        !            23:        /// VCodeFrame: twice transparent
        !            24:        void put_element(const String& name, Value *value){ wcontext.put_element(name, value); }
1.1       paf        25: 
                     26: public: // WContext
                     27: 
1.2       paf        28:        /// VCodeFrame: intercepting string writes 
1.9     ! parser     29:        virtual void write(const String& string, String::Untaint_lang lang) {
        !            30:                fstring.append(string, lang);
        !            31:        }
        !            32: 
        !            33:        /// VCodeFrame: twice transparent
        !            34:        virtual void write(Value& value) {
        !            35:                // ^method[^if(){$hash}
        !            36:                wcontext.write(value);
        !            37:        }
        !            38: 
        !            39:        /// VCodeFrame: twice transparent
        !            40:        virtual void write(Value& value, String::Untaint_lang lang) {
        !            41:                wcontext.write(value, lang);
1.1       paf        42:        }
                     43: 
                     44: public: // usage
                     45: 
                     46:        VCodeFrame(Pool& apool, WContext& awcontext) : 
1.9     ! parser     47:                WContext(apool, &awcontext),
        !            48:                wcontext(awcontext) {
1.1       paf        49:        }
1.9     ! parser     50: 
        !            51: private:
        !            52: 
        !            53:        WContext& wcontext;
1.1       paf        54: 
                     55: };
                     56: 
                     57: #endif

E-mail: