Bump version to 6.4-15
[LibreOffice.git] / include / connectivity / sdbcx / VCatalog.hxx
blob1cf20e1ce25759986e5f46891c6f78f275448353
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_CONNECTIVITY_SDBCX_VCATALOG_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VCATALOG_HXX
23 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
24 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
25 #include <com/sun/star/sdbcx/XUsersSupplier.hpp>
26 #include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
27 #include <cppuhelper/compbase.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <connectivity/CommonTools.hxx>
30 #include <connectivity/sdbcx/IRefreshable.hxx>
31 #include <connectivity/dbtoolsdllapi.hxx>
32 #include <memory>
34 namespace com::sun::star::sdbc { class XConnection; }
35 namespace com::sun::star::sdbc { class XDatabaseMetaData; }
36 namespace com::sun::star::sdbc { class XResultSet; }
37 namespace com::sun::star::sdbc { class XRow; }
39 namespace connectivity
41 namespace sdbcx
44 class OCollection;
45 // OCatalog is a general catalog class
46 // other drivers can be derived their catalog from this class when they want to support sdbcx
47 // it holds already tables, views, groups and users
49 typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XTablesSupplier,
50 css::sdbcx::XViewsSupplier,
51 css::sdbcx::XUsersSupplier,
52 css::sdbcx::XGroupsSupplier,
53 css::lang::XServiceInfo> OCatalog_BASE;
56 class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
57 public OCatalog_BASE,
58 public IRefreshableGroups,
59 public IRefreshableUsers
61 protected:
63 ::osl::Mutex m_aMutex;
65 // this members are deleted when the dtor is called
66 // they are hold weak
67 std::unique_ptr<OCollection> m_pTables;
68 std::unique_ptr<OCollection> m_pViews;
69 std::unique_ptr<OCollection> m_pGroups;
70 std::unique_ptr<OCollection> m_pUsers;
72 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
74 /** builds the name which should be used to access the object later on in the collection.
75 Will only be called in fillNames.
76 @param _xRow
77 The current row from the resultset given to fillNames.
79 virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow);
81 /** fills a vector with the necessary names which can be used in combination with the collections.
82 For each row buildName will be called.
83 @param _xResult
84 The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
85 @param _rNames
86 The vector who will be filled.
88 void fillNames(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames);
90 public:
91 OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection);
92 virtual ~OCatalog() override;
94 DECLARE_SERVICE_INFO();
96 // refreshTables is called when the method getTables had been called
97 // the member m_pTables has to be created
98 virtual void refreshTables() = 0;
99 // refreshViews is called when the method getViews had been called
100 virtual void refreshViews() = 0;
102 // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
104 // ::cppu::OComponentHelper
105 virtual void SAL_CALL disposing() override;
106 // XTablesSupplier
107 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override;
108 // XViewsSupplier
109 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews( ) override;
110 // XUsersSupplier
111 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override;
112 // XGroupsSupplier
113 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override;
119 #endif // INCLUDED_CONNECTIVITY_SDBCX_VCATALOG_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */