From 41777edb47cada37d04f0842f1527250008b7826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 14 Jan 2010 21:49:53 +0000 Subject: [PATCH] Make more defined classes visible outside the BPrivate namespace when including this header. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35078 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/HashMap.h | 56 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/headers/private/shared/HashMap.h b/headers/private/shared/HashMap.h index b55e0d98d9..36b321f2b8 100644 --- a/headers/private/shared/HashMap.h +++ b/headers/private/shared/HashMap.h @@ -1,17 +1,17 @@ // HashMap.h -// +// // Copyright (c) 2004-2007, Ingo Weinhold (bonefish@cs.tu-berlin.de) -// +// // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation +// to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// +// // Except as contained in this notice, the name of a copyright holder shall // not be used in advertising or otherwise to promote the sale, use or other // dealings in this Software without prior written authorization of the @@ -88,18 +88,19 @@ public: typedef HashMapElement Element; public: Iterator(const Iterator& other) - : fMap(other.fMap), - fIndex(other.fIndex), - fElement(other.fElement), - fLastElement(other.fElement) + : + fMap(other.fMap), + fIndex(other.fIndex), + fElement(other.fElement), + fLastElement(other.fElement) { } - + bool HasNext() const { return fElement; } - + Entry Next() { if (!fElement) @@ -113,7 +114,7 @@ public: { if (fElement == NULL) return NULL; - + Value* value = &fElement->fValue; _FindNext(); return value; @@ -128,7 +129,7 @@ public: fLastElement = NULL; return result; } - + Iterator& operator=(const Iterator& other) { fMap = other.fMap; @@ -137,18 +138,19 @@ public: fLastElement = other.fLastElement; return *this; } - + private: Iterator(const HashMap* map) - : fMap(const_cast*>(map)), - fIndex(0), - fElement(NULL), - fLastElement(NULL) + : + fMap(const_cast*>(map)), + fIndex(0), + fElement(NULL), + fLastElement(NULL) { // find first _FindNext(); } - + void _FindNext() { fLastElement = fElement; @@ -161,10 +163,10 @@ public: for (; !fElement && fIndex < arraySize; fIndex++) fElement = fMap->fTable.FindFirst(fIndex); } - + private: friend class HashMap; - + HashMap* fMap; int32 fIndex; Element* fElement; @@ -345,8 +347,9 @@ struct HashKey64 { // constructor template HashMap::HashMap() - : fElementArray(1000), - fTable(1000, &fElementArray) + : + fElementArray(1000), + fTable(1000, &fElementArray) { } @@ -376,7 +379,7 @@ HashMap::Put(const Key& key, Value value) element->fValue = value; return B_OK; } - // does not contain the key yet: add an element + // does not contain the key yet: add an element element = fTable.Add(key.GetHashCode()); if (!element) return B_NO_MEMORY; @@ -471,5 +474,8 @@ HashMap::_FindElement(const Key& key) const } // namespace BPrivate using BPrivate::HashMap; +using BPrivate::HashKey32; +using BPrivate::HashKey64; +using BPrivate::SynchronizedHashMap; #endif // HASH_MAP_H