LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_xcontainer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 13 0.0 %
Date: 2014-11-03 Functions: 0 11 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             :  *
       4             :  *  Effective License of whole file:
       5             :  *
       6             :  *    This library is free software; you can redistribute it and/or
       7             :  *    modify it under the terms of the GNU Lesser General Public
       8             :  *    License version 2.1, as published by the Free Software Foundation.
       9             :  *
      10             :  *    This library is distributed in the hope that it will be useful,
      11             :  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :  *    Lesser General Public License for more details.
      14             :  *
      15             :  *    You should have received a copy of the GNU Lesser General Public
      16             :  *    License along with this library; if not, write to the Free Software
      17             :  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      18             :  *    MA  02111-1307  USA
      19             :  *
      20             :  *  Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
      21             :  *
      22             :  *    The Contents of this file are made available subject to the terms of
      23             :  *    the GNU Lesser General Public License Version 2.1
      24             :  *
      25             :  *    Copyright: 2000 by Sun Microsystems, Inc.
      26             :  *
      27             :  *    Contributor(s): Joerg Budischewski
      28             :  *
      29             :  *  All parts contributed on or after August 2011:
      30             :  *
      31             :  *    This Source Code Form is subject to the terms of the Mozilla Public
      32             :  *    License, v. 2.0. If a copy of the MPL was not distributed with this
      33             :  *    file, You can obtain one at http://mozilla.org/MPL/2.0/.
      34             :  *
      35             :  ************************************************************************/
      36             : 
      37             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCONTAINER_HXX
      38             : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCONTAINER_HXX
      39             : #include <boost/unordered_map.hpp>
      40             : #include <vector>
      41             : 
      42             : #include <com/sun/star/container/XNameAccess.hpp>
      43             : #include <com/sun/star/container/XIndexAccess.hpp>
      44             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      45             : #include <com/sun/star/container/XContainer.hpp>
      46             : 
      47             : #include <com/sun/star/sdbcx/XAppend.hpp>
      48             : #include <com/sun/star/sdbcx/XDrop.hpp>
      49             : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      50             : 
      51             : #include <com/sun/star/util/XRefreshable.hpp>
      52             : 
      53             : #include <cppuhelper/compbase8.hxx>
      54             : 
      55             : #include "pq_connection.hxx"
      56             : #include "pq_statics.hxx"
      57             : 
      58             : namespace pq_sdbc_driver
      59             : {
      60             : 
      61           0 : class EventBroadcastHelper
      62             : {
      63             : public:
      64             :     virtual void fire(com::sun::star::lang::XEventListener * listener) const = 0;
      65             :     virtual com::sun::star::uno::Type getType() const = 0;
      66           0 :     virtual ~EventBroadcastHelper(){};
      67             : };
      68             : 
      69           0 : class RefreshedBroadcaster : public EventBroadcastHelper
      70             : {
      71             :     com::sun::star::lang::EventObject m_event;
      72             : public:
      73           0 :     RefreshedBroadcaster(const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & source ) :
      74           0 :         m_event( source )
      75           0 :     {}
      76             : 
      77           0 :     virtual void fire( com::sun::star::lang::XEventListener * listener ) const SAL_OVERRIDE
      78             :     {
      79           0 :         static_cast<com::sun::star::util::XRefreshListener*>(listener)->refreshed( m_event );
      80           0 :     }
      81             : 
      82           0 :     virtual com::sun::star::uno::Type getType() const SAL_OVERRIDE
      83             :     {
      84             :         return getCppuType(
      85           0 :             (com::sun::star::uno::Reference< com::sun::star::util::XRefreshListener > *)0 );
      86             :     }
      87             : };
      88             : 
      89             : typedef ::boost::unordered_map
      90             : <
      91             :    OUString,
      92             :    sal_Int32,
      93             :    OUStringHash,
      94             :    ::std::equal_to< OUString >
      95             : > String2IntMap;
      96             : 
      97             : typedef ::cppu::WeakComponentImplHelper8
      98             : <
      99             :     com::sun::star::container::XNameAccess,
     100             :     com::sun::star::container::XIndexAccess,
     101             :     com::sun::star::container::XEnumerationAccess,
     102             :     com::sun::star::sdbcx::XAppend,
     103             :     com::sun::star::sdbcx::XDrop,
     104             :     com::sun::star::util::XRefreshable,
     105             :     com::sun::star::sdbcx::XDataDescriptorFactory,
     106             :     com::sun::star::container::XContainer
     107             : > ContainerBase;
     108             : 
     109           0 : class /* abstract */ Container : public ContainerBase
     110             : {
     111             : protected:
     112             :     ::rtl::Reference< RefCountedMutex > m_refMutex;
     113             :     ConnectionSettings *m_pSettings;
     114             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_origin;
     115             :     String2IntMap m_name2index;  // maps the element name to an index
     116             :     ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_values; // contains the real values
     117             :     OUString m_type;
     118             : 
     119             : public:
     120             :     Container(
     121             :         const ::rtl::Reference< RefCountedMutex > & refMutex,
     122             :         const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection >  & origin,
     123             :         ConnectionSettings *pSettings,
     124             :         const OUString & type  // for exception messages
     125             :         );
     126             : 
     127             : public: // XIndexAccess
     128             :     virtual sal_Int32 SAL_CALL getCount(  )
     129             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
     131             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     132             :                ::com::sun::star::lang::WrappedTargetException,
     133             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             : 
     135             : public: // XEnumerationAccess
     136             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
     137             :     SAL_CALL createEnumeration(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             : 
     139             : public: // XNameAccess
     140             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     141             :         throw (::com::sun::star::container::NoSuchElementException,
     142             :                ::com::sun::star::lang::WrappedTargetException,
     143             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames(  )
     145             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     147             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :     // Methods
     149             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  )
     150             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :     virtual sal_Bool SAL_CALL hasElements(  )
     152             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             : 
     154             : 
     155             : public: // XAppend
     156             :     // Must be overridden in Non-Descriptors. May be overridden in descriptors, when
     157             :     // PropertySet.NAME != container name
     158             :     virtual void SAL_CALL appendByDescriptor(
     159             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
     160             :         throw (::com::sun::star::sdbc::SQLException,
     161             :                ::com::sun::star::container::ElementExistException,
     162             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             : 
     164             :     // helper method !
     165             :     void append(
     166             :         const OUString & str,
     167             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
     168             :         throw ( ::com::sun::star::container::ElementExistException );
     169             : 
     170             : 
     171             : public: // XDrop
     172             :     virtual void SAL_CALL dropByName( const OUString& elementName )
     173             :         throw (::com::sun::star::sdbc::SQLException,
     174             :                ::com::sun::star::container::NoSuchElementException,
     175             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             :     virtual void SAL_CALL dropByIndex( sal_Int32 index )
     177             :         throw (::com::sun::star::sdbc::SQLException,
     178             :                ::com::sun::star::lang::IndexOutOfBoundsException,
     179             :                ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             : public: // XDataDescriptorFactory
     182             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor(  )
     183             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
     184             : 
     185             : public: // XRefreshable
     186           0 :     virtual void SAL_CALL refresh(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE {}
     187             :     virtual void SAL_CALL addRefreshListener(
     188             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
     189             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :     virtual void SAL_CALL removeRefreshListener(
     191             :         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
     192             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     193             : 
     194             : public:
     195             :     // Methods
     196             :     virtual void SAL_CALL addContainerListener(
     197             :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     198             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     199             :     virtual void SAL_CALL removeContainerListener(
     200             :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     201             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     202             : 
     203             : public:
     204             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     205             : 
     206             : public:
     207             :     void rename( const OUString & oldName, const OUString &newName );
     208             : 
     209             : protected:
     210             :     void fire( const EventBroadcastHelper & helper );
     211             : };
     212             : 
     213             : }
     214             : #endif
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10