--- parser3/src/include/pa_hash.h 2002/02/08 07:27:44 1.53 +++ parser3/src/include/pa_hash.h 2003/01/21 15:51:10 1.58 @@ -1,16 +1,16 @@ /** @file Parser: hash class decl. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) - - $Id: pa_hash.h,v 1.53 2002/02/08 07:27:44 paf Exp $ + Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_HASH_H #define PA_HASH_H +static const char* IDENT_HASH_H="$Date: 2003/01/21 15:51:10 $"; + #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