/src/libreoffice/connectivity/inc/sdbcx/VKey.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | |
23 | | #include <comphelper/IdPropArrayHelper.hxx> |
24 | | #include <connectivity/CommonTools.hxx> |
25 | | #include <sdbcx/VTypeDef.hxx> |
26 | | #include <connectivity/sdbcx/IRefreshable.hxx> |
27 | | #include <connectivity/sdbcx/VDescriptor.hxx> |
28 | | #include <connectivity/dbtoolsdllapi.hxx> |
29 | | #include <cppuhelper/implbase1.hxx> |
30 | | #include <cppuhelper/basemutex.hxx> |
31 | | #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> |
32 | | #include <memory> |
33 | | #include <utility> |
34 | | |
35 | | namespace connectivity::sdbcx |
36 | | { |
37 | | |
38 | | struct OOO_DLLPUBLIC_DBTOOLS KeyProperties |
39 | | { |
40 | | ::std::vector< OUString> m_aKeyColumnNames; |
41 | | OUString m_ReferencedTable; |
42 | | sal_Int32 m_Type; |
43 | | sal_Int32 m_UpdateRule; |
44 | | sal_Int32 m_DeleteRule; |
45 | | KeyProperties(OUString ReferencedTable, |
46 | | sal_Int32 Type, |
47 | | sal_Int32 UpdateRule, |
48 | | sal_Int32 DeleteRule) |
49 | 9.50k | :m_ReferencedTable(std::move(ReferencedTable)), |
50 | 9.50k | m_Type(Type), |
51 | 9.50k | m_UpdateRule(UpdateRule), |
52 | 9.50k | m_DeleteRule(DeleteRule) |
53 | 9.50k | {} |
54 | 0 | KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){} |
55 | | }; |
56 | | typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OKey_BASE; |
57 | | class OCollection; |
58 | | |
59 | | class OOO_DLLPUBLIC_DBTOOLS OKey : |
60 | | public cppu::BaseMutex, |
61 | | public ODescriptor_BASE, |
62 | | public IRefreshableColumns, |
63 | | public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, |
64 | | public ODescriptor, |
65 | | public OKey_BASE |
66 | | { |
67 | | protected: |
68 | | std::shared_ptr<KeyProperties> m_aProps; |
69 | | // no Reference! see OCollection::acquire |
70 | | std::unique_ptr<OCollection> m_pColumns; |
71 | | |
72 | | using ODescriptor_BASE::rBHelper; |
73 | | // OPropertyArrayUsageHelper |
74 | | virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; |
75 | | // OPropertySetHelper |
76 | | virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; |
77 | | public: |
78 | | OKey(bool _bCase); |
79 | | OKey(const OUString& Name,std::shared_ptr<KeyProperties> _xProps,bool _bCase); |
80 | | |
81 | | virtual ~OKey( ) override; |
82 | | |
83 | | DECLARE_SERVICE_INFO(); |
84 | | //XInterface |
85 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; |
86 | | virtual void SAL_CALL acquire() noexcept override; |
87 | | virtual void SAL_CALL release() noexcept override; |
88 | | //XTypeProvider |
89 | | virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; |
90 | | // ODescriptor |
91 | | virtual void construct() override; |
92 | | |
93 | | // ::cppu::OComponentHelper |
94 | | virtual void SAL_CALL disposing() override; |
95 | | // XPropertySet |
96 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
97 | | // XColumnsSupplier |
98 | | virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; |
99 | | |
100 | | // XNamed |
101 | | virtual OUString SAL_CALL getName( ) override; |
102 | | virtual void SAL_CALL setName( const OUString& aName ) override; |
103 | | // XDataDescriptorFactory |
104 | | virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; |
105 | | }; |
106 | | |
107 | | } |
108 | | |
109 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |