--- parser3/src/include/pa_hash.h 2005/07/28 11:23:02 1.65 +++ parser3/src/include/pa_hash.h 2007/05/18 12:44:00 1.67 @@ -1,7 +1,7 @@ /** @file Parser: hash class decl. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -17,7 +17,7 @@ #ifndef PA_HASH_H #define PA_HASH_H -static const char * const IDENT_HASH_H="$Date: 2005/07/28 11:23:02 $"; +static const char * const IDENT_HASH_H="$Date: 2007/05/18 12:44:00 $"; #include "pa_memory.h" #include "pa_types.h" @@ -229,6 +229,20 @@ public: return false; } + /// returns exist key or not + bool contain(K key){ + uint code=hash_code(key); + uint index=code%allocated; + for(Pair **ref=&refs[index]; *ref; ref=&(*ref)->link){ + if((*ref)->code==code && (*ref)->key==key) { + return true; + } + } + + return false; + } + + /// get associated [value] by the [key] V get(K key) const { uint code=hash_code(key);