LibreOffice Module oox (master) 1
Classes | Public Types | Public Member Functions | Private Member Functions | List of all members
oox::RefMap< KeyType, ObjType, CompType > Class Template Reference

Template for a map of ref-counted objects with additional accessor functions. More...

#include <refmap.hxx>

Inheritance diagram for oox::RefMap< KeyType, ObjType, CompType >:
[legend]
Collaboration diagram for oox::RefMap< KeyType, ObjType, CompType >:
[legend]

Classes

struct  ForEachFunctor
 
struct  ForEachFunctorWithKey
 

Public Types

typedef std::map< KeyType, std::shared_ptr< ObjType >, CompType > container_type
 
typedef container_type::key_type key_type
 
typedef container_type::mapped_type mapped_type
 
typedef container_type::value_type value_type
 
typedef container_type::key_compare key_compare
 

Public Member Functions

bool has (key_type nKey) const
 Returns true, if the object associated to the passed key exists. More...
 
mapped_type get (key_type nKey) const
 Returns a reference to the object associated to the passed key, or an empty reference on error. More...
 
template<typename FunctorType >
void forEach (const FunctorType &rFunctor) const
 Calls the passed functor for every contained object, automatically skips all elements that are empty references. More...
 
template<typename FuncType >
void forEachMem (FuncType pFunc) const
 Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references. More...
 
template<typename FuncType , typename ParamType1 , typename ParamType2 >
void forEachMem (FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2) const
 Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references. More...
 
template<typename FuncType , typename ParamType1 , typename ParamType2 , typename ParamType3 >
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 elements that are empty references. More...
 
template<typename FunctorType >
void forEachWithKey (const FunctorType &rFunctor) const
 Calls the passed functor for every contained object. More...
 
template<typename FuncType >
void forEachMemWithKey (FuncType pFunc) const
 Calls the passed member function of ObjType on every contained object. More...
 

Private Member Functions

const mapped_typegetRef (key_type nKey) const
 

Detailed Description

template<typename KeyType, typename ObjType, typename CompType = std::less< KeyType >>
class oox::RefMap< KeyType, ObjType, CompType >

Template for a map of ref-counted objects with additional accessor functions.

An instance of the class RefMap< Type > stores elements of the type std::shared_ptr< Type >. The new accessor functions has() and get() work correctly for nonexisting keys, there is no need to check the passed key before.

Definition at line 40 of file refmap.hxx.

Member Typedef Documentation

◆ container_type

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
typedef std::map< KeyType, std::shared_ptr< ObjType >, CompType > oox::RefMap< KeyType, ObjType, CompType >::container_type

Definition at line 43 of file refmap.hxx.

◆ key_compare

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
typedef container_type::key_compare oox::RefMap< KeyType, ObjType, CompType >::key_compare

Definition at line 47 of file refmap.hxx.

◆ key_type

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
typedef container_type::key_type oox::RefMap< KeyType, ObjType, CompType >::key_type

Definition at line 44 of file refmap.hxx.

◆ mapped_type

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
typedef container_type::mapped_type oox::RefMap< KeyType, ObjType, CompType >::mapped_type

Definition at line 45 of file refmap.hxx.

◆ value_type

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
typedef container_type::value_type oox::RefMap< KeyType, ObjType, CompType >::value_type

Definition at line 46 of file refmap.hxx.

Member Function Documentation

◆ forEach()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FunctorType >
void oox::RefMap< KeyType, ObjType, CompType >::forEach ( const FunctorType &  rFunctor) const
inline

Calls the passed functor for every contained object, automatically skips all elements that are empty references.

Definition at line 69 of file refmap.hxx.

References begin, and end.

Referenced by oox::RefMap< KeyType, ObjType, CompType >::forEachMem().

◆ forEachMem() [1/3]

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FuncType >
void oox::RefMap< KeyType, ObjType, CompType >::forEachMem ( FuncType  pFunc) const
inline

Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references.

Definition at line 77 of file refmap.hxx.

References oox::RefMap< KeyType, ObjType, CompType >::forEach().

Referenced by oox::ole::VbaProject::importModulesAndForms().

◆ forEachMem() [2/3]

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FuncType , typename ParamType1 , typename ParamType2 >
void oox::RefMap< KeyType, ObjType, CompType >::forEachMem ( FuncType  pFunc,
ParamType1  aParam1,
ParamType2  aParam2 
) const
inline

Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references.

Definition at line 85 of file refmap.hxx.

References oox::RefMap< KeyType, ObjType, CompType >::forEach().

◆ forEachMem() [3/3]

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FuncType , typename ParamType1 , typename ParamType2 , typename ParamType3 >
void oox::RefMap< KeyType, ObjType, CompType >::forEachMem ( FuncType  pFunc,
ParamType1  aParam1,
ParamType2  aParam2,
ParamType3  aParam3 
) const
inline

Calls the passed member function of ObjType on every contained object, automatically skips all elements that are empty references.

Definition at line 93 of file refmap.hxx.

References oox::RefMap< KeyType, ObjType, CompType >::forEach().

◆ forEachMemWithKey()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FuncType >
void oox::RefMap< KeyType, ObjType, CompType >::forEachMemWithKey ( FuncType  pFunc) const
inline

Calls the passed member function of ObjType on every contained object.

Passes the object key as argument to the member function.

Definition at line 110 of file refmap.hxx.

References oox::RefMap< KeyType, ObjType, CompType >::forEachWithKey().

◆ forEachWithKey()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
template<typename FunctorType >
void oox::RefMap< KeyType, ObjType, CompType >::forEachWithKey ( const FunctorType &  rFunctor) const
inline

Calls the passed functor for every contained object.

Passes the key as first argument and the object reference as second argument to rFunctor.

Definition at line 102 of file refmap.hxx.

References begin, and end.

Referenced by oox::RefMap< KeyType, ObjType, CompType >::forEachMemWithKey().

◆ get()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
mapped_type oox::RefMap< KeyType, ObjType, CompType >::get ( key_type  nKey) const
inline

◆ getRef()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
const mapped_type * oox::RefMap< KeyType, ObjType, CompType >::getRef ( key_type  nKey) const
inlineprivate

◆ has()

template<typename KeyType , typename ObjType , typename CompType = std::less< KeyType >>
bool oox::RefMap< KeyType, ObjType, CompType >::has ( key_type  nKey) const
inline

The documentation for this class was generated from the following file: