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 .
22 #include <cppuhelper/weak.hxx>
23 #include <comphelper/interfacecontainer2.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/ucb/XContentAccess.hpp>
26 #include <com/sun/star/sdbc/XCloseable.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/sdbc/XResultSet.hpp>
29 #include <com/sun/star/sdbc/XRow.hpp>
30 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
31 #include <com/sun/star/ucb/XContentProvider.hpp>
32 #include <com/sun/star/ucb/XContentIdentifier.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/beans/Property.hpp>
40 : public cppu::OWeakObject
,
41 public css::lang::XComponent
,
42 public css::sdbc::XRow
,
43 public css::sdbc::XResultSet
,
44 public css::sdbc::XCloseable
,
45 public css::sdbc::XResultSetMetaDataSupplier
,
46 public css::beans::XPropertySet
,
47 public css::ucb::XContentAccess
51 ResultSetBase(const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
52 const css::uno::Reference
< css::ucb::XContentProvider
>& xProvider
,
53 const css::uno::Sequence
< css::beans::Property
>& seq
);
55 virtual ~ResultSetBase() override
;
58 virtual css::uno::Any SAL_CALL
59 queryInterface( const css::uno::Type
& aType
) override
;
75 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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
86 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
92 virtual OUString SAL_CALL
93 getString( sal_Int32 columnIndex
) override
96 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
97 ret
= m_aItems
[m_nRow
]->getString( columnIndex
);
102 virtual sal_Bool SAL_CALL
103 getBoolean( sal_Int32 columnIndex
) override
105 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(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
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
196 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
198 return css::util::DateTime();
202 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
203 getBinaryStream( sal_Int32 columnIndex
) override
205 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
206 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
208 return css::uno::Reference
< css::io::XInputStream
>();
211 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
212 getCharacterStream( sal_Int32 columnIndex
) override
214 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
215 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
217 return css::uno::Reference
< css::io::XInputStream
>();
220 virtual css::uno::Any SAL_CALL
221 getObject( sal_Int32 columnIndex
,
222 const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
224 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
225 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
227 return css::uno::Any();
230 virtual css::uno::Reference
< css::sdbc::XRef
> SAL_CALL
231 getRef( sal_Int32 columnIndex
) override
233 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
234 return m_aItems
[m_nRow
]->getRef( columnIndex
);
236 return css::uno::Reference
< css::sdbc::XRef
>();
239 virtual css::uno::Reference
< css::sdbc::XBlob
> SAL_CALL
240 getBlob( sal_Int32 columnIndex
) override
242 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
243 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
245 return css::uno::Reference
< css::sdbc::XBlob
>();
248 virtual css::uno::Reference
< css::sdbc::XClob
> SAL_CALL
249 getClob( sal_Int32 columnIndex
) override
251 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
252 return m_aItems
[m_nRow
]->getClob( columnIndex
);
254 return css::uno::Reference
< css::sdbc::XClob
>();
257 virtual css::uno::Reference
< css::sdbc::XArray
> SAL_CALL
258 getArray( sal_Int32 columnIndex
) override
260 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
261 return m_aItems
[m_nRow
]->getArray( columnIndex
);
263 return css::uno::Reference
<
264 css::sdbc::XArray
>();
270 virtual sal_Bool SAL_CALL
273 virtual sal_Bool SAL_CALL
274 isBeforeFirst() override
;
276 virtual sal_Bool SAL_CALL
277 isAfterLast() override
;
279 virtual sal_Bool SAL_CALL
282 virtual sal_Bool SAL_CALL
285 virtual void SAL_CALL
286 beforeFirst() override
;
288 virtual void SAL_CALL
289 afterLast() override
;
291 virtual sal_Bool SAL_CALL
294 virtual sal_Bool SAL_CALL
297 virtual sal_Int32 SAL_CALL
300 virtual sal_Bool SAL_CALL
302 sal_Int32 row
) override
;
304 virtual sal_Bool SAL_CALL
306 sal_Int32 rows
) override
;
308 virtual sal_Bool SAL_CALL
311 virtual void SAL_CALL
312 refreshRow() override
;
314 virtual sal_Bool SAL_CALL
315 rowUpdated() override
;
317 virtual sal_Bool SAL_CALL
318 rowInserted() override
;
320 virtual sal_Bool SAL_CALL
321 rowDeleted() override
;
324 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
325 getStatement() override
;
329 virtual void SAL_CALL
334 virtual OUString SAL_CALL
335 queryContentIdentifierString() override
;
337 virtual css::uno::Reference
< css::ucb::XContentIdentifier
> SAL_CALL
338 queryContentIdentifier() override
;
340 virtual css::uno::Reference
< css::ucb::XContent
> SAL_CALL
341 queryContent() override
;
343 // XResultSetMetaDataSupplier
344 virtual css::uno::Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
345 getMetaData() override
;
349 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
350 getPropertySetInfo() override
;
352 virtual void SAL_CALL
setPropertyValue(
353 const OUString
& aPropertyName
,
354 const css::uno::Any
& aValue
) override
;
356 virtual css::uno::Any SAL_CALL
358 const OUString
& PropertyName
) override
;
360 virtual void SAL_CALL
361 addPropertyChangeListener(
362 const OUString
& aPropertyName
,
363 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
365 virtual void SAL_CALL
366 removePropertyChangeListener(
367 const OUString
& aPropertyName
,
368 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
370 virtual void SAL_CALL
371 addVetoableChangeListener(
372 const OUString
& PropertyName
,
373 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
375 virtual void SAL_CALL
removeVetoableChangeListener(
376 const OUString
& PropertyName
,
377 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
381 css::uno::Reference
< css::uno::XComponentContext
>
383 css::uno::Reference
< css::ucb::XContentProvider
>
388 typedef std::vector
< css::uno::Reference
<css::ucb::XContentIdentifier
> >
390 typedef std::vector
< css::uno::Reference
< css::sdbc::XRow
> >
395 std::vector
<OUString
> m_aPath
;
397 css::uno::Sequence
< css::beans::Property
>
401 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pDisposeEventListeners
;
402 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pRowCountListeners
;
403 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pIsFinalListeners
;
407 } // end namespace fileaccess
410 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */