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