xref: /aoo4110/main/ucb/source/core/providermap.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _UCB_PROVIDERMAP_HXX_
25 #define _UCB_PROVIDERMAP_HXX_
26 
27 #include <list>
28 #include <com/sun/star/uno/Reference.h>
29 #include <regexpmap.hxx>
30 
31 namespace com { namespace sun { namespace star { namespace ucb {
32 	class XContentProvider;
33 } } } }
34 
35 //============================================================================
36 class ProviderListEntry_Impl
37 {
38 	com::sun::star::uno::Reference<
39 		com::sun::star::ucb::XContentProvider > m_xProvider;
40 	mutable com::sun::star::uno::Reference<
41 		com::sun::star::ucb::XContentProvider > m_xResolvedProvider;
42 
43 private:
44 	com::sun::star::uno::Reference<
45 		com::sun::star::ucb::XContentProvider > resolveProvider() const;
46 
47 public:
ProviderListEntry_Impl(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider> & xProvider)48 	ProviderListEntry_Impl(
49 		const com::sun::star::uno::Reference<
50 			com::sun::star::ucb::XContentProvider >& xProvider )
51 	: m_xProvider( xProvider ) {}
52 
53 	com::sun::star::uno::Reference<
getProvider() const54 		com::sun::star::ucb::XContentProvider > getProvider() const
55 	{ return m_xProvider; }
56 	inline com::sun::star::uno::Reference<
57 		com::sun::star::ucb::XContentProvider > getResolvedProvider() const;
58 };
59 
60 inline com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
getResolvedProvider() const61 ProviderListEntry_Impl::getResolvedProvider() const
62 {
63 	return m_xResolvedProvider.is() ? m_xResolvedProvider : resolveProvider();
64 }
65 
66 //============================================================================
67 typedef std::list< ProviderListEntry_Impl > ProviderList_Impl;
68 
69 //============================================================================
70 typedef ucb_impl::RegexpMap< ProviderList_Impl > ProviderMap_Impl;
71 
72 #endif // _UCB_PROVIDERMAP_HXX_
73 
74