LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/sdbcx - VKey.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 83 0.0 %
Date: 2012-12-27 Functions: 0 20 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             : #include "connectivity/sdbcx/VKey.hxx"
      21             : #include <com/sun/star/lang/DisposedException.hpp>
      22             : #include <com/sun/star/sdbc/KeyRule.hpp>
      23             : #include <comphelper/sequence.hxx>
      24             : #include "connectivity/sdbcx/VColumn.hxx"
      25             : #include "connectivity/sdbcx/VCollection.hxx"
      26             : #include "TConnection.hxx"
      27             : // -------------------------------------------------------------------------
      28             : using namespace connectivity;
      29             : using namespace connectivity::sdbcx;
      30             : using namespace ::com::sun::star::beans;
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::sdbc;
      33             : using namespace ::com::sun::star::sdbcx;
      34             : using namespace ::com::sun::star::container;
      35             : using namespace ::com::sun::star::lang;
      36             : 
      37             : // -----------------------------------------------------------------------------
      38           0 : ::rtl::OUString SAL_CALL OKey::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)
      39             : {
      40           0 :     if(isNew())
      41           0 :         return ::rtl::OUString("com.sun.star.sdbcx.VKeyDescription");
      42           0 :     return ::rtl::OUString("com.sun.star.sdbcx.VKey");
      43             : }
      44             : // -----------------------------------------------------------------------------
      45           0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OKey::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)
      46             : {
      47           0 :     ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
      48           0 :     if(isNew())
      49           0 :         aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.KeyDescription");
      50             :     else
      51           0 :         aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.Key");
      52             : 
      53           0 :     return aSupported;
      54             : }
      55             : // -----------------------------------------------------------------------------
      56           0 : sal_Bool SAL_CALL OKey::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
      57             : {
      58           0 :     Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
      59           0 :     const ::rtl::OUString* pSupported = aSupported.getConstArray();
      60           0 :     const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
      61           0 :     for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
      62             :         ;
      63             : 
      64           0 :     return pSupported != pEnd;
      65             : }
      66             : // -------------------------------------------------------------------------
      67           0 : OKey::OKey(sal_Bool _bCase) :   ODescriptor_BASE(m_aMutex)
      68             :             ,   ODescriptor(ODescriptor_BASE::rBHelper,_bCase,sal_True)
      69           0 :             ,   m_aProps(new KeyProperties())
      70           0 :             ,   m_pColumns(NULL)
      71             : {
      72           0 : }
      73             : // -------------------------------------------------------------------------
      74           0 : OKey::OKey(const ::rtl::OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase)
      75             : : ODescriptor_BASE(m_aMutex)
      76             :  ,ODescriptor(ODescriptor_BASE::rBHelper,_bCase)
      77             :  ,m_aProps(_rProps)
      78           0 :  ,m_pColumns(NULL)
      79             : {
      80           0 :     m_Name = _Name;
      81           0 : }
      82             : //OKey::OKey(   const ::rtl::OUString& _Name,
      83             : //          const ::rtl::OUString& _ReferencedTable,
      84             : //          sal_Int32       _Type,
      85             : //          sal_Int32       _UpdateRule,
      86             : //          sal_Int32       _DeleteRule,
      87             : //          sal_Bool _bCase) :  ODescriptor_BASE(m_aMutex)
      88             : //                      ,ODescriptor(ODescriptor_BASE::rBHelper,_bCase)
      89             : //                      ,m_ReferencedTable(_ReferencedTable)
      90             : //                      ,m_Type(_Type)
      91             : //                      ,m_UpdateRule(_UpdateRule)
      92             : //                      ,m_DeleteRule(_DeleteRule)
      93             : //                        ,m_pColumns(NULL)
      94             : //{
      95             : //  m_Name = _Name;
      96             : //}
      97             : // -------------------------------------------------------------------------
      98           0 : OKey::~OKey( )
      99             : {
     100           0 :     delete m_pColumns;
     101           0 : }
     102             : // -------------------------------------------------------------------------
     103           0 : Any SAL_CALL OKey::queryInterface( const Type & rType ) throw(RuntimeException)
     104             : {
     105           0 :     Any aRet = ODescriptor::queryInterface( rType);
     106           0 :     if(!aRet.hasValue())
     107             :     {
     108           0 :         if(!isNew())
     109           0 :             aRet = OKey_BASE::queryInterface(rType);
     110           0 :         if(!aRet.hasValue())
     111           0 :             aRet = ODescriptor_BASE::queryInterface( rType);
     112             :     }
     113             : 
     114           0 :     return aRet;
     115             : }
     116             : // -------------------------------------------------------------------------
     117           0 : Sequence< Type > SAL_CALL OKey::getTypes(  ) throw(RuntimeException)
     118             : {
     119           0 :     if(isNew())
     120           0 :         return ::comphelper::concatSequences(ODescriptor::getTypes(),ODescriptor_BASE::getTypes());
     121             : 
     122           0 :     return ::comphelper::concatSequences(ODescriptor::getTypes(),ODescriptor_BASE::getTypes(),OKey_BASE::getTypes());
     123             : }
     124             : // -------------------------------------------------------------------------
     125           0 : void OKey::construct()
     126             : {
     127           0 :     ODescriptor::construct();
     128             : 
     129           0 :     sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
     130             : 
     131           0 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE), PROPERTY_ID_REFERENCEDTABLE,    nAttrib,&m_aProps->m_ReferencedTable,   ::getCppuType(static_cast< ::rtl::OUString*>(0)));
     132           0 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),            PROPERTY_ID_TYPE,               nAttrib,&m_aProps->m_Type,          ::getCppuType(static_cast<sal_Int32*>(0)));
     133           0 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_UPDATERULE),      PROPERTY_ID_UPDATERULE,         nAttrib,&m_aProps->m_UpdateRule,        ::getCppuType(static_cast<sal_Int32*>(0)));
     134           0 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE),      PROPERTY_ID_DELETERULE,         nAttrib,&m_aProps->m_DeleteRule,        ::getCppuType(static_cast<sal_Int32*>(0)));
     135           0 : }
     136             : // -------------------------------------------------------------------------
     137           0 : void SAL_CALL OKey::disposing()
     138             : {
     139           0 :     OPropertySetHelper::disposing();
     140             : 
     141           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     142             : 
     143           0 :     if(m_pColumns)
     144           0 :         m_pColumns->disposing();
     145             : 
     146           0 :     ODescriptor_BASE::disposing();
     147           0 : }
     148             : // -------------------------------------------------------------------------
     149           0 : ::cppu::IPropertyArrayHelper* OKey::createArrayHelper( sal_Int32 /*_nId*/ ) const
     150             : {
     151           0 :     return doCreateArrayHelper();
     152             : }
     153             : // -------------------------------------------------------------------------
     154           0 : ::cppu::IPropertyArrayHelper & OKey::getInfoHelper()
     155             : {
     156           0 :     return *const_cast<OKey*>(this)->getArrayHelper(isNew() ? 1 : 0);
     157             : }
     158             : // -------------------------------------------------------------------------
     159           0 : Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns(  ) throw(RuntimeException)
     160             : {
     161           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     162           0 :     checkDisposed(ODescriptor_BASE::rBHelper.bDisposed);
     163             : 
     164             :     try
     165             :     {
     166           0 :         if ( !m_pColumns )
     167           0 :             refreshColumns();
     168             :     }
     169           0 :     catch( const RuntimeException& )
     170             :     {
     171             :         // allowed to leave this method
     172           0 :         throw;
     173             :     }
     174           0 :     catch( const Exception& )
     175             :     {
     176             :         // allowed
     177             :     }
     178             : 
     179           0 :     return const_cast<OKey*>(this)->m_pColumns;
     180             : }
     181             : // -------------------------------------------------------------------------
     182           0 : Reference< XPropertySet > SAL_CALL OKey::createDataDescriptor(  ) throw(RuntimeException)
     183             : {
     184           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     185           0 :     checkDisposed(ODescriptor_BASE::rBHelper.bDisposed);
     186             : 
     187             : 
     188           0 :     return this;
     189             : }
     190             : // -----------------------------------------------------------------------------
     191           0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OKey::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
     192             : {
     193           0 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     194             : }
     195             : // -----------------------------------------------------------------------------
     196           0 : ::rtl::OUString SAL_CALL OKey::getName(  ) throw(::com::sun::star::uno::RuntimeException)
     197             : {
     198           0 :     return m_Name;
     199             : }
     200             : // -----------------------------------------------------------------------------
     201           0 : void SAL_CALL OKey::setName( const ::rtl::OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException)
     202             : {
     203           0 : }
     204             : // -----------------------------------------------------------------------------
     205             : // XInterface
     206           0 : void SAL_CALL OKey::acquire() throw()
     207             : {
     208           0 :     ODescriptor_BASE::acquire();
     209           0 : }
     210             : // -----------------------------------------------------------------------------
     211           0 : void SAL_CALL OKey::release() throw()
     212             : {
     213           0 :     ODescriptor_BASE::release();
     214           0 : }
     215             : // -----------------------------------------------------------------------------
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10