cid#1607171 Data race condition
[LibreOffice.git] / ucb / source / cacher / cacheddynamicresultset.hxx
blob814b57afc95729f5b26caf085a29a2b28bb8f6e8
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 #pragma once
22 #include "dynamicresultsetwrapper.hxx"
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/lang/XTypeProvider.hpp>
25 #include <com/sun/star/ucb/XContentIdentifierMapping.hpp>
26 #include <com/sun/star/ucb/XCachedDynamicResultSetFactory.hpp>
27 #include <cppuhelper/implbase.hxx>
30 class CachedDynamicResultSet
31 : public DynamicResultSetWrapper
32 , public css::lang::XTypeProvider
33 , public css::lang::XServiceInfo
35 css::uno::Reference< css::ucb::XContentIdentifierMapping >
36 m_xContentIdentifierMapping;
38 protected:
39 virtual void
40 impl_InitResultSetOne( std::unique_lock<std::mutex>& rGuard, const css::uno::Reference< css::sdbc::XResultSet >& xResultSet ) override;
41 virtual void
42 impl_InitResultSetTwo( std::unique_lock<std::mutex>& rGuard, const css::uno::Reference< css::sdbc::XResultSet >& xResultSet ) override;
44 public:
45 CachedDynamicResultSet( css::uno::Reference< css::ucb::XDynamicResultSet > const & xOrigin
46 , const css::uno::Reference< css::ucb::XContentIdentifierMapping > & xContentMapping
47 , const css::uno::Reference< css::uno::XComponentContext > & xContext );
49 virtual ~CachedDynamicResultSet() override;
52 // XInterface
53 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
54 virtual void SAL_CALL acquire()
55 noexcept override;
56 virtual void SAL_CALL release()
57 noexcept override;
59 // XTypeProvider
61 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
62 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
64 // XServiceInfo
65 virtual OUString SAL_CALL getImplementationName() override;
66 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
67 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
69 // own methods ( inherited )
71 virtual void
72 impl_disposing( const css::lang::EventObject& Source ) override;
76 class CachedDynamicResultSetFactory final :
77 public cppu::WeakImplHelper<
78 css::lang::XServiceInfo,
79 css::ucb::XCachedDynamicResultSetFactory>
81 css::uno::Reference< css::uno::XComponentContext > m_xContext;
83 public:
85 CachedDynamicResultSetFactory(
86 const css::uno::Reference< css::uno::XComponentContext > & xContext);
88 virtual ~CachedDynamicResultSetFactory() override;
90 // XServiceInfo
91 virtual OUString SAL_CALL getImplementationName() override;
92 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
93 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
95 // XCachedDynamicResultSetFactory
97 virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL
98 createCachedDynamicResultSet(
99 const css::uno::Reference< css::ucb::XDynamicResultSet > & SourceStub
100 , const css::uno::Reference< css::ucb::XContentIdentifierMapping > & ContentIdentifierMapping
101 ) override;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */