--- parser3/src/include/pa_hash.h 2001/12/15 21:28:19 1.52 +++ parser3/src/include/pa_hash.h 2002/08/01 11:26:47 1.56 @@ -1,16 +1,16 @@ /** @file Parser: hash class decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) - - $Id: pa_hash.h,v 1.52 2001/12/15 21:28:19 paf Exp $ + Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_HASH_H #define PA_HASH_H +static const char* IDENT_HASH_H="$Id: pa_hash.h,v 1.56 2002/08/01 11:26:47 paf Exp $"; + #include "pa_pool.h" #include "pa_types.h" #include "pa_string.h" @@ -160,5 +160,21 @@ private: //disabled Hash& operator = (const Hash&) { return *this; } }; +/// Auto-object used for temporarily substituting/removing hash values +class Temp_hash_value { + Hash& fhash; + const Hash::Key& fname; + Hash::Val *saved_value; +public: + Temp_hash_value(Hash& ahash, const Hash::Key& aname, Hash::Val *avalue) : + fhash(ahash), + fname(aname), + saved_value(ahash.get(aname)) { + fhash.put(aname, avalue); + } + ~Temp_hash_value() { + fhash.put(fname, saved_value); + } +}; #endif