|
|
| version 1.64.2.4, 2005/07/28 10:02:26 | version 1.67, 2007/05/18 12:44:00 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: hash class decl. | 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 <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 126 public: | Line 126 public: |
| } | } |
| // proper pair not found | // proper pair not found |
| // prevent-function intercepted put? | // prevent-function intercepted append? |
| if(R result=prevent(value, info)) | if(R result=prevent(value, info)) |
| return result; | return result; |
| Line 159 public: | Line 159 public: |
| if(pair->code==code && pair->key==key) { | if(pair->code==code && pair->key==key) { |
| // found a pair with the same key | // found a pair with the same key |
| // prevent-function intercepted put? | // prevent-function intercepted replace? |
| if(R result=prevent_replace(pair->value, info)) | if(R result=prevent_replace(pair->value, info)) |
| return result; | return result; |
| Line 168 public: | Line 168 public: |
| } | } |
| // proper pair not found | // proper pair not found |
| // prevent-function intercepted put? | // prevent-function intercepted append? |
| if(R result=prevent_append(value, info)) | if(R result=prevent_append(value, info)) |
| return result; | return result; |
| Line 201 public: | Line 201 public: |
| if(pair->code==code && pair->key==key) { | if(pair->code==code && pair->key==key) { |
| // found a pair with the same key | // found a pair with the same key |
| // prevent-function intercepted put? | // prevent-function intercepted replace? |
| if(R result=prevent_replace(pair->value, info)) | if(R result=prevent_replace(pair->value, info)) |
| return result; | return result; |
| Line 229 public: | Line 229 public: |
| return false; | 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] | /// get associated [value] by the [key] |
| V get(K key) const { | V get(K key) const { |
| uint code=hash_code(key); | uint code=hash_code(key); |