1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX
24 #define DBACCESS_ROWSETCACHEITERATOR_HXX
25 
26 #ifndef DBACCESS_CORE_API_ROWSETROW_HXX
27 #include "RowSetRow.hxx"
28 #endif
29 #ifndef _COMPHELPER_STLTYPES_HXX_
30 #include <comphelper/stl_types.hxx>
31 #endif
32 
33 namespace dbaccess
34 {
35 	class ORowSetBase;
36 	typedef struct
37 	{
38 		ORowSetMatrix::iterator		aIterator;
39 		::com::sun::star::uno::Any	aBookmark;
40 		ORowSetBase*				pRowSet;
41 	} ORowSetCacheIterator_Helper;
42 
43 	DECLARE_STL_STDKEY_MAP(sal_Int32,ORowSetCacheIterator_Helper,ORowSetCacheMap);
44 
45 	class ORowSetCache;
46 	class ORowSetCacheIterator
47 	{
48 		friend class ORowSetCache;
49 		ORowSetCacheMap::iterator	m_aIter;
50 		ORowSetCache*				m_pCache;
51 		ORowSetBase*				m_pRowSet;
52 	protected:
ORowSetCacheIterator(const ORowSetCacheMap::iterator & _rIter,ORowSetCache * _pCache,ORowSetBase * _pRowSet)53 		ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet)
54 			: m_aIter(_rIter)
55 			,m_pCache(_pCache)
56 			,m_pRowSet(_pRowSet)
57 		{
58 		}
59 	public:
ORowSetCacheIterator()60 		ORowSetCacheIterator() :m_aIter(),m_pCache(NULL),m_pRowSet(NULL){}
61 		ORowSetCacheIterator(const ORowSetCacheIterator& _rRH);
62 		ORowSetCacheIterator& operator =(const ORowSetCacheIterator&);
63 
64 		sal_Bool isNull() const;
65 		ORowSetCacheIterator& operator =(const ORowSetMatrix::iterator&);
66 		operator ORowSetMatrix::iterator();
67 
68 		ORowSetRow& operator *();
69 		const ORowSetRow& operator *() const;
70 
71 		ORowSetMatrix::iterator& operator ->();
72 		const ORowSetMatrix::iterator& operator ->() const;
73 
74 		bool operator <=(const ORowSetMatrix::iterator& _rRH) const;
75         bool operator <(const ORowSetMatrix::iterator& _rRH) const;
76 		bool operator !=(const ORowSetMatrix::iterator& _rRH) const;
77 		bool operator ==(const ORowSetMatrix::iterator& _rRH) const;
78 
79 		void setBookmark(const ::com::sun::star::uno::Any&	_rBookmark);
getBookmark() const80 		::com::sun::star::uno::Any getBookmark() const { return m_aIter->second.aBookmark; }
81 		::osl::Mutex*	getMutex() const;
82 
getIter() const83         ORowSetCacheMap::iterator getIter() const { return m_aIter; }
84 	};
85 }
86 #endif // DBACCESS_ROWSETCACHEITERATOR_HXX
87 
88 
89