Update ooo320-m1
[ooovba.git] / ucb / source / ucp / ftp / ftpresultsetbase.hxx
blob90d001743f220fb55d6b808a1244db9cdcf85231
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ftpresultsetbase.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _FTP_FTPRESULTSETBASE_HXX_
31 #define _FTP_FTPRESULTSETBASE_HXX_
33 #include <vector>
34 #include <cppuhelper/weak.hxx>
35 #include <cppuhelper/interfacecontainer.hxx>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/ucb/XContentAccess.hpp>
38 #include <com/sun/star/sdbc/XCloseable.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/sdbc/XResultSet.hpp>
41 #include <com/sun/star/sdbc/XRow.hpp>
42 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
43 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
44 #include <com/sun/star/ucb/XContentProvider.hpp>
45 #include <com/sun/star/ucb/XContentIdentifier.hpp>
46 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 #include <com/sun/star/beans/Property.hpp>
50 namespace ftp {
52 class ResultSetBase
53 : public cppu::OWeakObject,
54 public com::sun::star::lang::XComponent,
55 public com::sun::star::sdbc::XRow,
56 public com::sun::star::sdbc::XResultSet,
57 public com::sun::star::sdbc::XCloseable,
58 public com::sun::star::sdbc::XResultSetMetaDataSupplier,
59 public com::sun::star::beans::XPropertySet,
60 public com::sun::star::ucb::XContentAccess
62 public:
64 ResultSetBase(const com::sun::star::uno::Reference<
65 com::sun::star::lang::XMultiServiceFactory >& xMSF,
66 const com::sun::star::uno::Reference<
67 com::sun::star::ucb::XContentProvider >& xProvider,
68 sal_Int32 nOpenMode,
69 const com::sun::star::uno::Sequence<
70 com::sun::star::beans::Property >& seq,
71 const com::sun::star::uno::Sequence<
72 com::sun::star::ucb::NumberedSortingInfo >& seqSort);
74 virtual ~ResultSetBase();
76 // XInterface
77 virtual com::sun::star::uno::Any SAL_CALL
78 queryInterface(
79 const com::sun::star::uno::Type& aType )
80 throw( com::sun::star::uno::RuntimeException);
82 virtual void SAL_CALL
83 acquire(
84 void )
85 throw();
87 virtual void SAL_CALL
88 release(
89 void )
90 throw();
92 // XComponent
93 virtual void SAL_CALL
94 dispose(
95 void )
96 throw( com::sun::star::uno::RuntimeException );
98 virtual void SAL_CALL
99 addEventListener(
100 const com::sun::star::uno::Reference<
101 com::sun::star::lang::XEventListener >& xListener )
102 throw( com::sun::star::uno::RuntimeException );
104 virtual void SAL_CALL
105 removeEventListener( const com::sun::star::uno::Reference<
106 com::sun::star::lang::XEventListener >& aListener )
107 throw( com::sun::star::uno::RuntimeException );
110 // XRow
111 virtual sal_Bool SAL_CALL
112 wasNull(
113 void )
114 throw( com::sun::star::sdbc::SQLException,
115 com::sun::star::uno::RuntimeException )
117 if( 0<= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
118 m_nWasNull = m_aItems[m_nRow]->wasNull();
119 else
120 m_nWasNull = true;
121 return m_nWasNull;
124 virtual rtl::OUString SAL_CALL
125 getString(
126 sal_Int32 columnIndex )
127 throw( com::sun::star::sdbc::SQLException,
128 com::sun::star::uno::RuntimeException)
130 rtl::OUString ret;
131 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
132 ret = m_aItems[m_nRow]->getString( columnIndex );
134 return ret;
137 virtual sal_Bool SAL_CALL
138 getBoolean(
139 sal_Int32 columnIndex )
140 throw( com::sun::star::sdbc::SQLException,
141 com::sun::star::uno::RuntimeException)
143 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
144 return m_aItems[m_nRow]->getBoolean( columnIndex );
145 else
146 return false;
149 virtual sal_Int8 SAL_CALL
150 getByte(
151 sal_Int32 columnIndex )
152 throw( com::sun::star::sdbc::SQLException,
153 com::sun::star::uno::RuntimeException)
155 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
156 return m_aItems[m_nRow]->getByte( columnIndex );
157 else
158 return sal_Int8( 0 );
161 virtual sal_Int16 SAL_CALL
162 getShort(
163 sal_Int32 columnIndex )
164 throw(
165 com::sun::star::sdbc::SQLException,
166 com::sun::star::uno::RuntimeException)
168 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
169 return m_aItems[m_nRow]->getShort( columnIndex );
170 else
171 return sal_Int16( 0 );
174 virtual sal_Int32 SAL_CALL
175 getInt(
176 sal_Int32 columnIndex )
177 throw( com::sun::star::sdbc::SQLException,
178 com::sun::star::uno::RuntimeException )
180 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
181 return m_aItems[m_nRow]->getInt( columnIndex );
182 else
183 return sal_Int32( 0 );
186 virtual sal_Int64 SAL_CALL
187 getLong(
188 sal_Int32 columnIndex )
189 throw( com::sun::star::sdbc::SQLException,
190 com::sun::star::uno::RuntimeException)
192 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
193 return m_aItems[m_nRow]->getLong( columnIndex );
194 else
195 return sal_Int64( 0 );
198 virtual float SAL_CALL
199 getFloat(
200 sal_Int32 columnIndex )
201 throw( com::sun::star::sdbc::SQLException,
202 com::sun::star::uno::RuntimeException )
204 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
205 return m_aItems[m_nRow]->getFloat( columnIndex );
206 else
207 return float( 0 );
210 virtual double SAL_CALL
211 getDouble(
212 sal_Int32 columnIndex )
213 throw( com::sun::star::sdbc::SQLException,
214 com::sun::star::uno::RuntimeException )
216 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
217 return m_aItems[m_nRow]->getDouble( columnIndex );
218 else
219 return double( 0 );
222 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
223 getBytes(
224 sal_Int32 columnIndex )
225 throw( com::sun::star::sdbc::SQLException,
226 com::sun::star::uno::RuntimeException )
228 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
229 return m_aItems[m_nRow]->getBytes( columnIndex );
230 else
231 return com::sun::star::uno::Sequence< sal_Int8 >();
234 virtual com::sun::star::util::Date SAL_CALL
235 getDate(
236 sal_Int32 columnIndex )
237 throw( com::sun::star::sdbc::SQLException,
238 com::sun::star::uno::RuntimeException)
240 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
241 return m_aItems[m_nRow]->getDate( columnIndex );
242 else
243 return com::sun::star::util::Date();
246 virtual com::sun::star::util::Time SAL_CALL
247 getTime(
248 sal_Int32 columnIndex )
249 throw( com::sun::star::sdbc::SQLException,
250 com::sun::star::uno::RuntimeException)
252 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
253 return m_aItems[m_nRow]->getTime( columnIndex );
254 else
255 return com::sun::star::util::Time();
258 virtual com::sun::star::util::DateTime SAL_CALL
259 getTimestamp(
260 sal_Int32 columnIndex )
261 throw( com::sun::star::sdbc::SQLException,
262 com::sun::star::uno::RuntimeException)
264 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
265 return m_aItems[m_nRow]->getTimestamp( columnIndex );
266 else
267 return com::sun::star::util::DateTime();
271 virtual com::sun::star::uno::Reference<
272 com::sun::star::io::XInputStream > SAL_CALL
273 getBinaryStream(
274 sal_Int32 columnIndex )
275 throw( com::sun::star::sdbc::SQLException,
276 com::sun::star::uno::RuntimeException)
278 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
279 return m_aItems[m_nRow]->getBinaryStream( columnIndex );
280 else
281 return com::sun::star::uno::Reference<
282 com::sun::star::io::XInputStream >();
285 virtual com::sun::star::uno::Reference<
286 com::sun::star::io::XInputStream > SAL_CALL
287 getCharacterStream(
288 sal_Int32 columnIndex )
289 throw( com::sun::star::sdbc::SQLException,
290 com::sun::star::uno::RuntimeException)
292 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
293 return m_aItems[m_nRow]->getCharacterStream( columnIndex );
294 else
295 return com::sun::star::uno::Reference<
296 com::sun::star::io::XInputStream >();
299 virtual com::sun::star::uno::Any SAL_CALL
300 getObject(
301 sal_Int32 columnIndex,
302 const com::sun::star::uno::Reference<
303 com::sun::star::container::XNameAccess >& typeMap )
304 throw( com::sun::star::sdbc::SQLException,
305 com::sun::star::uno::RuntimeException)
307 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
308 return m_aItems[m_nRow]->getObject( columnIndex,typeMap );
309 else
310 return com::sun::star::uno::Any();
313 virtual com::sun::star::uno::Reference<
314 com::sun::star::sdbc::XRef > SAL_CALL
315 getRef(
316 sal_Int32 columnIndex )
317 throw( com::sun::star::sdbc::SQLException,
318 com::sun::star::uno::RuntimeException)
320 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
321 return m_aItems[m_nRow]->getRef( columnIndex );
322 else
323 return com::sun::star::uno::Reference< com::sun::star::sdbc::XRef >();
326 virtual com::sun::star::uno::Reference<
327 com::sun::star::sdbc::XBlob > SAL_CALL
328 getBlob(
329 sal_Int32 columnIndex )
330 throw( com::sun::star::sdbc::SQLException,
331 com::sun::star::uno::RuntimeException)
333 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
334 return m_aItems[m_nRow]->getBlob( columnIndex );
335 else
336 return com::sun::star::uno::Reference< com::sun::star::sdbc::XBlob >();
339 virtual com::sun::star::uno::Reference<
340 com::sun::star::sdbc::XClob > SAL_CALL
341 getClob(
342 sal_Int32 columnIndex )
343 throw( com::sun::star::sdbc::SQLException,
344 com::sun::star::uno::RuntimeException)
346 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
347 return m_aItems[m_nRow]->getClob( columnIndex );
348 else
349 return com::sun::star::uno::Reference<
350 com::sun::star::sdbc::XClob >();
353 virtual com::sun::star::uno::Reference<
354 com::sun::star::sdbc::XArray > SAL_CALL
355 getArray(
356 sal_Int32 columnIndex )
357 throw( com::sun::star::sdbc::SQLException,
358 com::sun::star::uno::RuntimeException)
360 if( 0 <= m_nRow && m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
361 return m_aItems[m_nRow]->getArray( columnIndex );
362 else
363 return com::sun::star::uno::Reference<
364 com::sun::star::sdbc::XArray >();
368 // XResultSet
370 virtual sal_Bool SAL_CALL
371 next(
372 void )
373 throw( com::sun::star::sdbc::SQLException,
374 com::sun::star::uno::RuntimeException);
376 virtual sal_Bool SAL_CALL
377 isBeforeFirst(
378 void )
379 throw( com::sun::star::sdbc::SQLException,
380 com::sun::star::uno::RuntimeException);
382 virtual sal_Bool SAL_CALL
383 isAfterLast(
384 void )
385 throw( com::sun::star::sdbc::SQLException,
386 com::sun::star::uno::RuntimeException);
388 virtual sal_Bool SAL_CALL
389 isFirst(
390 void )
391 throw( com::sun::star::sdbc::SQLException,
392 com::sun::star::uno::RuntimeException);
394 virtual sal_Bool SAL_CALL
395 isLast(
396 void )
397 throw( com::sun::star::sdbc::SQLException,
398 com::sun::star::uno::RuntimeException);
400 virtual void SAL_CALL
401 beforeFirst(
402 void )
403 throw( com::sun::star::sdbc::SQLException,
404 com::sun::star::uno::RuntimeException);
406 virtual void SAL_CALL
407 afterLast(
408 void )
409 throw( com::sun::star::sdbc::SQLException,
410 com::sun::star::uno::RuntimeException);
412 virtual sal_Bool SAL_CALL
413 first(
414 void )
415 throw( com::sun::star::sdbc::SQLException,
416 com::sun::star::uno::RuntimeException);
418 virtual sal_Bool SAL_CALL
419 last(
420 void )
421 throw( com::sun::star::sdbc::SQLException,
422 com::sun::star::uno::RuntimeException);
424 virtual sal_Int32 SAL_CALL
425 getRow(
426 void )
427 throw( com::sun::star::sdbc::SQLException,
428 com::sun::star::uno::RuntimeException);
430 virtual sal_Bool SAL_CALL
431 absolute(
432 sal_Int32 row )
433 throw( com::sun::star::sdbc::SQLException,
434 com::sun::star::uno::RuntimeException);
436 virtual sal_Bool SAL_CALL
437 relative(
438 sal_Int32 rows )
439 throw( com::sun::star::sdbc::SQLException,
440 com::sun::star::uno::RuntimeException);
442 virtual sal_Bool SAL_CALL
443 previous(
444 void )
445 throw( com::sun::star::sdbc::SQLException,
446 com::sun::star::uno::RuntimeException);
448 virtual void SAL_CALL
449 refreshRow(
450 void )
451 throw( com::sun::star::sdbc::SQLException,
452 com::sun::star::uno::RuntimeException);
454 virtual sal_Bool SAL_CALL
455 rowUpdated(
456 void )
457 throw( com::sun::star::sdbc::SQLException,
458 com::sun::star::uno::RuntimeException);
460 virtual sal_Bool SAL_CALL
461 rowInserted(
462 void )
463 throw( com::sun::star::sdbc::SQLException,
464 com::sun::star::uno::RuntimeException);
466 virtual sal_Bool SAL_CALL
467 rowDeleted(
468 void )
469 throw( com::sun::star::sdbc::SQLException,
470 com::sun::star::uno::RuntimeException);
473 virtual com::sun::star::uno::Reference<
474 com::sun::star::uno::XInterface > SAL_CALL
475 getStatement(
476 void )
477 throw( com::sun::star::sdbc::SQLException,
478 com::sun::star::uno::RuntimeException);
480 // XCloseable
482 virtual void SAL_CALL
483 close(
484 void )
485 throw( com::sun::star::sdbc::SQLException,
486 com::sun::star::uno::RuntimeException);
488 // XContentAccess
490 virtual rtl::OUString SAL_CALL
491 queryContentIdentifierString(
492 void )
493 throw( com::sun::star::uno::RuntimeException );
495 virtual com::sun::star::uno::Reference<
496 com::sun::star::ucb::XContentIdentifier > SAL_CALL
497 queryContentIdentifier(
498 void )
499 throw( com::sun::star::uno::RuntimeException );
501 virtual com::sun::star::uno::Reference<
502 com::sun::star::ucb::XContent > SAL_CALL
503 queryContent(
504 void )
505 throw( com::sun::star::uno::RuntimeException );
507 // XResultSetMetaDataSupplier
508 virtual com::sun::star::uno::Reference<
509 com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
510 getMetaData(
511 void )
512 throw( com::sun::star::sdbc::SQLException,
513 com::sun::star::uno::RuntimeException);
516 // XPropertySet
517 virtual com::sun::star::uno::Reference<
518 com::sun::star::beans::XPropertySetInfo > SAL_CALL
519 getPropertySetInfo()
520 throw( com::sun::star::uno::RuntimeException);
522 virtual void SAL_CALL setPropertyValue(
523 const rtl::OUString& aPropertyName,
524 const com::sun::star::uno::Any& aValue )
525 throw( com::sun::star::beans::UnknownPropertyException,
526 com::sun::star::beans::PropertyVetoException,
527 com::sun::star::lang::IllegalArgumentException,
528 com::sun::star::lang::WrappedTargetException,
529 com::sun::star::uno::RuntimeException);
531 virtual com::sun::star::uno::Any SAL_CALL
532 getPropertyValue(
533 const rtl::OUString& PropertyName )
534 throw( com::sun::star::beans::UnknownPropertyException,
535 com::sun::star::lang::WrappedTargetException,
536 com::sun::star::uno::RuntimeException);
538 virtual void SAL_CALL
539 addPropertyChangeListener(
540 const rtl::OUString& aPropertyName,
541 const com::sun::star::uno::Reference<
542 com::sun::star::beans::XPropertyChangeListener >& xListener )
543 throw( com::sun::star::beans::UnknownPropertyException,
544 com::sun::star::lang::WrappedTargetException,
545 com::sun::star::uno::RuntimeException);
547 virtual void SAL_CALL
548 removePropertyChangeListener(
549 const rtl::OUString& aPropertyName,
550 const com::sun::star::uno::Reference<
551 com::sun::star::beans::XPropertyChangeListener >& aListener )
552 throw( com::sun::star::beans::UnknownPropertyException,
553 com::sun::star::lang::WrappedTargetException,
554 com::sun::star::uno::RuntimeException);
556 virtual void SAL_CALL
557 addVetoableChangeListener(
558 const rtl::OUString& PropertyName,
559 const com::sun::star::uno::Reference<
560 com::sun::star::beans::XVetoableChangeListener >& aListener )
561 throw( com::sun::star::beans::UnknownPropertyException,
562 com::sun::star::lang::WrappedTargetException,
563 com::sun::star::uno::RuntimeException);
565 virtual void SAL_CALL removeVetoableChangeListener(
566 const rtl::OUString& PropertyName,
567 const com::sun::star::uno::Reference<
568 com::sun::star::beans::XVetoableChangeListener >& aListener )
569 throw( com::sun::star::beans::UnknownPropertyException,
570 com::sun::star::lang::WrappedTargetException,
571 com::sun::star::uno::RuntimeException);
573 protected:
575 com::sun::star::uno::Reference<
576 com::sun::star::lang::XMultiServiceFactory > m_xMSF;
577 com::sun::star::uno::Reference<
578 com::sun::star::ucb::XContentProvider > m_xProvider;
579 sal_Int32 m_nRow;
580 sal_Bool m_nWasNull;
581 sal_Int32 m_nOpenMode;
582 sal_Bool m_bRowCountFinal;
584 typedef std::vector< com::sun::star::uno::Reference<
585 com::sun::star::ucb::XContentIdentifier > > IdentSet;
586 typedef std::vector< com::sun::star::uno::Reference<
587 com::sun::star::sdbc::XRow > > ItemSet;
588 typedef std::vector< rtl::OUString >
589 PathSet;
591 IdentSet m_aIdents;
592 ItemSet m_aItems;
593 PathSet m_aPath;
595 com::sun::star::uno::Sequence<
596 com::sun::star::beans::Property > m_sProperty;
597 com::sun::star::uno::Sequence<
598 com::sun::star::ucb::NumberedSortingInfo > m_sSortingInfo;
600 osl::Mutex m_aMutex;
601 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
603 cppu::OInterfaceContainerHelper* m_pRowCountListeners;
604 cppu::OInterfaceContainerHelper* m_pIsFinalListeners;
608 } // end namespace fileaccess
611 #endif