Annotation of parser3/src/types/pa_venv.h, revision 1.2

1.2     ! paf         1: /*
        !             2:        Parser
        !             3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
        !             5: 
        !             6:        $Id: pa_venv.h,v 1.1.2.1 2001/03/13 13:40:01 paf Exp $
        !             7: */
        !             8: 
        !             9: #ifndef PA_VENV_H
        !            10: #define PA_VENV_H
        !            11: 
        !            12: #include "pa_vstateless_object.h"
        !            13: #include "pa_vhash.h"
        !            14: #include "pa_vjunction.h"
        !            15: 
        !            16: class VEnv : public VClass {
        !            17: public: // Value
        !            18:        
        !            19:        // all: for error reporting after fail(), etc
        !            20:        const char *type() const { return "env"; }
        !            21: 
        !            22:        // env: CLASS,BASE,method,field
        !            23:        Value *get_element(const String& aname) {
        !            24:                // $CLASS,$BASE,$method
        !            25:                if(Value *result=VStateless_object::get_element(aname))
        !            26:                        return result;
        !            27: 
        !            28:                String& string=*new(pool) String(pool);
        !            29:                char *file="environment";
        !            30:                int line=3;
        !            31:                char *value="<value>";// TODO: getenv
        !            32:                string.APPEND_TAINTED(value, 0, file, line);
        !            33:                return new(pool) VString(string));
        !            34:        }
        !            35: 
        !            36:        // env: read-only
        !            37:        void put_element(const String& name, Value *value) {
        !            38:                bark("(%s) is read-only");
        !            39:        }
        !            40: 
        !            41: public: // usage
        !            42: 
        !            43:        VEnv(Pool& apool) : VStateless_object(apool, *env_class) {
        !            44:        }
        !            45: 
        !            46: private:
        !            47: };
        !            48: 
        !            49: #endif

E-mail: