xref: /trunk/main/dbaccess/source/core/api/RowSetCacheIterator.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX
28 #define DBACCESS_ROWSETCACHEITERATOR_HXX
29 
30 #ifndef DBACCESS_CORE_API_ROWSETROW_HXX
31 #include "RowSetRow.hxx"
32 #endif
33 #ifndef _COMPHELPER_STLTYPES_HXX_
34 #include <comphelper/stl_types.hxx>
35 #endif
36 
37 namespace dbaccess
38 {
39     class ORowSetBase;
40     typedef struct
41     {
42         ORowSetMatrix::iterator     aIterator;
43         ::com::sun::star::uno::Any  aBookmark;
44         ORowSetBase*                pRowSet;
45     } ORowSetCacheIterator_Helper;
46 
47     DECLARE_STL_STDKEY_MAP(sal_Int32,ORowSetCacheIterator_Helper,ORowSetCacheMap);
48 
49     class ORowSetCache;
50     class ORowSetCacheIterator
51     {
52         friend class ORowSetCache;
53         ORowSetCacheMap::iterator   m_aIter;
54         ORowSetCache*               m_pCache;
55         ORowSetBase*                m_pRowSet;
56     protected:
57         ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet)
58             : m_aIter(_rIter)
59             ,m_pCache(_pCache)
60             ,m_pRowSet(_pRowSet)
61         {
62         }
63     public:
64         ORowSetCacheIterator() :m_aIter(),m_pCache(NULL),m_pRowSet(NULL){}
65         ORowSetCacheIterator(const ORowSetCacheIterator& _rRH);
66         ORowSetCacheIterator& operator =(const ORowSetCacheIterator&);
67 
68         sal_Bool isNull() const;
69         ORowSetCacheIterator& operator =(const ORowSetMatrix::iterator&);
70         operator ORowSetMatrix::iterator();
71 
72         ORowSetRow& operator *();
73         const ORowSetRow& operator *() const;
74 
75         ORowSetMatrix::iterator& operator ->();
76         const ORowSetMatrix::iterator& operator ->() const;
77 
78         bool operator <=(const ORowSetMatrix::iterator& _rRH) const;
79         bool operator <(const ORowSetMatrix::iterator& _rRH) const;
80         bool operator !=(const ORowSetMatrix::iterator& _rRH) const;
81         bool operator ==(const ORowSetMatrix::iterator& _rRH) const;
82 
83         void setBookmark(const ::com::sun::star::uno::Any&  _rBookmark);
84         ::com::sun::star::uno::Any getBookmark() const { return m_aIter->second.aBookmark; }
85         ::osl::Mutex*   getMutex() const;
86 
87         ORowSetCacheMap::iterator getIter() const { return m_aIter; }
88     };
89 }
90 #endif // DBACCESS_ROWSETCACHEITERATOR_HXX
91 
92 
93