Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / ftp / ftpresultsetbase.hxx
blob91e7be6ffe6d7cd7ee9db381ee795713669a8195
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _FTP_FTPRESULTSETBASE_HXX_
29 #define _FTP_FTPRESULTSETBASE_HXX_
31 #include <vector>
32 #include <cppuhelper/weak.hxx>
33 #include <cppuhelper/interfacecontainer.hxx>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/ucb/XContentAccess.hpp>
36 #include <com/sun/star/sdbc/XCloseable.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/sdbc/XResultSet.hpp>
39 #include <com/sun/star/sdbc/XRow.hpp>
40 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
41 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
42 #include <com/sun/star/ucb/XContentProvider.hpp>
43 #include <com/sun/star/ucb/XContentIdentifier.hpp>
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #include <com/sun/star/beans/Property.hpp>
48 namespace ftp {
50 class ResultSetBase
51 : public cppu::OWeakObject,
52 public com::sun::star::lang::XComponent,
53 public com::sun::star::sdbc::XRow,
54 public com::sun::star::sdbc::XResultSet,
55 public com::sun::star::sdbc::XCloseable,
56 public com::sun::star::sdbc::XResultSetMetaDataSupplier,
57 public com::sun::star::beans::XPropertySet,
58 public com::sun::star::ucb::XContentAccess
60 public:
62 ResultSetBase(const com::sun::star::uno::Reference<
63 com::sun::star::lang::XMultiServiceFactory >& xMSF,
64 const com::sun::star::uno::Reference<
65 com::sun::star::ucb::XContentProvider >& xProvider,
66 sal_Int32 nOpenMode,
67 const com::sun::star::uno::Sequence<
68 com::sun::star::beans::Property >& seq,
69 const com::sun::star::uno::Sequence<
70 com::sun::star::ucb::NumberedSortingInfo >& seqSort);
72 virtual ~ResultSetBase();
74 // XInterface
75 virtual com::sun::star::uno::Any SAL_CALL
76 queryInterface(
77 const com::sun::star::uno::Type& aType )
78 throw( com::sun::star::uno::RuntimeException);
80 virtual void SAL_CALL
81 acquire(
82 void )
83 throw();
85 virtual void SAL_CALL
86 release(
87 void )
88 throw();
90 // XComponent
91 virtual void SAL_CALL
92 dispose(
93 void )
94 throw( com::sun::star::uno::RuntimeException );
96 virtual void SAL_CALL
97 addEventListener(
98 const com::sun::star::uno::Reference<
99 com::sun::star::lang::XEventListener >& xListener )
100 throw( com::sun::star::uno::RuntimeException );
102 virtual void SAL_CALL
103 removeEventListener( const com::sun::star::uno::Reference<
104 com::sun::star::lang::XEventListener >& aListener )
105 throw( com::sun::star::uno::RuntimeException );
108 // XRow
109 virtual sal_Bool SAL_CALL
110 wasNull(
111 void )
112 throw( com::sun::star::sdbc::SQLException,
113 com::sun::star::uno::RuntimeException )
115 if( 0<= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
116 m_nWasNull = m_aItems[m_nRow]->wasNull();
117 else
118 m_nWasNull = true;
119 return m_nWasNull;
122 virtual rtl::OUString SAL_CALL
123 getString(
124 sal_Int32 columnIndex )
125 throw( com::sun::star::sdbc::SQLException,
126 com::sun::star::uno::RuntimeException)
128 rtl::OUString ret;
129 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
130 ret = m_aItems[m_nRow]->getString( columnIndex );
132 return ret;
135 virtual sal_Bool SAL_CALL
136 getBoolean(
137 sal_Int32 columnIndex )
138 throw( com::sun::star::sdbc::SQLException,
139 com::sun::star::uno::RuntimeException)
141 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
142 return m_aItems[m_nRow]->getBoolean( columnIndex );
143 else
144 return false;
147 virtual sal_Int8 SAL_CALL
148 getByte(
149 sal_Int32 columnIndex )
150 throw( com::sun::star::sdbc::SQLException,
151 com::sun::star::uno::RuntimeException)
153 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
154 return m_aItems[m_nRow]->getByte( columnIndex );
155 else
156 return sal_Int8( 0 );
159 virtual sal_Int16 SAL_CALL
160 getShort(
161 sal_Int32 columnIndex )
162 throw(
163 com::sun::star::sdbc::SQLException,
164 com::sun::star::uno::RuntimeException)
166 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
167 return m_aItems[m_nRow]->getShort( columnIndex );
168 else
169 return sal_Int16( 0 );
172 virtual sal_Int32 SAL_CALL
173 getInt(
174 sal_Int32 columnIndex )
175 throw( com::sun::star::sdbc::SQLException,
176 com::sun::star::uno::RuntimeException )
178 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
179 return m_aItems[m_nRow]->getInt( columnIndex );
180 else
181 return sal_Int32( 0 );
184 virtual sal_Int64 SAL_CALL
185 getLong(
186 sal_Int32 columnIndex )
187 throw( com::sun::star::sdbc::SQLException,
188 com::sun::star::uno::RuntimeException)
190 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
191 return m_aItems[m_nRow]->getLong( columnIndex );
192 else
193 return sal_Int64( 0 );
196 virtual float SAL_CALL
197 getFloat(
198 sal_Int32 columnIndex )
199 throw( com::sun::star::sdbc::SQLException,
200 com::sun::star::uno::RuntimeException )
202 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
203 return m_aItems[m_nRow]->getFloat( columnIndex );
204 else
205 return float( 0 );
208 virtual double SAL_CALL
209 getDouble(
210 sal_Int32 columnIndex )
211 throw( com::sun::star::sdbc::SQLException,
212 com::sun::star::uno::RuntimeException )
214 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
215 return m_aItems[m_nRow]->getDouble( columnIndex );
216 else
217 return double( 0 );
220 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
221 getBytes(
222 sal_Int32 columnIndex )
223 throw( com::sun::star::sdbc::SQLException,
224 com::sun::star::uno::RuntimeException )
226 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
227 return m_aItems[m_nRow]->getBytes( columnIndex );
228 else
229 return com::sun::star::uno::Sequence< sal_Int8 >();
232 virtual com::sun::star::util::Date SAL_CALL
233 getDate(
234 sal_Int32 columnIndex )
235 throw( com::sun::star::sdbc::SQLException,
236 com::sun::star::uno::RuntimeException)
238 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
239 return m_aItems[m_nRow]->getDate( columnIndex );
240 else
241 return com::sun::star::util::Date();
244 virtual com::sun::star::util::Time SAL_CALL
245 getTime(
246 sal_Int32 columnIndex )
247 throw( com::sun::star::sdbc::SQLException,
248 com::sun::star::uno::RuntimeException)
250 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
251 return m_aItems[m_nRow]->getTime( columnIndex );
252 else
253 return com::sun::star::util::Time();
256 virtual com::sun::star::util::DateTime SAL_CALL
257 getTimestamp(
258 sal_Int32 columnIndex )
259 throw( com::sun::star::sdbc::SQLException,
260 com::sun::star::uno::RuntimeException)
262 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
263 return m_aItems[m_nRow]->getTimestamp( columnIndex );
264 else
265 return com::sun::star::util::DateTime();
269 virtual com::sun::star::uno::Reference<
270 com::sun::star::io::XInputStream > SAL_CALL
271 getBinaryStream(
272 sal_Int32 columnIndex )
273 throw( com::sun::star::sdbc::SQLException,
274 com::sun::star::uno::RuntimeException)
276 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
277 return m_aItems[m_nRow]->getBinaryStream( columnIndex );
278 else
279 return com::sun::star::uno::Reference<
280 com::sun::star::io::XInputStream >();
283 virtual com::sun::star::uno::Reference<
284 com::sun::star::io::XInputStream > SAL_CALL
285 getCharacterStream(
286 sal_Int32 columnIndex )
287 throw( com::sun::star::sdbc::SQLException,
288 com::sun::star::uno::RuntimeException)
290 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
291 return m_aItems[m_nRow]->getCharacterStream( columnIndex );
292 else
293 return com::sun::star::uno::Reference<
294 com::sun::star::io::XInputStream >();
297 virtual com::sun::star::uno::Any SAL_CALL
298 getObject(
299 sal_Int32 columnIndex,
300 const com::sun::star::uno::Reference<
301 com::sun::star::container::XNameAccess >& typeMap )
302 throw( com::sun::star::sdbc::SQLException,
303 com::sun::star::uno::RuntimeException)
305 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
306 return m_aItems[m_nRow]->getObject( columnIndex,typeMap );
307 else
308 return com::sun::star::uno::Any();
311 virtual com::sun::star::uno::Reference<
312 com::sun::star::sdbc::XRef > SAL_CALL
313 getRef(
314 sal_Int32 columnIndex )
315 throw( com::sun::star::sdbc::SQLException,
316 com::sun::star::uno::RuntimeException)
318 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
319 return m_aItems[m_nRow]->getRef( columnIndex );
320 else
321 return com::sun::star::uno::Reference< com::sun::star::sdbc::XRef >();
324 virtual com::sun::star::uno::Reference<
325 com::sun::star::sdbc::XBlob > SAL_CALL
326 getBlob(
327 sal_Int32 columnIndex )
328 throw( com::sun::star::sdbc::SQLException,
329 com::sun::star::uno::RuntimeException)
331 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
332 return m_aItems[m_nRow]->getBlob( columnIndex );
333 else
334 return com::sun::star::uno::Reference< com::sun::star::sdbc::XBlob >();
337 virtual com::sun::star::uno::Reference<
338 com::sun::star::sdbc::XClob > SAL_CALL
339 getClob(
340 sal_Int32 columnIndex )
341 throw( com::sun::star::sdbc::SQLException,
342 com::sun::star::uno::RuntimeException)
344 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
345 return m_aItems[m_nRow]->getClob( columnIndex );
346 else
347 return com::sun::star::uno::Reference<
348 com::sun::star::sdbc::XClob >();
351 virtual com::sun::star::uno::Reference<
352 com::sun::star::sdbc::XArray > SAL_CALL
353 getArray(
354 sal_Int32 columnIndex )
355 throw( com::sun::star::sdbc::SQLException,
356 com::sun::star::uno::RuntimeException)
358 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
359 return m_aItems[m_nRow]->getArray( columnIndex );
360 else
361 return com::sun::star::uno::Reference<
362 com::sun::star::sdbc::XArray >();
366 // XResultSet
368 virtual sal_Bool SAL_CALL
369 next(
370 void )
371 throw( com::sun::star::sdbc::SQLException,
372 com::sun::star::uno::RuntimeException);
374 virtual sal_Bool SAL_CALL
375 isBeforeFirst(
376 void )
377 throw( com::sun::star::sdbc::SQLException,
378 com::sun::star::uno::RuntimeException);
380 virtual sal_Bool SAL_CALL
381 isAfterLast(
382 void )
383 throw( com::sun::star::sdbc::SQLException,
384 com::sun::star::uno::RuntimeException);
386 virtual sal_Bool SAL_CALL
387 isFirst(
388 void )
389 throw( com::sun::star::sdbc::SQLException,
390 com::sun::star::uno::RuntimeException);
392 virtual sal_Bool SAL_CALL
393 isLast(
394 void )
395 throw( com::sun::star::sdbc::SQLException,
396 com::sun::star::uno::RuntimeException);
398 virtual void SAL_CALL
399 beforeFirst(
400 void )
401 throw( com::sun::star::sdbc::SQLException,
402 com::sun::star::uno::RuntimeException);
404 virtual void SAL_CALL
405 afterLast(
406 void )
407 throw( com::sun::star::sdbc::SQLException,
408 com::sun::star::uno::RuntimeException);
410 virtual sal_Bool SAL_CALL
411 first(
412 void )
413 throw( com::sun::star::sdbc::SQLException,
414 com::sun::star::uno::RuntimeException);
416 virtual sal_Bool SAL_CALL
417 last(
418 void )
419 throw( com::sun::star::sdbc::SQLException,
420 com::sun::star::uno::RuntimeException);
422 virtual sal_Int32 SAL_CALL
423 getRow(
424 void )
425 throw( com::sun::star::sdbc::SQLException,
426 com::sun::star::uno::RuntimeException);
428 virtual sal_Bool SAL_CALL
429 absolute(
430 sal_Int32 row )
431 throw( com::sun::star::sdbc::SQLException,
432 com::sun::star::uno::RuntimeException);
434 virtual sal_Bool SAL_CALL
435 relative(
436 sal_Int32 rows )
437 throw( com::sun::star::sdbc::SQLException,
438 com::sun::star::uno::RuntimeException);
440 virtual sal_Bool SAL_CALL
441 previous(
442 void )
443 throw( com::sun::star::sdbc::SQLException,
444 com::sun::star::uno::RuntimeException);
446 virtual void SAL_CALL
447 refreshRow(
448 void )
449 throw( com::sun::star::sdbc::SQLException,
450 com::sun::star::uno::RuntimeException);
452 virtual sal_Bool SAL_CALL
453 rowUpdated(
454 void )
455 throw( com::sun::star::sdbc::SQLException,
456 com::sun::star::uno::RuntimeException);
458 virtual sal_Bool SAL_CALL
459 rowInserted(
460 void )
461 throw( com::sun::star::sdbc::SQLException,
462 com::sun::star::uno::RuntimeException);
464 virtual sal_Bool SAL_CALL
465 rowDeleted(
466 void )
467 throw( com::sun::star::sdbc::SQLException,
468 com::sun::star::uno::RuntimeException);
471 virtual com::sun::star::uno::Reference<
472 com::sun::star::uno::XInterface > SAL_CALL
473 getStatement(
474 void )
475 throw( com::sun::star::sdbc::SQLException,
476 com::sun::star::uno::RuntimeException);
478 // XCloseable
480 virtual void SAL_CALL
481 close(
482 void )
483 throw( com::sun::star::sdbc::SQLException,
484 com::sun::star::uno::RuntimeException);
486 // XContentAccess
488 virtual rtl::OUString SAL_CALL
489 queryContentIdentifierString(
490 void )
491 throw( com::sun::star::uno::RuntimeException );
493 virtual com::sun::star::uno::Reference<
494 com::sun::star::ucb::XContentIdentifier > SAL_CALL
495 queryContentIdentifier(
496 void )
497 throw( com::sun::star::uno::RuntimeException );
499 virtual com::sun::star::uno::Reference<
500 com::sun::star::ucb::XContent > SAL_CALL
501 queryContent(
502 void )
503 throw( com::sun::star::uno::RuntimeException );
505 // XResultSetMetaDataSupplier
506 virtual com::sun::star::uno::Reference<
507 com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
508 getMetaData(
509 void )
510 throw( com::sun::star::sdbc::SQLException,
511 com::sun::star::uno::RuntimeException);
514 // XPropertySet
515 virtual com::sun::star::uno::Reference<
516 com::sun::star::beans::XPropertySetInfo > SAL_CALL
517 getPropertySetInfo()
518 throw( com::sun::star::uno::RuntimeException);
520 virtual void SAL_CALL setPropertyValue(
521 const rtl::OUString& aPropertyName,
522 const com::sun::star::uno::Any& aValue )
523 throw( com::sun::star::beans::UnknownPropertyException,
524 com::sun::star::beans::PropertyVetoException,
525 com::sun::star::lang::IllegalArgumentException,
526 com::sun::star::lang::WrappedTargetException,
527 com::sun::star::uno::RuntimeException);
529 virtual com::sun::star::uno::Any SAL_CALL
530 getPropertyValue(
531 const rtl::OUString& PropertyName )
532 throw( com::sun::star::beans::UnknownPropertyException,
533 com::sun::star::lang::WrappedTargetException,
534 com::sun::star::uno::RuntimeException);
536 virtual void SAL_CALL
537 addPropertyChangeListener(
538 const rtl::OUString& aPropertyName,
539 const com::sun::star::uno::Reference<
540 com::sun::star::beans::XPropertyChangeListener >& xListener )
541 throw( com::sun::star::beans::UnknownPropertyException,
542 com::sun::star::lang::WrappedTargetException,
543 com::sun::star::uno::RuntimeException);
545 virtual void SAL_CALL
546 removePropertyChangeListener(
547 const rtl::OUString& aPropertyName,
548 const com::sun::star::uno::Reference<
549 com::sun::star::beans::XPropertyChangeListener >& aListener )
550 throw( com::sun::star::beans::UnknownPropertyException,
551 com::sun::star::lang::WrappedTargetException,
552 com::sun::star::uno::RuntimeException);
554 virtual void SAL_CALL
555 addVetoableChangeListener(
556 const rtl::OUString& PropertyName,
557 const com::sun::star::uno::Reference<
558 com::sun::star::beans::XVetoableChangeListener >& aListener )
559 throw( com::sun::star::beans::UnknownPropertyException,
560 com::sun::star::lang::WrappedTargetException,
561 com::sun::star::uno::RuntimeException);
563 virtual void SAL_CALL removeVetoableChangeListener(
564 const rtl::OUString& PropertyName,
565 const com::sun::star::uno::Reference<
566 com::sun::star::beans::XVetoableChangeListener >& aListener )
567 throw( com::sun::star::beans::UnknownPropertyException,
568 com::sun::star::lang::WrappedTargetException,
569 com::sun::star::uno::RuntimeException);
571 protected:
573 com::sun::star::uno::Reference<
574 com::sun::star::lang::XMultiServiceFactory > m_xMSF;
575 com::sun::star::uno::Reference<
576 com::sun::star::ucb::XContentProvider > m_xProvider;
577 sal_Int32 m_nRow;
578 sal_Bool m_nWasNull;
579 sal_Int32 m_nOpenMode;
580 sal_Bool m_bRowCountFinal;
582 typedef std::vector< com::sun::star::uno::Reference<
583 com::sun::star::ucb::XContentIdentifier > > IdentSet;
584 typedef std::vector< com::sun::star::uno::Reference<
585 com::sun::star::sdbc::XRow > > ItemSet;
586 typedef std::vector< rtl::OUString >
587 PathSet;
589 IdentSet m_aIdents;
590 ItemSet m_aItems;
591 PathSet m_aPath;
593 com::sun::star::uno::Sequence<
594 com::sun::star::beans::Property > m_sProperty;
595 com::sun::star::uno::Sequence<
596 com::sun::star::ucb::NumberedSortingInfo > m_sSortingInfo;
598 osl::Mutex m_aMutex;
599 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
601 cppu::OInterfaceContainerHelper* m_pRowCountListeners;
602 cppu::OInterfaceContainerHelper* m_pIsFinalListeners;
606 } // end namespace fileaccess
609 #endif
611 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */