LCOV - code coverage report
Current view: top level - connectivity/source/drivers/mork - MDriver.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 46 0.0 %
Date: 2014-04-14 Functions: 0 12 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             : 
      10             : #include <cppuhelper/supportsservice.hxx>
      11             : #include "MDriver.hxx"
      12             : #include "MConnection.hxx"
      13             : #include "MNSProfileDiscover.hxx"
      14             : 
      15             : #include "resource/mork_res.hrc"
      16             : #include "resource/common_res.hrc"
      17             : 
      18             : using namespace connectivity::mork;
      19             : 
      20             : namespace connectivity
      21             : {
      22             :     namespace mork
      23             :     {
      24           0 :         css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const & context)
      25             :         {
      26           0 :             return static_cast< cppu::OWeakObject * >(new MorkDriver(context));
      27             :         }
      28             :     }
      29             : }
      30             : 
      31           0 : MorkDriver::MorkDriver(css::uno::Reference< css::uno::XComponentContext > const context):
      32             :     context_(context),
      33           0 :     m_xFactory(context_->getServiceManager(), css::uno::UNO_QUERY)
      34             : {
      35             :     SAL_INFO("connectivity.mork", "=> MorkDriver::MorkDriver()" );
      36             : //    css::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceFactory(;
      37             :     assert(context.is());
      38           0 : }
      39             : 
      40             : // static ServiceInfo
      41             : 
      42           0 : OUString MorkDriver::getImplementationName_Static(  ) throw(css::uno::RuntimeException)
      43             : {
      44           0 :     return OUString(MORK_DRIVER_IMPL_NAME);
      45             : }
      46             : 
      47             : 
      48           0 : css::uno::Sequence< OUString > MorkDriver::getSupportedServiceNames_Static(  ) throw (css::uno::RuntimeException)
      49             : {
      50           0 :     css::uno::Sequence< OUString > aSNS(1);
      51           0 :     aSNS[0] = "com.sun.star.sdbc.Driver";
      52           0 :     return aSNS;
      53             : }
      54             : 
      55           0 : OUString SAL_CALL MorkDriver::getImplementationName()
      56             :     throw (css::uno::RuntimeException, std::exception)
      57             : {
      58           0 :     return getImplementationName_Static();
      59             : }
      60             : 
      61           0 : sal_Bool SAL_CALL MorkDriver::supportsService(const OUString& serviceName)
      62             :     throw (css::uno::RuntimeException, std::exception)
      63             : {
      64           0 :     return cppu::supportsService(this, serviceName);
      65             : }
      66             : 
      67           0 : css::uno::Sequence< OUString > MorkDriver::getSupportedServiceNames()
      68             :     throw (css::uno::RuntimeException, std::exception)
      69             : {
      70           0 :     return getSupportedServiceNames_Static();
      71             : }
      72             : 
      73           0 : css::uno::Reference< css::sdbc::XConnection > MorkDriver::connect(
      74             :     OUString const & url,
      75             :     css::uno::Sequence< css::beans::PropertyValue > const & info)
      76             :     throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
      77             : {
      78             :     SAL_INFO("connectivity.mork", "=> MorkDriver::connect()" );
      79             : 
      80             :     (void) url; (void) info; // avoid warnings
      81           0 :     css::uno::Reference< css::sdbc::XConnection > xCon;
      82           0 :     OConnection* pCon = new OConnection(this);
      83           0 :     xCon = pCon;    // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
      84           0 :     pCon->construct(url, info);
      85           0 :     return xCon;
      86             : }
      87             : 
      88           0 : sal_Bool MorkDriver::acceptsURL(OUString const & url)
      89             :     throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
      90             : {
      91             :     SAL_INFO("connectivity.mork", "=> MorkDriver::acceptsURL()" );
      92             :     // Skip 'sdbc:mozab: part of URL
      93             : 
      94           0 :     sal_Int32 nLen = url.indexOf(':');
      95           0 :     nLen = url.indexOf(':',nLen+1);
      96           0 :     OUString aAddrbookURI(url.copy(nLen+1));
      97             :     // Get Scheme
      98           0 :     nLen = aAddrbookURI.indexOf(':');
      99           0 :     OUString aAddrbookScheme;
     100           0 :     if ( nLen == -1 )
     101             :     {
     102             :         // There isn't any subschema: - but could be just subschema
     103           0 :         if ( !aAddrbookURI.isEmpty() )
     104             :         {
     105           0 :             aAddrbookScheme= aAddrbookURI;
     106             :         }
     107           0 :         else if( url == "sdbc:address:" )
     108             :         {
     109           0 :             return false;
     110             :         }
     111             :         else
     112             :         {
     113           0 :             return false;
     114             :         }
     115             :     }
     116             :     else
     117             :     {
     118           0 :         aAddrbookScheme = aAddrbookURI.copy(0, nLen);
     119             :     }
     120             : 
     121           0 :     if (aAddrbookScheme.equalsAscii( "thunderbird" ) ||
     122           0 :         aAddrbookScheme.equalsAscii( "mozilla" ) )
     123             :     {
     124           0 :         return true;
     125             :     }
     126             : 
     127           0 :     return false;
     128             : }
     129             : 
     130           0 : css::uno::Sequence< css::sdbc::DriverPropertyInfo > MorkDriver::getPropertyInfo(
     131             :     OUString const & url,
     132             :     css::uno::Sequence< css::beans::PropertyValue > const & info)
     133             :     throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
     134             : {
     135             :     //... TODO
     136             :     (void) url; (void) info; // avoid warnings
     137           0 :     return css::uno::Sequence< css::sdbc::DriverPropertyInfo >();
     138             : }
     139             : 
     140           0 : sal_Int32 MorkDriver::getMajorVersion() throw (css::uno::RuntimeException, std::exception) {
     141             :     //... TODO
     142           0 :     return 0;
     143             : }
     144             : 
     145           0 : sal_Int32 MorkDriver::getMinorVersion() throw (css::uno::RuntimeException, std::exception) {
     146             :     //... TODO
     147           0 :     return 0;
     148             : }
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10