Branch libreoffice-5-0-4
[LibreOffice.git] / include / connectivity / warningscontainer.hxx
blob4d652b2ba3a6dd1a02c59e3b56ca344548125431
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_WARNINGSCONTAINER_HXX
21 #define INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
23 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
24 #include <com/sun/star/sdb/SQLContext.hpp>
26 #include <connectivity/dbtoolsdllapi.hxx>
29 namespace dbtools
34 //= IWarningsContainer
36 class SAL_NO_VTABLE IWarningsContainer
38 public:
39 virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) = 0;
40 virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) = 0;
41 virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) = 0;
43 protected:
44 ~IWarningsContainer() {}
48 //= WarningsContainer
50 /** helper class for implementing XWarningsSupplier, which mixes own warnings with
51 warnings obtained from an external instance
53 class OOO_DLLPUBLIC_DBTOOLS WarningsContainer : public IWarningsContainer
55 private:
56 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier > m_xExternalWarnings;
57 ::com::sun::star::uno::Any m_aOwnWarnings;
59 public:
60 WarningsContainer() { }
61 WarningsContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
62 :m_xExternalWarnings( _rxExternalWarnings )
65 virtual ~WarningsContainer();
67 void setExternalWarnings( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
69 m_xExternalWarnings = _rxExternalWarnings;
72 // convenience
73 /** appends an SQLWarning instance to the chain
74 @param _rWarning
75 the warning message
76 @param _pAsciiSQLState
77 the SQLState of the warning
78 @param _rxContext
79 the context of the warning
81 void appendWarning(
82 const OUString& _rWarning,
83 const sal_Char* _pAsciiSQLState,
84 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
86 // IWarningsContainer
87 virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) SAL_OVERRIDE;
88 virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) SAL_OVERRIDE;
89 virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) SAL_OVERRIDE;
91 // XWarningsSupplier equivalents
92 ::com::sun::star::uno::Any SAL_CALL getWarnings( ) const;
93 void SAL_CALL clearWarnings( );
97 } // namespace dbtools
100 #endif // INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */