LCOV - code coverage report
Current view: top level - include/connectivity - DriversConfig.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 4 100.0 %
Date: 2014-11-03 Functions: 6 6 100.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             : #ifndef INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
      20             : #define INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : 
      24             : #include <map>
      25             : 
      26             : #include <com/sun/star/beans/NamedValue.hpp>
      27             : #include <com/sun/star/uno/Sequence.h>
      28             : #include <connectivity/dbtoolsdllapi.hxx>
      29             : #include <salhelper/singletonref.hxx>
      30             : #include <comphelper/namedvaluecollection.hxx>
      31             : #include <unotools/confignode.hxx>
      32             : 
      33             : namespace connectivity
      34             : {
      35             :     typedef struct
      36        1036 :     {
      37             :         ::comphelper::NamedValueCollection aProperties;
      38             :         ::comphelper::NamedValueCollection aFeatures;
      39             :         ::comphelper::NamedValueCollection aMetaData;
      40             :         OUString sDriverFactory;
      41             :         OUString sDriverTypeDisplayName;
      42        4380 :     } TInstalledDriver;
      43             :     typedef std::map<OUString, TInstalledDriver> TInstalledDrivers;
      44             : 
      45          58 :     class DriversConfigImpl
      46             :     {
      47             :         mutable ::utl::OConfigurationTreeRoot   m_aInstalled;
      48             :         mutable TInstalledDrivers       m_aDrivers;
      49             :         void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const;
      50             :     public:
      51             :         DriversConfigImpl();
      52             : 
      53        6806 :         const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
      54             :     };
      55             : 
      56             :     // Allows to access all driver which are located in the configuration
      57             : 
      58             :     class OOO_DLLPUBLIC_DBTOOLS DriversConfig
      59             :     {
      60             :         typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
      61             : 
      62             :         const ::comphelper::NamedValueCollection& impl_get(const OUString& _sURL,sal_Int32 _nProps) const;
      63             :     public:
      64             :         DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
      65             :         ~DriversConfig();
      66             : 
      67             :         DriversConfig( const DriversConfig& );
      68             :         DriversConfig& operator=( const DriversConfig& );
      69             : 
      70             :         OUString getDriverFactoryName(const OUString& _sUrl) const;
      71             :         OUString getDriverTypeDisplayName(const OUString& _sUrl) const;
      72             :         const ::comphelper::NamedValueCollection& getProperties(const OUString& _sURL) const;
      73             :         const ::comphelper::NamedValueCollection& getFeatures(const OUString& _sURL) const;
      74             :         const ::comphelper::NamedValueCollection& getMetaData(const OUString& _sURL) const;
      75             :         ::com::sun::star::uno::Sequence< OUString > getURLs() const;
      76             :     private:
      77             :         OSharedConfigNode   m_aNode;
      78             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB;
      79             :     };
      80             : }
      81             : #endif // INCLUDED_CONNECTIVITY_DRIVERSCONFIG_HXX
      82             : 
      83             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10