20#ifndef INCLUDED_OOX_HELPER_REFMAP_HXX
21#define INCLUDED_OOX_HELPER_REFMAP_HXX
39template<
typename KeyType,
typename ObjType,
typename CompType = std::less< KeyType > >
40class RefMap :
public std::map< KeyType, std::shared_ptr< ObjType >, CompType >
43 typedef std::map< KeyType, std::shared_ptr< ObjType >, CompType >
container_type;
44 typedef typename container_type::key_type
key_type;
55 return pxRef && pxRef->get();
68 template<
typename FunctorType >
69 void forEach(
const FunctorType& rFunctor )
const
76 template<
typename FuncType >
79 forEach( ::std::bind( pFunc, std::placeholders::_1 ) );
84 template<
typename FuncType,
typename ParamType1,
typename ParamType2 >
85 void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 )
const
87 forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2 ) );
92 template<
typename FuncType,
typename ParamType1,
typename ParamType2,
typename ParamType3 >
93 void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 )
const
95 forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2, aParam3 ) );
101 template<
typename FunctorType >
109 template<
typename FuncType >
112 forEachWithKey( ::std::bind( pFunc, std::placeholders::_2, std::placeholders::_1 ) );
117 template<
typename FunctorType >
125 template<
typename FunctorType >
135 typename container_type::const_iterator aIt = this->
find( nKey );
136 return (aIt == this->
end()) ? nullptr : &aIt->second;
Template for a map of ref-counted objects with additional accessor functions.
bool has(key_type nKey) const
Returns true, if the object associated to the passed key exists.
void forEachMem(FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3) const
Calls the passed member function of ObjType on every contained object, automatically skips all elemen...
container_type::key_compare key_compare
void forEachWithKey(const FunctorType &rFunctor) const
Calls the passed functor for every contained object.
container_type::value_type value_type
std::map< KeyType, std::shared_ptr< ObjType >, CompType > container_type
void forEachMem(FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2) const
Calls the passed member function of ObjType on every contained object, automatically skips all elemen...
mapped_type get(key_type nKey) const
Returns a reference to the object associated to the passed key, or an empty reference on error.
void forEach(const FunctorType &rFunctor) const
Calls the passed functor for every contained object, automatically skips all elements that are empty ...
container_type::mapped_type mapped_type
container_type::key_type key_type
void forEachMemWithKey(FuncType pFunc) const
Calls the passed member function of ObjType on every contained object.
void forEachMem(FuncType pFunc) const
Calls the passed member function of ObjType on every contained object, automatically skips all elemen...
const mapped_type * getRef(key_type nKey) const
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
enumrange< T >::Iterator begin(enumrange< T >)
ForEachFunctorWithKey(FunctorType aFunctor)
void operator()(const value_type &rValue)
ForEachFunctor(FunctorType aFunctor)
void operator()(const value_type &rValue)