wvdbusserver: implement NameHasOwner request.
[wvstreams.git] / include / wvhash.h
blobf41cc4e83637464dcf69ae7a743b08af9b485ad6
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * Common hash functions for use with wvscatterhash.h and wvhashtable.h.
6 */
7 #ifndef __WVHASH_H
8 #define __WVHASH_H
10 #include "wvstring.h"
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);
19 // Default comparison function used by WvHashTable
20 template <class K>
21 struct OpEqComp
23 static bool compare(const K *key1, const K *key2)
24 { return *key1 == *key2; }
28 // Case-insensitive comparison function for WvHashTable
29 template <class K>
30 struct StrCaseComp
32 static bool compare(const K *key1, const K *key2)
33 { return strcasecmp(*key1, *key2) == 0; }
36 #endif // __WVHASH_H