Annotation of parser3/src/types/pa_vcode_frame.h, revision 1.10
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.10 ! parser 7: $Id: pa_vcode_frame.h,v 1.9 2001/10/13 15:59:43 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
1.10 ! parser 24: void put_element(const String& name, Value *value){
! 25: // $hash[^if(1){$.field[]}]
! 26: // put goes to $hash
! 27: wcontext.put_element(name, value);
! 28: }
1.1 paf 29:
30: public: // WContext
31:
1.2 paf 32: /// VCodeFrame: intercepting string writes
1.9 parser 33: virtual void write(const String& string, String::Untaint_lang lang) {
34: fstring.append(string, lang);
35: }
36:
37: /// VCodeFrame: twice transparent
38: virtual void write(Value& value) {
1.10 ! parser 39: // ^method[^if(1){$hash}]
! 40: // write goes ^method[here]
1.9 parser 41: wcontext.write(value);
42: }
43:
44: /// VCodeFrame: twice transparent
45: virtual void write(Value& value, String::Untaint_lang lang) {
46: wcontext.write(value, lang);
1.1 paf 47: }
48:
49: public: // usage
50:
51: VCodeFrame(Pool& apool, WContext& awcontext) :
1.9 parser 52: WContext(apool, &awcontext),
53: wcontext(awcontext) {
1.1 paf 54: }
1.9 parser 55:
56: private:
57:
58: WContext& wcontext;
1.1 paf 59:
60: };
61:
62: #endif
E-mail: