LCOV - code coverage report
Current view: top level - xmloff/inc/xmloff - unointerfacetouniqueidentifiermapper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : #ifndef __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
       3                 :            : #define __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__
       4                 :            : 
       5                 :            : #include "sal/config.h"
       6                 :            : #include "xmloff/dllapi.h"
       7                 :            : #include "sal/types.h"
       8                 :            : 
       9                 :            : #include <map>
      10                 :            : #include <rtl/ustring.hxx>
      11                 :            : #include <com/sun/star/uno/XInterface.hpp>
      12                 :            : 
      13                 :            : namespace comphelper
      14                 :            : {
      15                 :            : 
      16                 :            : typedef ::std::map< rtl::OUString, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > IdMap_t;
      17                 :            : 
      18                 :       4717 : class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper
      19                 :            : {
      20                 :            : public:
      21                 :            :     UnoInterfaceToUniqueIdentifierMapper();
      22                 :            : 
      23                 :            :     /** returns a unique identifier for the given uno object. IF a uno object is
      24                 :            :         registered more than once, the returned identifier is always the same.
      25                 :            :     */
      26                 :            :     const rtl::OUString& registerReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface );
      27                 :            : 
      28                 :            :     /** registers the given uno object with the given identifier.
      29                 :            : 
      30                 :            :         @returns
      31                 :            :             false, if the given identifier already exists and is not associated with the given interface
      32                 :            :     */
      33                 :            :     bool registerReference( const rtl::OUString& rIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface );
      34                 :            : 
      35                 :            :     /** @returns
      36                 :            :             the identifier for the given uno object. If this uno object is not already
      37                 :            :             registered, an empty string is returned
      38                 :            :     */
      39                 :            :     const rtl::OUString& getIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface ) const;
      40                 :            : 
      41                 :            :     /** @returns
      42                 :            :         the uno object that is registered with the given identifier. If no uno object
      43                 :            :         is registered with the given identifier, an empty reference is returned.
      44                 :            :     */
      45                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& getReference( const rtl::OUString& rIdentifier ) const;
      46                 :            : 
      47                 :            : private:
      48                 :            :     bool findReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const;
      49                 :            :     bool findIdentifier( const rtl::OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const;
      50                 :            : 
      51                 :            :     IdMap_t     maEntries;
      52                 :            :     sal_Int32 mnNextId;
      53                 :            : };
      54                 :            : 
      55                 :            : }
      56                 :            : 
      57                 :            : #endif
      58                 :            : 
      59                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10