35 #ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__ 36 #define GOOGLE_PROTOBUF_STUBS_HASH_H__ 41 #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 42 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 45 #if defined(__ANDROID__) 46 # undef GOOGLE_PROTOBUF_HAVE_HASH_MAP 47 # undef GOOGLE_PROTOBUF_HAVE_HASH_MAP 50 #elif ((_LIBCPP_STD_VER >= 11) || \ 51 (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ 52 (__GLIBCXX__ > 20090421))) 53 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH 63 #elif defined(__APPLE_CC__) 65 # define GOOGLE_PROTOBUF_HAS_TR1 68 # define GOOGLE_PROTOBUF_HASH_NAMESPACE __gnu_cxx 69 # include <ext/hash_map> 70 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 71 # include <ext/hash_set> 72 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 76 #elif defined(__GNUC__) 81 # define GOOGLE_PROTOBUF_HAS_TR1 83 # include <backward/hash_map> 84 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 85 # include <backward/hash_set> 86 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 87 # if __GNUC__ == 3 && __GNUC_MINOR__ == 0 88 # define GOOGLE_PROTOBUF_HASH_NAMESPACE std // GCC 3.0 90 # define GOOGLE_PROTOBUF_HASH_NAMESPACE __gnu_cxx // GCC 3.1 and later 93 # define GOOGLE_PROTOBUF_HASH_NAMESPACE 95 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 97 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 106 #elif defined(_MSC_VER) 107 # if _MSC_VER >= 1600 // Since Visual Studio 2010 108 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH 109 # define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare 110 # elif _MSC_VER >= 1500 // Since Visual Studio 2008 111 # define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext 113 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 115 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 116 # define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare 117 # define GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE 118 # elif _MSC_VER >= 1310 119 # define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext 121 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 123 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 124 # define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare 126 # define GOOGLE_PROTOBUF_HASH_NAMESPACE std 128 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map 130 # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set 131 # define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare 138 # undef GOOGLE_PROTOBUF_HAVE_HASH_MAP 139 # undef GOOGLE_PROTOBUF_HAVE_HASH_SET 142 #if defined(GOOGLE_PROTOBUF_HAS_CXX11_HASH) 143 # define GOOGLE_PROTOBUF_HASH_NAMESPACE std 144 # include <unordered_map> 145 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS unordered_map 146 # include <unordered_set> 147 # define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set 148 #elif defined(GOOGLE_PROTOBUF_HAS_TR1) 149 # define GOOGLE_PROTOBUF_HASH_NAMESPACE std::tr1 150 # include <tr1/unordered_map> 151 # define GOOGLE_PROTOBUF_HASH_MAP_CLASS unordered_map 152 # include <tr1/unordered_set> 153 # define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set 156 # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \ 159 # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }} 161 #undef GOOGLE_PROTOBUF_HAS_CXX11_HASH 162 #undef GOOGLE_PROTOBUF_HAS_TR1 164 #if defined(GOOGLE_PROTOBUF_HAVE_HASH_MAP) && \ 165 defined(GOOGLE_PROTOBUF_HAVE_HASH_SET) 167 #define GOOGLE_PROTOBUF_MISSING_HASH 175 #ifdef GOOGLE_PROTOBUF_MISSING_HASH 176 #undef GOOGLE_PROTOBUF_MISSING_HASH 184 template <
typename Key>
207 return strcmp(a, b) < 0;
211 template <
typename Key,
typename Data,
213 typename EqualKey = std::equal_to<Key>,
214 typename Alloc = std::allocator< std::pair<const Key, Data> > >
216 typedef std::map<Key, Data, HashFcn, Alloc> BaseClass;
220 const EqualKey&
c = EqualKey(),
221 const Alloc&
d = Alloc()) : BaseClass(
b,
d) {}
226 template <
typename Key,
228 typename EqualKey = std::equal_to<Key> >
236 #elif defined(_MSC_VER) && !defined(_STLPORT_VERSION) 238 template <
typename Key>
239 struct hash :
public GOOGLE_PROTOBUF_HASH_COMPARE<Key> {
246 inline bool operator()(
const char*
a,
const char*
b)
const {
247 return strcmp(a, b) < 0;
252 struct hash<const char*>
253 :
public GOOGLE_PROTOBUF_HASH_COMPARE<const char*, CstringLess> {};
255 #ifdef GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE 257 template <
typename Key,
typename HashFcn,
typename EqualKey>
258 struct InternalHashCompare :
public GOOGLE_PROTOBUF_HASH_COMPARE<Key> {
259 InternalHashCompare() {}
260 InternalHashCompare(HashFcn hashfcn, EqualKey equalkey)
261 : hashfcn_(hashfcn), equalkey_(equalkey) {}
264 return !equalkey_(key1, key2);
270 template <
typename Key,
typename Data,
272 typename EqualKey = std::equal_to<Key>,
273 typename Alloc = std::allocator< std::pair<const Key, Data> > >
275 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
276 Key, Data, InternalHashCompare<Key, HashFcn, EqualKey>, Alloc> {
277 typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
278 Key, Data, InternalHashCompare<Key, HashFcn, EqualKey>, Alloc> BaseClass;
281 hash_map(
int a = 0,
const HashFcn&
b = HashFcn(),
282 const EqualKey&
c = EqualKey(),
const Alloc&
d = Alloc())
283 : BaseClass(InternalHashCompare<Key, HashFcn, EqualKey>(
b,
c),
d) {}
285 HashFcn hash_function()
const {
return HashFcn(); }
288 template <
typename Key,
typename HashFcn = hash<Key>,
289 typename EqualKey = std::equal_to<Key> >
291 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS<
292 Key, InternalHashCompare<Key, HashFcn, EqualKey> > {
296 HashFcn hash_function()
const {
return HashFcn(); }
299 #else // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE 301 template <
typename Key,
typename Data,
303 typename EqualKey = std::equal_to<Key>,
304 typename Alloc = std::allocator< std::pair<const Key, Data> > >
306 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
307 Key, Data, HashFcn, EqualKey, Alloc> {
308 typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
309 Key, Data, HashFcn, EqualKey, Alloc> BaseClass;
312 hash_map(
int a = 0,
const HashFcn&
b = HashFcn(),
313 const EqualKey&
c = EqualKey(),
314 const Alloc&
d = Alloc()) : BaseClass(
a,
b,
c,
d) {}
316 HashFcn hash_function()
const {
return HashFcn(); }
319 template <
typename Key,
typename HashFcn = hash<Key>,
320 typename EqualKey = std::equal_to<Key> >
322 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS<
323 Key, HashFcn, EqualKey> {
327 HashFcn hash_function()
const {
return HashFcn(); }
329 #endif // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE 331 #else // defined(_MSC_VER) && !defined(_STLPORT_VERSION) 333 template <
typename Key>
337 template <
typename Key>
338 struct hash<const Key*> {
340 return reinterpret_cast<size_t>(
key);
347 struct hash<const char*> {
350 for (; *str !=
'\0'; str++) {
351 result = 5 * result + *
str;
360 return static_cast<size_t>(
x);
364 template <
typename Key,
typename Data,
366 typename EqualKey = std::equal_to<Key>,
367 typename Alloc = std::allocator< std::pair<const Key, Data> > >
369 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
370 Key, Data, HashFcn, EqualKey, Alloc> {
371 typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
372 Key, Data, HashFcn, EqualKey, Alloc> BaseClass;
375 hash_map(
int a = 0,
const HashFcn&
b = HashFcn(),
376 const EqualKey&
c = EqualKey(),
377 const Alloc&
d = Alloc()) : BaseClass(
a,
b,
c,
d) {}
379 HashFcn hash_function()
const {
return HashFcn(); }
382 template <
typename Key,
typename HashFcn = hash<Key>,
383 typename EqualKey = std::equal_to<Key> >
385 :
public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS<
386 Key, HashFcn, EqualKey> {
390 HashFcn hash_function()
const {
return HashFcn(); }
393 #endif // !GOOGLE_PROTOBUF_MISSING_HASH 401 static const size_t bucket_size = 4;
402 static const size_t min_buckets = 8;
408 template <
typename First,
typename Second>
416 return first_hash * ((1 << 16) - 1) + second_hash;
419 static const size_t bucket_size = 4;
420 static const size_t min_buckets = 8;
422 const pair<First, Second>&
b)
const {
431 return strcmp(a, b) == 0;
438 #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ hash_set(int=0)
Definition: hash.h:231
size_t operator()(const string &key) const
Definition: hash.h:397
int operator()(const Key &key)
Definition: hash.h:187
required HashAlgorithmIdentifier hash
Definition: WebCryptoAPI.idl:276
int c
Definition: cpp_unittests.cpp:275
#define GOOGLE_LOG(LEVEL)
Definition: logging.h:144
typename detail::make_map< Ts... >::type map
Definition: Brigand.h:223
HashFcn hash_function() const
Definition: hash.h:233
hash_map(int a=0, const HashFcn &b=HashFcn(), const EqualKey &c=EqualKey(), const Alloc &d=Alloc())
Definition: hash.h:219
int operator()(const char *key)
Definition: hash.h:201
size_t operator()(const pair< First, Second > &key) const
Definition: hash.h:410
bool operator()(const string &a, const string &b) const
Definition: hash.h:403
EGLSurface EGLint x
Definition: eglext.h:950
HashFcn hash_function() const
Definition: hash.h:223
bool operator()(const Key &a, const Key &b) const
Definition: hash.h:192
Definition: RTCStatsReport.idl:41
#define FATAL(...)
Definition: Assertions.h:388
bool operator()(const char *a, const char *b) const
Definition: hash.h:206
bool operator()(const char *a, const char *b) const
Definition: hash.h:430
Definition: __init__.py:1
GLboolean GLboolean GLboolean GLboolean a
Definition: gl2ext.h:306
EGLSetBlobFuncANDROID set
Definition: eglext.h:426
str
Definition: make-dist.py:305
GLsizei const GLchar *const * string
Definition: gl2.h:479
result
Definition: target-blank-opener-post-window.php:5
bool operator()(const pair< First, Second > &a, const pair< First, Second > &b) const
Definition: hash.h:421
const
Definition: upload.py:398
Key
Definition: keyboard.h:10
GLboolean GLboolean GLboolean b
Definition: gl2ext.h:306
Definition: gflags_completions.h:115
CFArrayRef CFTypeRef key
Definition: AVFoundationCFSoftLinking.h:129
Definition: WebKitWebViewSessionState.cpp:89
#define d
Definition: float-mm.c:30
const uint16_t key1[47]
Definition: auth_driver.c:64