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

1.1       paf         1: /*
1.6     ! paf         2:   $Id: pa_vhash.h,v 1.5 2001/03/07 13:54:46 paf Exp $
1.1       paf         3: */
                      4: 
                      5: #ifndef PA_VHASH_H
                      6: #define PA_VHASH_H
                      7: 
                      8: #include "pa_value.h"
1.2       paf         9: #include "pa_hash.h"
1.1       paf        10: 
                     11: class VHash : public Value {
                     12: public: // value
                     13: 
                     14:        // all: for error reporting after fail(), etc
1.3       paf        15:        const char *type() const { return "hash"; }
1.1       paf        16: 
                     17:        // hash: (key)=value
1.6     ! paf        18:        Value *get_element(const String& name) { 
1.1       paf        19:                return static_cast<Value *>(hash.get(name));
                     20:        }
                     21:        
                     22:        // hash: (key)=value
                     23:        void put_element(const String& name, Value *value) { 
                     24:                hash.put(name, value);
                     25:        }
1.4       paf        26: 
                     27:        // hash: size!=0
                     28:        bool get_bool() { return hash.size()!=0; }
1.1       paf        29: 
                     30: public: // usage
                     31: 
                     32:        VHash(Pool& apool) : Value(apool), hash(apool) {}
                     33: 
                     34: private:
                     35:        Hash hash;
                     36: };
                     37: 
                     38: #endif

E-mail: