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 .
23 #include <cppuhelper/weak.hxx>
24 #include <comphelper/interfacecontainer4.hxx>
25 #include <com/sun/star/lang/XComponent.hpp>
26 #include <com/sun/star/ucb/XContentAccess.hpp>
27 #include <com/sun/star/sdbc/XCloseable.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/sdbc/XResultSet.hpp>
30 #include <com/sun/star/sdbc/XRow.hpp>
31 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
32 #include <com/sun/star/ucb/XContentProvider.hpp>
33 #include <com/sun/star/ucb/XContentIdentifier.hpp>
34 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <com/sun/star/beans/Property.hpp>
41 : public cppu::OWeakObject
,
42 public css::lang::XComponent
,
43 public css::sdbc::XRow
,
44 public css::sdbc::XResultSet
,
45 public css::sdbc::XCloseable
,
46 public css::sdbc::XResultSetMetaDataSupplier
,
47 public css::beans::XPropertySet
,
48 public css::ucb::XContentAccess
52 ResultSetBase( css::uno::Reference
< css::uno::XComponentContext
> xContext
,
53 css::uno::Reference
< css::ucb::XContentProvider
> xProvider
,
54 const css::uno::Sequence
< css::beans::Property
>& seq
);
56 virtual ~ResultSetBase() override
;
59 virtual css::uno::Any SAL_CALL
60 queryInterface( const css::uno::Type
& aType
) override
;
75 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
78 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
82 virtual sal_Bool SAL_CALL
85 if( 0<= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
86 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
92 virtual OUString SAL_CALL
93 getString( sal_Int32 columnIndex
) override
95 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
96 return m_aItems
[m_nRow
]->getString( columnIndex
);
101 virtual sal_Bool SAL_CALL
102 getBoolean( sal_Int32 columnIndex
) override
104 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
105 return m_aItems
[m_nRow
]->getBoolean( columnIndex
);
110 virtual sal_Int8 SAL_CALL
111 getByte( sal_Int32 columnIndex
) override
113 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
114 return m_aItems
[m_nRow
]->getByte( columnIndex
);
116 return sal_Int8( 0 );
119 virtual sal_Int16 SAL_CALL
120 getShort( sal_Int32 columnIndex
) override
122 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
123 return m_aItems
[m_nRow
]->getShort( columnIndex
);
125 return sal_Int16( 0 );
128 virtual sal_Int32 SAL_CALL
129 getInt( sal_Int32 columnIndex
) override
131 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
132 return m_aItems
[m_nRow
]->getInt( columnIndex
);
137 virtual sal_Int64 SAL_CALL
138 getLong( sal_Int32 columnIndex
) override
140 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
141 return m_aItems
[m_nRow
]->getLong( columnIndex
);
143 return sal_Int64( 0 );
146 virtual float SAL_CALL
147 getFloat( sal_Int32 columnIndex
) override
149 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
150 return m_aItems
[m_nRow
]->getFloat( columnIndex
);
155 virtual double SAL_CALL
156 getDouble( sal_Int32 columnIndex
) override
158 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
159 return m_aItems
[m_nRow
]->getDouble( columnIndex
);
164 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
165 getBytes( sal_Int32 columnIndex
) override
167 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
168 return m_aItems
[m_nRow
]->getBytes( columnIndex
);
170 return css::uno::Sequence
< sal_Int8
>();
173 virtual css::util::Date SAL_CALL
174 getDate( sal_Int32 columnIndex
) override
176 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
177 return m_aItems
[m_nRow
]->getDate( columnIndex
);
179 return css::util::Date();
182 virtual css::util::Time SAL_CALL
183 getTime( sal_Int32 columnIndex
) override
185 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
186 return m_aItems
[m_nRow
]->getTime( columnIndex
);
188 return css::util::Time();
191 virtual css::util::DateTime SAL_CALL
192 getTimestamp( sal_Int32 columnIndex
) override
194 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
195 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
197 return css::util::DateTime();
200 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
201 getBinaryStream( sal_Int32 columnIndex
) override
203 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
204 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
206 return css::uno::Reference
< css::io::XInputStream
>();
209 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
210 getCharacterStream( sal_Int32 columnIndex
) override
212 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
213 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
215 return css::uno::Reference
< css::io::XInputStream
>();
218 virtual css::uno::Any SAL_CALL
219 getObject( sal_Int32 columnIndex
,
220 const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
222 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
223 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
225 return css::uno::Any();
228 virtual css::uno::Reference
< css::sdbc::XRef
> SAL_CALL
229 getRef( sal_Int32 columnIndex
) override
231 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
232 return m_aItems
[m_nRow
]->getRef( columnIndex
);
234 return css::uno::Reference
< css::sdbc::XRef
>();
237 virtual css::uno::Reference
< css::sdbc::XBlob
> SAL_CALL
238 getBlob( sal_Int32 columnIndex
) override
240 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
241 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
243 return css::uno::Reference
< css::sdbc::XBlob
>();
246 virtual css::uno::Reference
< css::sdbc::XClob
> SAL_CALL
247 getClob( sal_Int32 columnIndex
) override
249 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
250 return m_aItems
[m_nRow
]->getClob( columnIndex
);
252 return css::uno::Reference
< css::sdbc::XClob
>();
255 virtual css::uno::Reference
< css::sdbc::XArray
> SAL_CALL
256 getArray( sal_Int32 columnIndex
) override
258 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
259 return m_aItems
[m_nRow
]->getArray( columnIndex
);
261 return css::uno::Reference
< css::sdbc::XArray
>();
267 virtual sal_Bool SAL_CALL
270 virtual sal_Bool SAL_CALL
271 isBeforeFirst() override
;
273 virtual sal_Bool SAL_CALL
274 isAfterLast() override
;
276 virtual sal_Bool SAL_CALL
279 virtual sal_Bool SAL_CALL
282 virtual void SAL_CALL
283 beforeFirst() override
;
285 virtual void SAL_CALL
286 afterLast() override
;
288 virtual sal_Bool SAL_CALL
291 virtual sal_Bool SAL_CALL
294 virtual sal_Int32 SAL_CALL
297 virtual sal_Bool SAL_CALL
298 absolute( sal_Int32 row
) override
;
300 virtual sal_Bool SAL_CALL
301 relative( sal_Int32 rows
) override
;
303 virtual sal_Bool SAL_CALL
306 virtual void SAL_CALL
307 refreshRow() override
;
309 virtual sal_Bool SAL_CALL
310 rowUpdated() override
;
312 virtual sal_Bool SAL_CALL
313 rowInserted() override
;
315 virtual sal_Bool SAL_CALL
316 rowDeleted() override
;
319 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
320 getStatement() override
;
324 virtual void SAL_CALL
329 virtual OUString SAL_CALL
330 queryContentIdentifierString() override
;
332 virtual css::uno::Reference
< css::ucb::XContentIdentifier
> SAL_CALL
333 queryContentIdentifier() override
;
335 virtual css::uno::Reference
< css::ucb::XContent
> SAL_CALL
336 queryContent() override
;
338 // XResultSetMetaDataSupplier
339 virtual css::uno::Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
340 getMetaData() override
;
344 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
345 getPropertySetInfo() override
;
347 virtual void SAL_CALL
setPropertyValue(
348 const OUString
& aPropertyName
,
349 const css::uno::Any
& aValue
) override
;
351 virtual css::uno::Any SAL_CALL
353 const OUString
& PropertyName
) override
;
355 virtual void SAL_CALL
356 addPropertyChangeListener(
357 const OUString
& aPropertyName
,
358 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
360 virtual void SAL_CALL
361 removePropertyChangeListener(
362 const OUString
& aPropertyName
,
363 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
365 virtual void SAL_CALL
366 addVetoableChangeListener(
367 const OUString
& PropertyName
,
368 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
370 virtual void SAL_CALL
removeVetoableChangeListener(
371 const OUString
& PropertyName
,
372 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
376 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
377 css::uno::Reference
< css::ucb::XContentProvider
> m_xProvider
;
381 typedef std::vector
< css::uno::Reference
< css::ucb::XContentIdentifier
> > IdentSet
;
382 typedef std::vector
< css::uno::Reference
< css::sdbc::XRow
> > ItemSet
;
386 std::vector
<OUString
> m_aPath
;
388 css::uno::Sequence
< css::beans::Property
> m_sProperty
;
391 comphelper::OInterfaceContainerHelper4
<css::lang::XEventListener
> m_aDisposeEventListeners
;
392 comphelper::OInterfaceContainerHelper4
<css::beans::XPropertyChangeListener
> m_aRowCountListeners
;
393 comphelper::OInterfaceContainerHelper4
<css::beans::XPropertyChangeListener
> m_aIsFinalListeners
;
397 } // end namespace fileaccess
400 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */