Annotation of parser3/src/types/pa_vhash.h, revision 1.11
1.10 paf 1: /** @file
2: Parser: @b hash parser type decl.
3:
1.1 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.3 paf 5: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1 paf 6:
1.11 ! paf 7: $Id: pa_vhash.h,v 1.10 2001/04/10 10:32:15 paf Exp $
1.1 paf 8: */
9:
10: #ifndef PA_VHASH_H
11: #define PA_VHASH_H
12:
13: #include "pa_value.h"
14: #include "pa_hash.h"
15:
1.11 ! paf 16: /// value of type 'hash', implemented with Hash
1.1 paf 17: class VHash : public Value {
18: public: // value
19:
1.11 ! paf 20: /// all: for error reporting after fail(), etc
1.2 paf 21: const char *type() const { return "hash"; }
1.1 paf 22:
1.11 ! paf 23: /// VHash: fhash
1.8 paf 24: Hash *get_hash() { return &fhash; }
1.7 paf 25:
1.11 ! paf 26: /// VHash: (key)=value
1.1 paf 27: Value *get_element(const String& name) {
1.5 paf 28: return static_cast<Value *>(fhash.get(name));
1.1 paf 29: }
30:
1.11 ! paf 31: /// VHash: (key)=value
1.1 paf 32: void put_element(const String& name, Value *value) {
1.5 paf 33: fhash.put(name, value);
1.1 paf 34: }
35:
36: public: // usage
37:
1.9 paf 38: VHash(Pool& apool) : Value(apool),
39: fhash(apool) {}
1.7 paf 40:
41: Hash& hash() { return fhash; }
1.1 paf 42:
43: private:
1.6 paf 44:
1.9 paf 45: Hash fhash;
1.6 paf 46:
1.1 paf 47: };
48:
49: #endif
E-mail: