LibreOffice Module dbaccess (master) 1
FilteredContainer.hxx
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#pragma once
20
21#include <sal/config.h>
22
23#include <atomic>
24#include <cstddef>
25
26#include <com/sun/star/container/XNameAccess.hpp>
27#include <com/sun/star/sdbc/XConnection.hpp>
28
30
31namespace dbtools
32{
33 class WarningsContainer;
34}
35
36namespace dbaccess
37{
38 class IRefreshListener;
39
41 {
42 private:
43 mutable bool m_bConstructed; // late ctor called
44
45 protected:
47 std::atomic<std::size_t>& m_nInAppend;
48
49 // holds the original container which where set in construct but they can be null
50 css::uno::Reference< css::container::XNameAccess > m_xMasterContainer;
51 css::uno::WeakReference< css::sdbc::XConnection > m_xConnection;
52 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
53
57 virtual OUString getTableTypeRestriction() const = 0;
58
61
62 // ::connectivity::sdbcx::OCollection
63 virtual void impl_refresh() override;
64
65 virtual OUString getNameForObject(const ::connectivity::sdbcx::ObjectType& _xObject) override;
66
70 virtual void disposing() override;
71
73 {
74 public:
75 EnsureReset( std::atomic<std::size_t>& _rValueLocation)
76 :m_rValue( _rValueLocation )
77 {
78 ++m_rValue;
79 }
80
82 {
83 --m_rValue;
84 }
85
86 private:
87 std::atomic<std::size_t>& m_rValue;
88 };
89
93 void getAllTableTypeFilter( css::uno::Sequence< OUString >& /* [out] */ _rFilter ) const;
94
95 public:
106 ::osl::Mutex& _rMutex,
107 const css::uno::Reference< css::sdbc::XConnection >& _xCon,
108 bool _bCase,
109 IRefreshListener* _pRefreshListener,
110 std::atomic<std::size_t>& _nInAppend
111 );
112
113 void dispose() { disposing(); }
114
119 const css::uno::Sequence< OUString >& _rTableFilter,
120 const css::uno::Sequence< OUString >& _rTableTypeFilter
121 );
122
127 const css::uno::Reference< css::container::XNameAccess >& _rxMasterContainer,
128 const css::uno::Sequence< OUString >& _rTableFilter,
129 const css::uno::Sequence< OUString >& _rTableTypeFilter
130 );
131
132 bool isInitialized() const { return m_bConstructed; }
133 };
134} // namespace
135
136/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EnsureReset(std::atomic< std::size_t > &_rValueLocation)
virtual void impl_refresh() override
void construct(const css::uno::Reference< css::container::XNameAccess > &_rxMasterContainer, const css::uno::Sequence< OUString > &_rTableFilter, const css::uno::Sequence< OUString > &_rTableTypeFilter)
late ctor.
virtual void removeMasterContainerListener()
IRefreshListener * m_pRefreshListener
css::uno::Reference< css::container::XNameAccess > m_xMasterContainer
void getAllTableTypeFilter(css::uno::Sequence< OUString > &_rFilter) const
retrieve a table type filter to pass to <member scope="css::sdbc">XDatabaseMetaData::getTables</membe...
virtual OUString getNameForObject(const ::connectivity::sdbcx::ObjectType &_xObject) override
std::atomic< std::size_t > & m_nInAppend
virtual void disposing() override
tell the container to free all elements and all additional resources.
css::uno::WeakReference< css::sdbc::XConnection > m_xConnection
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
virtual OUString getTableTypeRestriction() const =0
returns a string denoting the only type of tables allowed in this container, or an empty string if th...
OFilteredContainer(::cppu::OWeakObject &_rParent, ::osl::Mutex &_rMutex, const css::uno::Reference< css::sdbc::XConnection > &_xCon, bool _bCase, IRefreshListener *_pRefreshListener, std::atomic< std::size_t > &_nInAppend)
ctor of the container.
void construct(const css::uno::Sequence< OUString > &_rTableFilter, const css::uno::Sequence< OUString > &_rTableTypeFilter)
late ctor.
ObjectType
Definition: object.hxx:23