Annotation of parser3/src/include/pa_wcontext.h, revision 1.28

1.1       paf         1: /*
1.28    ! paf         2:        Parser
        !             3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             4:        Author: Alexander Petrosyan <paf@design.ru>
        !             5: 
        !             6:        $Id: pa_string.C,v 1.35 2001/03/10 12:12:51 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #ifndef PA_WCONTEXT_H
                     10: #define PA_WCONTEXT_H
                     11: 
1.13      paf        12: #include "pa_value.h"
                     13: #include "pa_vstring.h"
                     14: #include "pa_vhash.h"
1.1       paf        15: 
1.25      paf        16: class Request;
                     17: 
1.13      paf        18: class WContext : public Value {
1.25      paf        19:        friend Request;
1.2       paf        20: public: // Value
                     21: 
                     22:        // all: for error reporting after fail(), etc
1.21      paf        23:        const char *type() const { return "wcontext"; }
1.22      paf        24:        // WContext: accumulated fstring
1.26      paf        25:        const String *get_string() { return &fstring; };
1.18      paf        26: 
                     27:        // WContext: none yet | transparent
                     28:        VClass *get_class() { return fvalue?fvalue->get_class():0; }
1.19      paf        29:        // wcontext: transparent
1.20      paf        30:        VAliased *get_aliased() { return fvalue?fvalue->get_aliased():0; }
1.13      paf        31: 
1.14      paf        32: public: // WContext
                     33: 
1.22      paf        34:        // appends a fstring to result
1.26      paf        35:        virtual void write(const String& astring, String::Untaint_lang lang);
1.14      paf        36: 
1.22      paf        37:        // if value is VString writes fstring,
1.14      paf        38:        // else writes Value; raises an error if already
1.27      paf        39:        virtual void write(Value& avalue, String::Untaint_lang lang);
1.14      paf        40: 
1.13      paf        41: public: // usage
                     42: 
1.17      paf        43:        WContext(Pool& apool, Value *avalue, bool aconstructing) : Value(apool), 
1.13      paf        44:                fvalue(avalue),
1.17      paf        45:                fconstructing(aconstructing),
1.22      paf        46:                fstring(*new(apool) String(apool)) {
1.10      paf        47:        }
                     48: 
1.17      paf        49:        bool constructing() { return fconstructing; }
                     50: 
1.13      paf        51:        // retrives the resulting value
                     52:        // that can be VString if value==0 or the Value object
1.15      paf        53:        Value *result() const {
1.22      paf        54:                return fvalue?fvalue:NEW VString(fstring);
1.1       paf        55:        }
1.13      paf        56: 
                     57: protected:
                     58:        Value *fvalue;
1.1       paf        59: private:
1.17      paf        60:        bool fconstructing;
1.22      paf        61:        String& fstring;
1.1       paf        62: };
                     63: 
                     64: #endif

E-mail: