1 #ifndef __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
2 #define __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
5 #include <rtl/ustring.hxx>
6 #include <com/sun/star/uno/XInterface.hpp>
11 typedef ::std::map
< rtl::OUString
, const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> > IdMap_t
;
13 class UnoInterfaceToUniqueIdentifierMapper
16 UnoInterfaceToUniqueIdentifierMapper();
18 /** returns a unique identifier for the given uno object. IF a uno object is
19 registered more than once, the returned identifier is always the same.
21 const rtl::OUString
& registerReference( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rInterface
);
23 /** registers the given uno object with the given identifier.
26 false, if the given identifier already exists and is not associated with the given interface
28 bool registerReference( const rtl::OUString
& rIdentifier
, const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rInterface
);
31 the identifier for the given uno object. If this uno object is not already
32 registered, an empty string is returned
34 const rtl::OUString
& getIdentifier( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rInterface
) const;
37 the uno object that is registered with the given identifier. If no uno object
38 is registered with the given identifier, an empty reference is returned.
40 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& getReference( const rtl::OUString
& rIdentifier
) const;
43 bool findReference( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rInterface
, IdMap_t::const_iterator
& rIter
) const;
44 bool findIdentifier( const rtl::OUString
& rIdentifier
, IdMap_t::const_iterator
& rIter
) const;