Annotation of parser3/src/types/pa_wcontext.h, revision 1.3

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

E-mail: