Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/connectivity/source/sdbcx/VDescriptor.cxx
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
#include <connectivity/sdbcx/VDescriptor.hxx>
21
#include <com/sun/star/beans/PropertyAttribute.hpp>
22
#include <cppuhelper/typeprovider.hxx>
23
24
#include <algorithm>
25
26
namespace connectivity::sdbcx
27
{
28
        using namespace ::com::sun::star::uno;
29
        using namespace ::com::sun::star::beans;
30
31
32
        // = ODescriptor
33
34
35
        ODescriptor::ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew)
36
3.13M
            :ODescriptor_PBASE(_rBHelper)
37
3.13M
            ,m_aCase(_bCase)
38
3.13M
            ,m_bNew(_bNew)
39
3.13M
        {
40
3.13M
        }
41
42
43
        // css::lang::XUnoTunnel
44
        namespace
45
        {
46
            struct ResetROAttribute
47
            {
48
                void operator ()( Property& _rProperty ) const
49
0
                {
50
0
                    _rProperty.Attributes &= ~PropertyAttribute::READONLY;
51
0
                }
52
            };
53
            struct SetROAttribute
54
            {
55
                void operator ()( Property& _rProperty ) const
56
910k
                {
57
910k
                    _rProperty.Attributes |= PropertyAttribute::READONLY;
58
910k
                }
59
            };
60
        }
61
62
63
        ::cppu::IPropertyArrayHelper* ODescriptor::doCreateArrayHelper() const
64
55.5k
        {
65
55.5k
            Sequence< Property > aProperties;
66
55.5k
            describeProperties( aProperties );
67
68
55.5k
            auto [begin, end] = asNonConstRange(aProperties);
69
55.5k
            if ( isNew() )
70
0
                std::for_each( begin, end, ResetROAttribute() );
71
55.5k
            else
72
55.5k
                std::for_each( begin, end, SetROAttribute() );
73
74
55.5k
            return new ::cppu::OPropertyArrayHelper( aProperties );
75
55.5k
        }
76
77
78
        bool ODescriptor::isNew( const Reference< XInterface >& _rxDescriptor )
79
0
        {
80
0
            ODescriptor* pImplementation = dynamic_cast<ODescriptor*>( _rxDescriptor.get() );
81
0
            return pImplementation && pImplementation->isNew();
82
0
        }
83
84
85
        void ODescriptor::setNew(bool _bNew)
86
0
        {
87
0
            m_bNew = _bNew;
88
0
        }
89
90
91
        Sequence< Type > SAL_CALL ODescriptor::getTypes(  )
92
0
        {
93
0
            ::cppu::OTypeCollection aTypes( cppu::UnoType<XMultiPropertySet>::get(),
94
0
                                            cppu::UnoType<XFastPropertySet>::get(),
95
0
                                            cppu::UnoType<XPropertySet>::get());
96
0
            return aTypes.getTypes();
97
0
        }
98
99
}
100
101
102
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */