Annotation of parser3/src/types/pa_vcode_frame.h, revision 1.19
1.2 paf 1: /** @file
1.3 paf 2: Parser: @b code_frame write wrapper write context
1.2 paf 3:
1.13 paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.14 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
8: #ifndef PA_VCODE_FRAME_H
9: #define PA_VCODE_FRAME_H
1.15 paf 10:
1.19 ! paf 11: static const char* IDENT_VCODE_FRAME_H="$Date: 2002/08/07 13:27:16 $";
1.1 paf 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
1.19 ! paf 22: Value *get_element(const String& aname, Value *aself) { return wcontext.get_element(aname, aself); }
1.9 parser 23: /// VCodeFrame: twice transparent
1.19 ! paf 24: /*override*/ bool put_element(const String& aname, Value *avalue, bool replace) {
1.10 parser 25: // $hash[^if(1){$.field[]}]
26: // put goes to $hash
1.19 ! paf 27: return wcontext.put_element(aname, avalue, replace);
1.10 parser 28: }
1.1 paf 29:
30: public: // WContext
31:
1.2 paf 32: /// VCodeFrame: intercepting string writes
1.18 paf 33: void write(const String& string, uchar lang) {
1.9 parser 34: fstring.append(string, lang);
35: }
36:
1.11 parser 37: /** VCodeFrame: twice transparent
38:
39: if value is VString writes fstring,
40: else writes Value; raises an error if already
1.17 paf 41:
42: $hash[^if(1){$hash}]
1.11 parser 43: */
1.17 paf 44: void write(Value& avalue, const String* aorigin) {
45: if(const String *fstring=avalue.get_string())
46: write(*fstring, String::UL_PASS_APPENDED);
1.11 parser 47: else
1.17 paf 48: wcontext.write(avalue, aorigin);
1.1 paf 49: }
1.17 paf 50:
1.1 paf 51:
52: public: // usage
53:
54: VCodeFrame(Pool& apool, WContext& awcontext) :
1.9 parser 55: WContext(apool, &awcontext),
56: wcontext(awcontext) {
1.1 paf 57: }
1.9 parser 58:
59: private:
60:
61: WContext& wcontext;
1.1 paf 62:
63: };
64:
65: #endif
E-mail: