LCOV - code coverage report
Current view: top level - dbaccess/source/core/dataaccess - bookmarkcontainer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_BOOKMARKCONTAINER_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_BOOKMARKCONTAINER_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <map>
      26             : #include <vector>
      27             : 
      28             : #include <cppuhelper/interfacecontainer.hxx>
      29             : #include <cppuhelper/implbase6.hxx>
      30             : #include <osl/mutex.hxx>
      31             : #include <com/sun/star/container/XChild.hpp>
      32             : #include <com/sun/star/container/XNameContainer.hpp>
      33             : #include <com/sun/star/container/XContainer.hpp>
      34             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      35             : #include <com/sun/star/container/XIndexAccess.hpp>
      36             : #include <com/sun/star/lang/XServiceInfo.hpp>
      37             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      38             : #include <com/sun/star/beans/XPropertySet.hpp>
      39             : #include <com/sun/star/lang/DisposedException.hpp>
      40             : 
      41             : namespace dbaccess
      42             : {
      43             : 
      44             : // OBookmarkContainer -    base class of collections of database definition
      45             : //                         documents
      46             : typedef ::cppu::WeakImplHelper6 <
      47             :                                     ::com::sun::star::container::XIndexAccess
      48             :                                 ,   ::com::sun::star::container::XNameContainer
      49             :                                 ,   ::com::sun::star::container::XEnumerationAccess
      50             :                                 ,   ::com::sun::star::container::XContainer
      51             :                                 ,   ::com::sun::star::lang::XServiceInfo
      52             :                                 ,   ::com::sun::star::container::XChild
      53             :                                 >   OBookmarkContainer_Base;
      54             : 
      55             : class OBookmarkContainer
      56             :             :public OBookmarkContainer_Base
      57             : {
      58             : protected:
      59             :     typedef std::map<OUString, OUString> MapString2String;
      60             :     typedef std::vector<MapString2String::iterator> MapIteratorVector;
      61             : 
      62             :     MapString2String        m_aBookmarks;           // the bookmarks itself
      63             :     MapIteratorVector       m_aBookmarksIndexed;    // for index access to the
      64             : 
      65             : protected:
      66             :     ::cppu::OWeakObject&    m_rParent;      // for the ref counting
      67             :     ::cppu::OInterfaceContainerHelper
      68             :                             m_aContainerListeners;
      69             :     ::osl::Mutex&           m_rMutex;
      70             : 
      71             : public:
      72             :     /** constructs the container.<BR>
      73             :         after the construction of the object the creator has to call <code>initialize</code>.
      74             :         @param      _rParent                the parent object which is used for ref counting
      75             :         @param      _rMutex                 the parent's mutex object for access safety
      76             :     */
      77             :     OBookmarkContainer(
      78             :         ::cppu::OWeakObject& _rParent,
      79             :         ::osl::Mutex& _rMutex
      80             :         );
      81             : 
      82             :     /** looks like the dtor ...
      83             :     */
      84             :     virtual ~OBookmarkContainer();
      85             : 
      86             : // ::com::sun::star::uno::XInterface
      87             :     virtual void SAL_CALL acquire(  ) throw() SAL_OVERRIDE;
      88             :     virtual void SAL_CALL release(  ) throw() SAL_OVERRIDE;
      89             : 
      90             : // ::com::sun::star::lang::XServiceInfo
      91             :     virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             : 
      95             : // ::com::sun::star::container::XElementAccess
      96             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             : // ::com::sun::star::container::XEnumerationAccess
     100             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             : // ::com::sun::star::container::XIndexAccess
     103             :     virtual sal_Int32 SAL_CALL getCount(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 _nIndex ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             : 
     106             : // ::com::sun::star::container::XNameContainer
     107             :     virtual void SAL_CALL insertByName( const OUString& _rName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     virtual void SAL_CALL removeByName( const OUString& _rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             : 
     110             : // ::com::sun::star::container::XNameReplace
     111             :     virtual void SAL_CALL replaceByName( const OUString& _rName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             : 
     113             : // ::com::sun::star::container::XNameAccess
     114             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             : // ::com::sun::star::container::XContainer
     119             :     virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             : 
     122             : // ::com::sun::star::container::XChild
     123             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :     virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             : 
     126             : // helper
     127             :     /** tell the container to free all resources. After that it's in a state like after the construction, i.e.
     128             :         you may call <code>initialize</code> again (maybe with another configuration node).
     129             :     */
     130             :     virtual void    dispose();
     131             : 
     132             : protected:
     133             :     /** checks whether the object is basically alive, i.e. it has been fully initialized (@see initialize) and
     134             :         not disposed (@see dispose)
     135             :         @param      _bIntendWriteAccess     determines whether or not the caller intends to modify the configuration.
     136             :                                             if sal_True and the configuration is readonly, a runtime exception with
     137             :                                             a description string is thrown.
     138             :     */
     139             :     void        checkValid(bool _bIntendWriteAccess) const throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::DisposedException);
     140             : 
     141             :     /** quickly checks if there already is an element with a given name. No access to the configuration occurs, i.e.
     142             :         if there is such an object which is not already loaded, it won't be loaded now.
     143             :         @param      _rName      the object name to check
     144             :         @return                 sal_True if there already exists such an object
     145             :     */
     146             :     inline  bool    checkExistence(const OUString& _rName);
     147             : 
     148             :     void    implAppend(
     149             :         const OUString& _rName,
     150             :         const OUString& _rDocumentLocation
     151             :         );
     152             : 
     153             :     void implRemove(const OUString& _rName);
     154             : 
     155             :     void implReplace(
     156             :         const OUString& _rName,
     157             :         const OUString& _rNewLink);
     158             : 
     159             : };
     160             : 
     161           0 : inline  bool OBookmarkContainer::checkExistence(const OUString& _rName)
     162             : {
     163           0 :     return m_aBookmarks.find(_rName) != m_aBookmarks.end();
     164             : }
     165             : 
     166             : }   // namespace dbaccess
     167             : 
     168             : #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_BOOKMARKCONTAINER_HXX
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10