LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - odbcconfig.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 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_UI_DLG_ODBCCONFIG_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
      22             : 
      23             : #include "commontypes.hxx"
      24             : 
      25             : #if defined(WNT) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
      26             : #define HAVE_ODBC_SUPPORT
      27             : #endif
      28             : 
      29             : #if defined(WNT) && defined(HAVE_ODBC_SUPPORT)
      30             : #define HAVE_ODBC_ADMINISTRATION
      31             : #endif
      32             : 
      33             : #include <tools/link.hxx>
      34             : #include <osl/module.h>
      35             : 
      36             : #include <memory>
      37             : 
      38             : namespace dbaui
      39             : {
      40             : 
      41             : // OOdbcLibWrapper
      42             : /** base for helper classes wrapping functionality from an ODBC library
      43             : */
      44             : class OOdbcLibWrapper
      45             : {
      46             :     oslModule           m_pOdbcLib;     // the library handle
      47             :     OUString     m_sLibPath;     // the path to the library
      48             : 
      49             : public:
      50             : #ifdef HAVE_ODBC_SUPPORT
      51           0 :     bool    isLoaded() const { return NULL != m_pOdbcLib; }
      52             : #else
      53             :     sal_Bool    isLoaded() const { return sal_False; }
      54             : #endif
      55           0 :     OUString getLibraryName() const { return m_sLibPath; }
      56             : 
      57             : protected:
      58             : #ifndef HAVE_ODBC_SUPPORT
      59             :     OOdbcLibWrapper() : m_pOdbcLib(NULL) { }
      60             : #else
      61             :     OOdbcLibWrapper();
      62             : #endif
      63             :     ~OOdbcLibWrapper();
      64             : 
      65             :     oslGenericFunction  loadSymbol(const sal_Char* _pFunctionName);
      66             : 
      67             :     /// load the lib
      68             :     bool    load(const sal_Char* _pLibPath);
      69             :     /// unload the lib
      70             :     void        unload();
      71             : };
      72             : 
      73             : // OOdbcEnumeration
      74             : struct OdbcTypesImpl;
      75             : class OOdbcEnumeration : public OOdbcLibWrapper
      76             : {
      77             : #ifdef HAVE_ODBC_SUPPORT
      78             :     // entry points for ODBC administration
      79             :     oslGenericFunction  m_pAllocHandle;
      80             :     oslGenericFunction  m_pFreeHandle;
      81             :     oslGenericFunction  m_pSetEnvAttr;
      82             :     oslGenericFunction  m_pDataSources;
      83             : 
      84             : #endif
      85             :     OdbcTypesImpl*  m_pImpl;
      86             :         // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
      87             :         // ODBC file, which would lead to a lot of conflicts with other includes
      88             : 
      89             : public:
      90             :     OOdbcEnumeration();
      91             :     ~OOdbcEnumeration();
      92             : 
      93             :     void        getDatasourceNames(StringBag& _rNames);
      94             : 
      95             : protected:
      96             :     /// ensure that an ODBC environment is allocated
      97             :     bool    allocEnv();
      98             :     /// free any allocated ODBC environment
      99             :     void        freeEnv();
     100             : };
     101             : 
     102             : // OOdbcManagement
     103             : #ifdef HAVE_ODBC_ADMINISTRATION
     104             : class ProcessTerminationWait;
     105             : class OOdbcManagement
     106             : {
     107             :     ::std::unique_ptr< ProcessTerminationWait >   m_pProcessWait;
     108             :     Link<>                                      m_aAsyncFinishCallback;
     109             : 
     110             : public:
     111             :     OOdbcManagement( const Link<>& _rAsyncFinishCallback );
     112             :     ~OOdbcManagement();
     113             : 
     114             :     bool    manageDataSources_async();
     115             :     bool    isRunning() const;
     116             : };
     117             : #endif
     118             : 
     119             : }   // namespace dbaui
     120             : 
     121             : #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11