Annotation of parser3/src/types/pa_vhash.h, revision 1.6

1.1       paf         1: /*
                      2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.3       paf         4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1       paf         5: 
1.6     ! paf         6:        $Id: pa_vhash.h,v 1.5 2001/03/16 09:26:45 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #ifndef PA_VHASH_H
                     10: #define PA_VHASH_H
                     11: 
                     12: #include "pa_value.h"
                     13: #include "pa_hash.h"
                     14: 
                     15: class VHash : public Value {
                     16: public: // value
                     17: 
                     18:        // all: for error reporting after fail(), etc
1.2       paf        19:        const char *type() const { return "hash"; }
1.1       paf        20: 
1.6     ! paf        21:        // hash: (key)=value
1.1       paf        22:        Value *get_element(const String& name) { 
1.5       paf        23:                return static_cast<Value *>(fhash.get(name));
1.1       paf        24:        }
                     25:        
1.6     ! paf        26:        // hash: (key)=value
1.1       paf        27:        void put_element(const String& name, Value *value) { 
1.5       paf        28:                fhash.put(name, value);
1.1       paf        29:        }
                     30: 
                     31: public: // usage
                     32: 
1.4       paf        33:        VHash(Pool& apool, Hash *ahash=0) : Value(apool), 
1.5       paf        34:                fhash(ahash?*ahash:*new(apool) Hash(apool)) {}
1.1       paf        35: 
                     36: private:
1.6     ! paf        37: 
1.5       paf        38:        Hash& fhash;
1.6     ! paf        39: 
1.1       paf        40: };
                     41: 
                     42: #endif

E-mail: