Annotation of parser3/src/types/pa_vhash.h, revision 1.7
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.7 ! paf 6: $Id: pa_vhash.h,v 1.6 2001/03/18 11:37:54 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.7 ! paf 21: // hash: this
! 22: VHash *get_hash() { return this; }
! 23:
1.6 paf 24: // hash: (key)=value
1.1 paf 25: Value *get_element(const String& name) {
1.5 paf 26: return static_cast<Value *>(fhash.get(name));
1.1 paf 27: }
28:
1.6 paf 29: // hash: (key)=value
1.1 paf 30: void put_element(const String& name, Value *value) {
1.5 paf 31: fhash.put(name, value);
1.1 paf 32: }
33:
34: public: // usage
35:
1.4 paf 36: VHash(Pool& apool, Hash *ahash=0) : Value(apool),
1.5 paf 37: fhash(ahash?*ahash:*new(apool) Hash(apool)) {}
1.7 ! paf 38:
! 39: Hash& hash() { return fhash; }
1.1 paf 40:
41: private:
1.6 paf 42:
1.5 paf 43: Hash& fhash;
1.6 paf 44:
1.1 paf 45: };
46:
47: #endif
E-mail: