LCOV - code coverage report
Current view: top level - extensions/source/resource - oooresourceloader.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 11 0.0 %
Date: 2014-04-14 Functions: 0 3 0.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             : 
      20             : #ifndef EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
      21             : #define EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
      22             : 
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/resource/XResourceBundleLoader.hpp>
      25             : #include <com/sun/star/uno/XComponentContext.hpp>
      26             : #include <cppuhelper/implbase1.hxx>
      27             : 
      28             : #include <functional>
      29             : #include <map>
      30             : #include <utility>
      31             : 
      32             : namespace extensions { namespace resource
      33             : {
      34             :     typedef ::std::pair< OUString, ::com::sun::star::lang::Locale> ResourceBundleDescriptor;
      35             : 
      36             :     struct ResourceBundleDescriptorLess : public ::std::binary_function<ResourceBundleDescriptor, ResourceBundleDescriptor, bool>
      37             :     {
      38           0 :         bool operator()( const ResourceBundleDescriptor& _lhs, const ResourceBundleDescriptor& _rhs ) const
      39             :         {
      40           0 :             if ( _lhs.first < _rhs.first )
      41           0 :                 return true;
      42           0 :             if ( _lhs.second.Language < _rhs.second.Language )
      43           0 :                 return true;
      44           0 :             if ( _lhs.second.Country < _rhs.second.Country )
      45           0 :                 return true;
      46           0 :             if ( _lhs.second.Variant < _rhs.second.Variant )
      47           0 :                 return true;
      48           0 :             return false;
      49             :         }
      50             :     };
      51             : 
      52           0 :     class OpenOfficeResourceLoader : public ::cppu::WeakImplHelper1< ::com::sun::star::resource::XResourceBundleLoader>
      53             :     {
      54             :     public:
      55             :         typedef ::std::map<
      56             :             ResourceBundleDescriptor,
      57             :             ::com::sun::star::uno::WeakReference< ::com::sun::star::resource::XResourceBundle>,
      58             :             ResourceBundleDescriptorLess> ResourceBundleCache;
      59             : 
      60             :         OpenOfficeResourceLoader(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
      61             :         // XResourceBundleLoader
      62             :         virtual  ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle_Default( const OUString& aBaseName ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             :         virtual  ::com::sun::star::uno::Reference<  ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle( const OUString& abaseName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      64             : 
      65             :     private:
      66             :         OpenOfficeResourceLoader();                                             // never implemented
      67             :         OpenOfficeResourceLoader( const OpenOfficeResourceLoader& );            // never implemented
      68             :         OpenOfficeResourceLoader& operator=( const OpenOfficeResourceLoader& ); // never implemented
      69             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
      70             :         ::osl::Mutex m_aMutex;
      71             :         ResourceBundleCache m_aBundleCache;
      72             :     };
      73             : }}
      74             : 
      75             : #endif // EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10