LibreOffice Module connectivity (master) 1
pq_driver.hxx
Go to the documentation of this file.
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#pragma once
38
39#include <sal/macros.h>
42
43#include <com/sun/star/lang/XServiceInfo.hpp>
44
45#include <com/sun/star/sdbc/XDriver.hpp>
46#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
47
48#include <com/sun/star/uno/XComponentContext.hpp>
49
50namespace pq_sdbc_driver
51{
52
53#define PQ_SDBC_DRIVER_VERSION SAL_STRINGIFY(PQ_SDBC_MAJOR) "." \
54 SAL_STRINGIFY(PQ_SDBC_MINOR) "." \
55 SAL_STRINGIFY(PQ_SDBC_MICRO)
56
57// use this to switch off sdbc support !
58// typedef cppu::WeakComponentImplHelper<
59// css::sdbc::XDriver,
60// css::lang::XServiceInfo
61// > DriverBase ;
62typedef cppu::WeakComponentImplHelper<
63 css::sdbc::XDriver,
64 css::lang::XServiceInfo,
65 css::sdbcx::XDataDefinitionSupplier > DriverBase ;
66class Driver : public cppu::BaseMutex, public DriverBase
67{
68 css::uno::Reference< css::uno::XComponentContext > m_ctx;
69 css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr;
70
71public:
72 explicit Driver ( const css::uno::Reference < css::uno::XComponentContext > & ctx )
74 m_ctx( ctx ),
75 m_smgr( ctx->getServiceManager() )
76 {}
77
78public: // XDriver
79 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(
80 const OUString& url,
81 const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
82
83 virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
84
85 virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(
86 const OUString& url,
87 const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
88
89 virtual sal_Int32 SAL_CALL getMajorVersion( ) override;
90 virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
91
92public:
93 // XServiceInfo
94 virtual OUString SAL_CALL getImplementationName() override;
95 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
96
97 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
98
99 // XDataDefinitionSupplier
100 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL
102 const css::uno::Reference< css::sdbc::XConnection >& connection ) override;
103 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL
105 const OUString& url,
106 const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
107
108 // XComponent
109 virtual void SAL_CALL disposing() override;
110
111};
112
113
114}
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
mutable::osl::Mutex m_aMutex
virtual void SAL_CALL disposing() override
Definition: pq_driver.cxx:114
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: pq_driver.cxx:103
css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr
Definition: pq_driver.hxx:69
Driver(const css::uno::Reference< css::uno::XComponentContext > &ctx)
Definition: pq_driver.hxx:72
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: pq_driver.cxx:108
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:80
virtual sal_Int32 SAL_CALL getMajorVersion() override
Definition: pq_driver.cxx:86
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
Definition: pq_driver.cxx:75
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:126
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection(const css::uno::Reference< css::sdbc::XConnection > &connection) override
Definition: pq_driver.cxx:120
css::uno::Reference< css::uno::XComponentContext > m_ctx
Definition: pq_driver.hxx:68
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:61
virtual sal_Int32 SAL_CALL getMinorVersion() override
Definition: pq_driver.cxx:92
virtual OUString SAL_CALL getImplementationName() override
Definition: pq_driver.cxx:98
ctx
cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo, css::sdbcx::XDataDefinitionSupplier > DriverBase
Definition: pq_driver.hxx:65
unsigned char sal_Bool