KHTML
IntSizeHash.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2006 Apple Computer, Inc. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 * 00019 */ 00020 #ifndef IntSizeHash_h 00021 #define IntSizeHash_h 00022 00023 #include "IntSize.h" 00024 #include <wtf/HashMap.h> 00025 #include <wtf/HashSet.h> 00026 00027 using WebCore::IntSize; 00028 00029 namespace WTF { 00030 00031 template<> struct IntHash<IntSize> { 00032 static unsigned hash(const IntSize& key) { return intHash((static_cast<uint64_t>(key.width()) << 32 | key.height())); } 00033 static bool equal(const IntSize& a, const IntSize& b) { return a == b; } 00034 00035 static const bool safeToCompareToEmptyOrDeleted = true; 00036 }; 00037 template<> struct DefaultHash<IntSize> { typedef IntHash<IntSize> Hash; }; 00038 00039 template<> struct HashTraits<IntSize> : GenericHashTraits<IntSize> { 00040 static const bool emptyValueIsZero = true; 00041 static const bool needsDestruction = false; 00042 static const bool needsRef = false; 00043 static IntSize deletedValue() { return IntSize(-1, -1); } 00044 }; 00045 } // namespace WTF 00046 00047 #endif
KDE 4.6 API Reference