LibreOffice Module ucb (master) 1
cacheddynamicresultset.cxx
Go to the documentation of this file.
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
23#include <osl/diagnose.h>
25#include <ucbhelper/macros.hxx>
26
27using namespace com::sun::star::lang;
28using namespace com::sun::star::sdbc;
29using namespace com::sun::star::ucb;
30using namespace com::sun::star::uno;
31
32
34 Reference< XDynamicResultSet > const & xOrigin
35 , const Reference< XContentIdentifierMapping > & xContentMapping
36 , const Reference< XComponentContext > & xContext )
37 : DynamicResultSetWrapper( xOrigin, xContext )
38 , m_xContentIdentifierMapping( xContentMapping )
39{
40 impl_init();
41}
42
44{
46}
47
48//virtual
51{
53 OSL_ENSURE( m_xSourceResultOne.is(), "need source resultset" );
54
57
58 std::unique_lock aGuard( m_aMutex );
59 m_xMyResultOne = xCache;
60}
61
62//virtual
65{
67 OSL_ENSURE( m_xSourceResultTwo.is(), "need source resultset" );
68
71
72 std::unique_lock aGuard( m_aMutex );
73 m_xMyResultTwo = xCache;
74}
75
76
77// XInterface methods.
79 noexcept
80{
81 OWeakObject::acquire();
82}
83
85 noexcept
86{
87 OWeakObject::release();
88}
89
91 ::queryInterface( const Type& rType )
92{
93 //list all interfaces inclusive baseclasses of interfaces
94
96 if( aRet.hasValue() )
97 return aRet;
98
99 aRet = cppu::queryInterface( rType,
100 static_cast< XTypeProvider* >( this )
101 , static_cast< XServiceInfo* >( this )
102 );
103 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
104}
105
106
107// XTypeProvider methods.
108
109//list all interfaces exclusive baseclasses
111 , XTypeProvider
112 , XServiceInfo
113 , XDynamicResultSet
114 , XSourceInitialization
115 );
116
117
118// XServiceInfo methods.
119
121{
122 return "com.sun.star.comp.ucb.CachedDynamicResultSet";
123}
124
125sal_Bool SAL_CALL CachedDynamicResultSet::supportsService( const OUString& ServiceName )
126{
127 return cppu::supportsService( this, ServiceName );
128}
129
130css::uno::Sequence< OUString > SAL_CALL CachedDynamicResultSet::getSupportedServiceNames()
131{
132 return { "com.sun.star.ucb.CachedDynamicResultSet" };
133}
134
135
136// own methods. ( inherited )
137
138//virtual
140 ::impl_disposing( const EventObject& Source )
141{
144}
145
146
147
148
150 const Reference< XComponentContext > & xContext )
151{
152 m_xContext = xContext;
153}
154
156{
157}
158
159
160// CachedDynamicResultSetFactory XServiceInfo methods.
161
163{
164 return "com.sun.star.comp.ucb.CachedDynamicResultSetFactory";
165}
166sal_Bool SAL_CALL CachedDynamicResultSetFactory::supportsService( const OUString& ServiceName )
167{
168 return cppu::supportsService( this, ServiceName );
169}
170css::uno::Sequence< OUString > SAL_CALL CachedDynamicResultSetFactory::getSupportedServiceNames()
171{
172 return { "com.sun.star.ucb.CachedDynamicResultSetFactory" };
173}
174
175// Service factory implementation.
176
177
178
179extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
181 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
182{
183 return cppu::acquire(new CachedDynamicResultSetFactory(context));
184}
185
186// CachedDynamicResultSetFactory XCachedDynamicResultSetFactory methods.
187
188
189//virtual
192 const Reference< XDynamicResultSet > & SourceStub
193 , const Reference< XContentIdentifierMapping > & ContentIdentifierMapping )
194{
195 Reference< XDynamicResultSet > xRet = new CachedDynamicResultSet( SourceStub, ContentIdentifierMapping, m_xContext );
196 return xRet;
197}
198
199
200/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ucb_CachedDynamicResultSetFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
XTYPEPROVIDER_IMPL_4(CachedDynamicResultSet, XTypeProvider, XServiceInfo, XDynamicResultSet, XSourceInitialization)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL createCachedDynamicResultSet(const css::uno::Reference< css::ucb::XDynamicResultSet > &SourceStub, const css::uno::Reference< css::ucb::XContentIdentifierMapping > &ContentIdentifierMapping) override
virtual OUString SAL_CALL getImplementationName() override
virtual ~CachedDynamicResultSetFactory() override
CachedDynamicResultSetFactory(const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~CachedDynamicResultSet() override
css::uno::Reference< css::ucb::XContentIdentifierMapping > m_xContentIdentifierMapping
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void impl_disposing(const css::lang::EventObject &Source) override
virtual void impl_InitResultSetOne(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
CachedDynamicResultSet(css::uno::Reference< css::ucb::XDynamicResultSet > const &xOrigin, const css::uno::Reference< css::ucb::XContentIdentifierMapping > &xContentMapping, const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual OUString SAL_CALL getImplementationName() override
virtual void impl_InitResultSetTwo(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void impl_InitResultSetTwo(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void impl_disposing(const css::lang::EventObject &Source)
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultOne
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultTwo
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultOne
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultTwo
virtual void impl_InitResultSetOne(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)
Type
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool