Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/connectivity/warningscontainer.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
#ifndef INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
21
#define INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
22
23
#include <config_options.h>
24
#include <connectivity/dbtoolsdllapi.hxx>
25
26
#include <com/sun/star/uno/Reference.hxx>
27
#include <utility>
28
29
namespace com::sun::star::sdbc { class SQLException; }
30
namespace com::sun::star::sdbc { class SQLWarning; }
31
namespace com::sun::star::sdbc { class XWarningsSupplier; }
32
namespace com::sun::star::sdb { class SQLContext; }
33
namespace com::sun::star::uno { class XInterface; }
34
35
namespace dbtools
36
{
37
38
    /** helper class for implementing XWarningsSupplier, which mixes own warnings with
39
        warnings obtained from an external instance
40
    */
41
    class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) WarningsContainer
42
    {
43
    private:
44
        css::uno::Reference< css::sdbc::XWarningsSupplier >   m_xExternalWarnings;
45
        css::uno::Any                                         m_aOwnWarnings;
46
47
    public:
48
9.73k
        WarningsContainer() {}
49
        WarningsContainer( css::uno::Reference< css::sdbc::XWarningsSupplier > _xExternalWarnings )
50
0
            :m_xExternalWarnings(std::move( _xExternalWarnings )) {}
51
52
        void setExternalWarnings( const css::uno::Reference< css::sdbc::XWarningsSupplier >& _rxExternalWarnings )
53
38.5k
        {
54
38.5k
            m_xExternalWarnings = _rxExternalWarnings;
55
38.5k
        }
56
57
        // convenience
58
        /** appends an SQLWarning instance to the chain
59
            @param  _rWarning
60
                the warning message
61
            @param  _pAsciiSQLState
62
                the SQLState of the warning
63
            @param  _rxContext
64
                the context of the warning
65
        */
66
        void appendWarning(
67
            const OUString& _rWarning,
68
            const char* _pAsciiSQLState,
69
            const css::uno::Reference< css::uno::XInterface >& _rxContext );
70
71
        void appendWarning(const css::sdbc::SQLException& _rWarning);
72
        void appendWarning(const css::sdbc::SQLWarning& _rWarning);
73
        void appendWarning(const css::sdb::SQLContext& _rContext);
74
75
        // XWarningsSupplier equivalents
76
        css::uno::Any getWarnings(  ) const;
77
        void clearWarnings(  );
78
    };
79
80
81
}   // namespace dbtools
82
83
84
#endif // INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
85
86
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */