nss: upgrade to release 3.73
[LibreOffice.git] / scripting / source / provider / ProviderCache.hxx
blobb2a35a58d1728d6f8a811948ec6d3400fb97fb69
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SCRIPTING_SOURCE_PROVIDER_PROVIDERCACHE_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_PROVIDER_PROVIDERCACHE_HXX
23 #include <osl/mutex.hxx>
24 #include <rtl/ustring.hxx>
25 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
26 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
28 #include <com/sun/star/script/provider/XScriptProvider.hpp>
30 #include <unordered_map>
32 namespace func_provider
35 //Typedefs
38 struct ProviderDetails
40 //css::uno::Reference< css::lang::XSingleServiceFactory > factory;
41 css::uno::Reference< css::lang::XSingleComponentFactory > factory;
42 css::uno::Reference< css::script::provider::XScriptProvider > provider;
44 typedef std::unordered_map < OUString, ProviderDetails > ProviderDetails_hash;
47 class ProviderCache
50 public:
51 /// @throws css::uno::RuntimeException
52 ProviderCache( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Sequence< css::uno::Any >& scriptContext );
53 /// @throws css::uno::RuntimeException
54 ProviderCache( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Sequence< css::uno::Any >& scriptContext,
55 const css::uno::Sequence< OUString >& denyList );
56 ~ProviderCache();
57 css::uno::Reference< css::script::provider::XScriptProvider >
58 getProvider( const OUString& providerName );
59 /// @throws css::uno::RuntimeException
60 css::uno::Sequence < css::uno::Reference< css::script::provider::XScriptProvider > >
61 getAllProviders();
62 private:
63 /// @throws css::uno::RuntimeException
64 void populateCache();
66 /// @throws css::uno::RuntimeException
67 css::uno::Reference< css::script::provider::XScriptProvider >
68 createProvider( ProviderDetails& details );
69 bool isInDenyList( const OUString& serviceName );
70 css::uno::Sequence< OUString > m_sDenyList;
71 ProviderDetails_hash m_hProviderDetailsCache;
72 osl::Mutex m_mutex;
73 css::uno::Sequence< css::uno::Any > m_Sctx;
74 css::uno::Reference< css::uno::XComponentContext > m_xContext;
75 css::uno::Reference< css::lang::XMultiComponentFactory > m_xMgr;
79 } // func_provider
80 #endif
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */