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

Generated by: LCOV version 1.11