WvStreams
wvhash.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Common hash functions for use with wvscatterhash.h and wvhashtable.h.
6  */
7 #ifndef __WVHASH_H
8 #define __WVHASH_H
9 
10 #include "wvstring.h"
11 
12 // predefined hashing functions (note: string hashes are case-insensitive)
13 unsigned WvHash(WvStringParm s);
14 unsigned WvHash(const char *s);
15 unsigned WvHash(const int &i);
16 unsigned WvHash(const void *p);
17 
18 
19 // Default comparison function used by WvHashTable
20 template <class K>
21 struct OpEqComp
22 {
23  static bool compare(const K *key1, const K *key2)
24  { return *key1 == *key2; }
25 };
26 
27 
28 // Case-insensitive comparison function for WvHashTable
29 template <class K>
31 {
32  static bool compare(const K *key1, const K *key2)
33  { return strcasecmp(*key1, *key2) == 0; }
34 };
35 
36 #endif // __WVHASH_H
StrCaseComp
Definition: wvhash.h:30
OpEqComp
Definition: wvhash.h:21