1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_RESULTSETBASE_HXX
20 #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_RESULTSETBASE_HXX
24 #include <cppuhelper/weak.hxx>
25 #include <comphelper/interfacecontainer2.hxx>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/ucb/XContentAccess.hpp>
28 #include <com/sun/star/sdbc/XCloseable.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/sdbc/XResultSet.hpp>
31 #include <com/sun/star/sdbc/XRow.hpp>
32 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
33 #include <com/sun/star/ucb/XContentProvider.hpp>
34 #include <com/sun/star/ucb/XContentIdentifier.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/beans/Property.hpp>
42 : public cppu::OWeakObject
,
43 public css::lang::XComponent
,
44 public css::sdbc::XRow
,
45 public css::sdbc::XResultSet
,
46 public css::sdbc::XCloseable
,
47 public css::sdbc::XResultSetMetaDataSupplier
,
48 public css::beans::XPropertySet
,
49 public css::ucb::XContentAccess
53 ResultSetBase( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
54 const css::uno::Reference
< css::ucb::XContentProvider
>& xProvider
,
55 const css::uno::Sequence
< css::beans::Property
>& seq
);
57 virtual ~ResultSetBase() override
;
60 virtual css::uno::Any SAL_CALL
61 queryInterface( const css::uno::Type
& aType
) override
;
76 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
79 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
83 virtual sal_Bool SAL_CALL
86 if( 0<= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
87 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
93 virtual OUString SAL_CALL
94 getString( sal_Int32 columnIndex
) override
96 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
97 return m_aItems
[m_nRow
]->getString( columnIndex
);
102 virtual sal_Bool SAL_CALL
103 getBoolean( sal_Int32 columnIndex
) override
105 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
106 return m_aItems
[m_nRow
]->getBoolean( columnIndex
);
111 virtual sal_Int8 SAL_CALL
112 getByte( sal_Int32 columnIndex
) override
114 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
115 return m_aItems
[m_nRow
]->getByte( columnIndex
);
117 return sal_Int8( 0 );
120 virtual sal_Int16 SAL_CALL
121 getShort( sal_Int32 columnIndex
) override
123 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
124 return m_aItems
[m_nRow
]->getShort( columnIndex
);
126 return sal_Int16( 0 );
129 virtual sal_Int32 SAL_CALL
130 getInt( sal_Int32 columnIndex
) override
132 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
133 return m_aItems
[m_nRow
]->getInt( columnIndex
);
138 virtual sal_Int64 SAL_CALL
139 getLong( sal_Int32 columnIndex
) override
141 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
142 return m_aItems
[m_nRow
]->getLong( columnIndex
);
144 return sal_Int64( 0 );
147 virtual float SAL_CALL
148 getFloat( sal_Int32 columnIndex
) override
150 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
151 return m_aItems
[m_nRow
]->getFloat( columnIndex
);
156 virtual double SAL_CALL
157 getDouble( sal_Int32 columnIndex
) override
159 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
160 return m_aItems
[m_nRow
]->getDouble( columnIndex
);
165 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
166 getBytes( sal_Int32 columnIndex
) override
168 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
169 return m_aItems
[m_nRow
]->getBytes( columnIndex
);
171 return css::uno::Sequence
< sal_Int8
>();
174 virtual css::util::Date SAL_CALL
175 getDate( sal_Int32 columnIndex
) override
177 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
178 return m_aItems
[m_nRow
]->getDate( columnIndex
);
180 return css::util::Date();
183 virtual css::util::Time SAL_CALL
184 getTime( sal_Int32 columnIndex
) override
186 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
187 return m_aItems
[m_nRow
]->getTime( columnIndex
);
189 return css::util::Time();
192 virtual css::util::DateTime SAL_CALL
193 getTimestamp( sal_Int32 columnIndex
) override
195 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
196 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
198 return css::util::DateTime();
201 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
202 getBinaryStream( sal_Int32 columnIndex
) override
204 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
205 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
207 return css::uno::Reference
< css::io::XInputStream
>();
210 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
211 getCharacterStream( sal_Int32 columnIndex
) override
213 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
214 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
216 return css::uno::Reference
< css::io::XInputStream
>();
219 virtual css::uno::Any SAL_CALL
220 getObject( sal_Int32 columnIndex
,
221 const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
223 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
224 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
226 return css::uno::Any();
229 virtual css::uno::Reference
< css::sdbc::XRef
> SAL_CALL
230 getRef( sal_Int32 columnIndex
) override
232 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
233 return m_aItems
[m_nRow
]->getRef( columnIndex
);
235 return css::uno::Reference
< css::sdbc::XRef
>();
238 virtual css::uno::Reference
< css::sdbc::XBlob
> SAL_CALL
239 getBlob( sal_Int32 columnIndex
) override
241 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
242 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
244 return css::uno::Reference
< css::sdbc::XBlob
>();
247 virtual css::uno::Reference
< css::sdbc::XClob
> SAL_CALL
248 getClob( sal_Int32 columnIndex
) override
250 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
251 return m_aItems
[m_nRow
]->getClob( columnIndex
);
253 return css::uno::Reference
< css::sdbc::XClob
>();
256 virtual css::uno::Reference
< css::sdbc::XArray
> SAL_CALL
257 getArray( sal_Int32 columnIndex
) override
259 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
260 return m_aItems
[m_nRow
]->getArray( columnIndex
);
262 return css::uno::Reference
< css::sdbc::XArray
>();
268 virtual sal_Bool SAL_CALL
271 virtual sal_Bool SAL_CALL
272 isBeforeFirst() override
;
274 virtual sal_Bool SAL_CALL
275 isAfterLast() override
;
277 virtual sal_Bool SAL_CALL
280 virtual sal_Bool SAL_CALL
283 virtual void SAL_CALL
284 beforeFirst() override
;
286 virtual void SAL_CALL
287 afterLast() override
;
289 virtual sal_Bool SAL_CALL
292 virtual sal_Bool SAL_CALL
295 virtual sal_Int32 SAL_CALL
298 virtual sal_Bool SAL_CALL
299 absolute( sal_Int32 row
) override
;
301 virtual sal_Bool SAL_CALL
302 relative( sal_Int32 rows
) override
;
304 virtual sal_Bool SAL_CALL
307 virtual void SAL_CALL
308 refreshRow() override
;
310 virtual sal_Bool SAL_CALL
311 rowUpdated() override
;
313 virtual sal_Bool SAL_CALL
314 rowInserted() override
;
316 virtual sal_Bool SAL_CALL
317 rowDeleted() override
;
320 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
321 getStatement() override
;
325 virtual void SAL_CALL
330 virtual OUString SAL_CALL
331 queryContentIdentifierString() override
;
333 virtual css::uno::Reference
< css::ucb::XContentIdentifier
> SAL_CALL
334 queryContentIdentifier() override
;
336 virtual css::uno::Reference
< css::ucb::XContent
> SAL_CALL
337 queryContent() override
;
339 // XResultSetMetaDataSupplier
340 virtual css::uno::Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
341 getMetaData() override
;
345 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
346 getPropertySetInfo() override
;
348 virtual void SAL_CALL
setPropertyValue(
349 const OUString
& aPropertyName
,
350 const css::uno::Any
& aValue
) override
;
352 virtual css::uno::Any SAL_CALL
354 const OUString
& PropertyName
) override
;
356 virtual void SAL_CALL
357 addPropertyChangeListener(
358 const OUString
& aPropertyName
,
359 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
361 virtual void SAL_CALL
362 removePropertyChangeListener(
363 const OUString
& aPropertyName
,
364 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
366 virtual void SAL_CALL
367 addVetoableChangeListener(
368 const OUString
& PropertyName
,
369 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
371 virtual void SAL_CALL
removeVetoableChangeListener(
372 const OUString
& PropertyName
,
373 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
377 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
378 css::uno::Reference
< css::ucb::XContentProvider
> m_xProvider
;
382 typedef std::vector
< css::uno::Reference
< css::ucb::XContentIdentifier
> > IdentSet
;
383 typedef std::vector
< css::uno::Reference
< css::sdbc::XRow
> > ItemSet
;
387 std::vector
<OUString
> m_aPath
;
389 css::uno::Sequence
< css::beans::Property
> m_sProperty
;
392 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pDisposeEventListeners
;
394 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pRowCountListeners
;
395 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pIsFinalListeners
;
399 } // end namespace fileaccess
404 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */