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 : #ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
20 : #define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
21 :
22 : #include <comphelper/stl_types.hxx>
23 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 : #include <com/sun/star/beans/NamedValue.hpp>
25 : #include <com/sun/star/uno/Sequence.h>
26 : #include "connectivity/dbtoolsdllapi.hxx"
27 : #include <salhelper/singletonref.hxx>
28 : #include <comphelper/namedvaluecollection.hxx>
29 : #include <unotools/confignode.hxx>
30 :
31 : namespace connectivity
32 : {
33 : typedef struct
34 0 : {
35 : ::comphelper::NamedValueCollection aProperties;
36 : ::comphelper::NamedValueCollection aFeatures;
37 : ::comphelper::NamedValueCollection aMetaData;
38 : ::rtl::OUString sDriverFactory;
39 : ::rtl::OUString sDriverTypeDisplayName;
40 0 : } TInstalledDriver;
41 : DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
42 :
43 2 : class DriversConfigImpl
44 : {
45 : mutable ::utl::OConfigurationTreeRoot m_aInstalled;
46 : mutable TInstalledDrivers m_aDrivers;
47 : void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const;
48 : public:
49 : DriversConfigImpl();
50 :
51 0 : const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
52 : };
53 : //
54 : // Allows to access all driver which are located in the configuration
55 : //
56 : class OOO_DLLPUBLIC_DBTOOLS DriversConfig
57 : {
58 : typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
59 :
60 : const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
61 : public:
62 : DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
63 : ~DriversConfig();
64 :
65 : DriversConfig( const DriversConfig& );
66 : DriversConfig& operator=( const DriversConfig& );
67 :
68 : ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const;
69 : ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const;
70 : const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const;
71 : const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const;
72 : const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const;
73 : ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
74 : private:
75 : OSharedConfigNode m_aNode;
76 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
77 : };
78 : }
79 : #endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|