/usr/include/dclib-0.3/dclib/core/cstringhash.h is in libdc-dev 0.3.24~svn3121-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /***************************************************************************
cstringhash.h - DCLib CString Hash function for STL unordered_map/set
-------------------
begin : Fri Jun 27 2008
copyright : (C) 2008 by Edward Sheldrake
email : ejs1920@yahoo.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CSTRINGHASH_H
#define CSTRINGHASH_H
// <dclib/dclib-stl-use.h> plus the correct <tr1/unordered_map>
// or <unordered_map> headers must be included before this file
#include <dclib/core/cstring.h>
// ok so adding a hash function for CString to the standard namespace
// is probably not the best solution... but it makes CString easier
// to use until it's replaced with std::string
namespace std
{
#if ( DCLIB_USES_TR1_UNORDERED_MAP == 1 ) || ( DCLIB_USES_TR1_UNORDERED_SET == 1 )
namespace tr1
{
#endif
// this is the same as the hash function for a std::string
// but it probably only works with recent GCC since
// _Fnv_hash is probably not part of any API
template<>
struct hash<const CString &>
{
size_t operator() (const CString & s) const
{
#if DCLIB_FNV_HASH_IS_PREFIXED == 1
#if DCLIB_FNV_HASH_IS_TEMPLATE == 1
return _Fnv_hash<>::hash( s.Data(), s.Length() );
#else
return _Fnv_hash::hash( s.Data(), s.Length() );
#endif
#else /* DCLIB_FNV_HASH_IS_PREFIXED */
#if DCLIB_FNV_HASH_IS_TEMPLATE == 1
return Fnv_hash<>::hash( s.Data(), s.Length() );
#else
return Fnv_hash::hash( s.Data(), s.Length() );
#endif
#endif /* DCLIB_FNV_HASH_IS_PREFIXED */
}
};
template<>
struct hash<CString>
{
size_t operator() (CString s) const
{
#if DCLIB_FNV_HASH_IS_PREFIXED == 1
#if DCLIB_FNV_HASH_IS_TEMPLATE == 1
return _Fnv_hash<>::hash( s.Data(), s.Length() );
#else
return _Fnv_hash::hash( s.Data(), s.Length() );
#endif
#else /* DCLIB_FNV_HASH_IS_PREFIXED */
#if DCLIB_FNV_HASH_IS_TEMPLATE == 1
return Fnv_hash<>::hash( s.Data(), s.Length() );
#else
return Fnv_hash::hash( s.Data(), s.Length() );
#endif
#endif /* DCLIB_FNV_HASH_IS_PREFIXED */
}
};
#if ( DCLIB_USES_TR1_UNORDERED_MAP == 1 ) || ( DCLIB_USES_TR1_UNORDERED_SET == 1 )
}
#endif
}
#endif // CSTRINGHASH_H
|