include MSVC STL code path

This commit is contained in:
Fridrich Strba 2011-02-03 02:29:46 -07:00 committed by Fridrich Štrba
parent 8a91eee9c3
commit 1c17bf61a5
5 changed files with 47 additions and 0 deletions

View file

@ -96,8 +96,21 @@ struct VoidPtrHash : ::std::unary_function<void const*, ::std::size_t> {
}
};
#ifdef USE_MSVC_HASH_SET
namespace stdext
{
inline ::std::size_t hash_value( void const* p ) {
::std::size_t const d = static_cast< ::std::size_t >(
reinterpret_cast< ::std::ptrdiff_t >(p) );
return d + (d >> 3);
}
}
typedef ::std::hash_set<void const*> VoidPointerSet;
#else
typedef ::std::hash_set<void const*, VoidPtrHash, ::std::equal_to<void const*>,
::rtl::Allocator<void const*> > VoidPointerSet;
#endif
struct ObjectRegistryData {
ObjectRegistryData( ::std::type_info const& rTypeInfo )

View file

@ -1550,6 +1550,14 @@ inline OString OUStringToOString( const OUString & rUnicode,
} /* Namespace */
namespace stdext
{
inline size_t hash_value(const rtl::OUString &rString)
{
return rtl::OUStringHash()(rString);
}
}
#endif /* __cplusplus */
#endif /* _RTL_USTRING_HXX */

View file

@ -36,6 +36,7 @@
#include "osl/diagnose.hxx"
#include "boost/bind.hpp"
#include <vector>
#include <algorithm>
// define own ones, independent of OSL_DEBUG_LEVEL:
#define DEBUGBASE_ENSURE_(c, f, l, m) \

View file

@ -606,10 +606,15 @@ namespace {
struct bootstrap_map {
// map<> may be preferred here, but hash_map<> is implemented fully inline,
// thus there is no need to link against the stlport:
#ifdef USE_MSVC_HASH_MAP
typedef std::hash_map<
rtl::OUString, Bootstrap_Impl *> t;
#else
typedef std::hash_map<
rtl::OUString, Bootstrap_Impl *,
rtl::OUStringHash, std::equal_to< rtl::OUString >,
rtl::Allocator< OUString > > t;
#endif
// get and release must only be called properly synchronized via some mutex
// (e.g., osl::Mutex::getGlobalMutex()):

View file

@ -157,6 +157,19 @@ struct hashModule
}
};
#ifdef USE_MSVC_HASH_MAP
namespace stdext
{
inline size_t hash_value( const oslModule& rkey)
{
return (size_t)rkey;
}
}
typedef std::hash_map<
oslModule,
std::pair<sal_uInt32, component_canUnloadFunc> > ModuleMap;
#else
typedef std::hash_map<
oslModule,
std::pair<sal_uInt32, component_canUnloadFunc>,
@ -164,6 +177,7 @@ typedef std::hash_map<
std::equal_to<oslModule>,
rtl::Allocator<oslModule>
> ModuleMap;
#endif
typedef ModuleMap::iterator Mod_IT;
@ -306,6 +320,11 @@ struct hashListener
}
};
#ifdef USE_MSVC_HASH_MAP
typedef std::hash_map<
sal_Int32,
std::pair<rtl_unloadingListenerFunc, void*> > ListenerMap;
#else
typedef std::hash_map<
sal_Int32,
std::pair<rtl_unloadingListenerFunc, void*>,
@ -313,6 +332,7 @@ typedef std::hash_map<
std::equal_to<sal_Int32>,
rtl::Allocator<sal_Int32>
> ListenerMap;
#endif
typedef ListenerMap::iterator Lis_IT;