LibreOffice Module connectivity (master) 1
MacabDriver.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/sdbc/XDriver.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <com/sun/star/frame/XTerminateListener.hpp>
25#include <com/sun/star/uno/XComponentContext.hpp>
27#include <osl/module.h>
28
29// the address book driver's version
30#define MACAB_DRIVER_VERSION "0.1"
31#define MACAB_DRIVER_VERSION_MAJOR 0
32#define MACAB_DRIVER_VERSION_MINOR 1
33
34namespace connectivity::macab
35{
36 class MacabConnection;
37 class MacabDriver;
38
39 typedef void* (SAL_CALL * ConnectionFactoryFunction)( void* _pDriver );
40
41 typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray;
42
43
44 // = MacabImplModule
45
47 {
48 private:
53
54 public:
56
59 bool isMacOSPresent();
60
68 void init();
69
72 void shutdown();
73
81
82 private:
92 bool impl_loadModule();
93
97 void impl_unloadModule();
98 };
99
100
101 // = MacabDriver
102
103 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
104 css::lang::XServiceInfo,
105 css::frame::XTerminateListener > MacabDriver_BASE;
107 {
108 protected:
109 ::osl::Mutex m_aMutex; // mutex is need to control member access
110 OWeakRefArray m_xConnections; // vector containing a list of all the
111 // MacabConnection objects for this Driver
112 css::uno::Reference< css::uno::XComponentContext >
113 m_xContext; // the multi-service factory
115
116 public:
117 css::uno::Reference< css::uno::XComponentContext > const &
118 getComponentContext() const { return m_xContext; }
119
122 static OUString impl_getConfigurationSettingsPath();
123
124 explicit MacabDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
125 protected:
126
127 // OComponentHelper
128 virtual void SAL_CALL disposing() override;
129
130 // XServiceInfo
131 virtual OUString SAL_CALL getImplementationName( ) override;
132 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
133 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
134
135 // XDriver
136 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
137 virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
138 virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
139 virtual sal_Int32 SAL_CALL getMajorVersion() override;
140 virtual sal_Int32 SAL_CALL getMinorVersion() override;
141
142 // XTerminateListener
143 virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override;
144 virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override;
145
146 // XEventListener
147 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
148
149 private:
157 };
158
159}
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL queryTermination(const css::lang::EventObject &Event) override
css::uno::Reference< css::uno::XComponentContext > const & getComponentContext() const
virtual void SAL_CALL disposing() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
MacabDriver(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void impl_shutdownImplementationModule()
shuts down the library which contains the real implementations
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &Event) override
static OUString impl_getConfigurationSettingsPath()
returns the path of our configuration settings
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
virtual sal_Int32 SAL_CALL getMinorVersion() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual sal_Int32 SAL_CALL getMajorVersion() override
bool impl_loadModule()
loads the implementation module and retrieves the needed symbols
bool m_bAttemptedLoadModule
Did we already attempt to load the module and to retrieve the symbols?
Definition: MacabDriver.hxx:50
ConnectionFactoryFunction m_pConnectionFactoryFunc
Definition: MacabDriver.hxx:52
MacabConnection * createConnection(MacabDriver *_pDriver) const
creates a new connection @precond <member>init</member> has been called before
void shutdown()
shuts down the impl module
void impl_unloadModule()
unloads the implementation module, and resets all function pointers to <NULL> @precond m_hConnectorMo...
void init()
initializes the implementation module.
bool isMacOSPresent()
determines whether there is a mac OS present in the environment
Definition: MacabDriver.cxx:78
std::vector< css::uno::WeakReferenceHelper > OWeakRefArray
void *SAL_CALL * ConnectionFactoryFunction(void *_pDriver)
Definition: MacabDriver.hxx:39
::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo, css::frame::XTerminateListener > MacabDriver_BASE
unsigned char sal_Bool