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 .
20 #include "RowSetCacheIterator.hxx"
21 #include "RowSetCache.hxx"
22 #include "RowSetBase.hxx"
24 using namespace dbaccess
;
25 ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator
& _rRH
)
26 : m_aIter(_rRH
.m_aIter
)
27 , m_pCache(_rRH
.m_pCache
)
28 ,m_pRowSet(_rRH
.m_pRowSet
)
32 ORowSetCacheIterator::operator ORowSetMatrix::iterator()
34 return m_aIter
->second
.aIterator
;
37 ORowSetCacheIterator
& ORowSetCacheIterator::operator =(const ORowSetCacheIterator
& _rRH
)
42 m_pCache
= _rRH
.m_pCache
;
43 m_aIter
= _rRH
.m_aIter
;
44 m_pRowSet
= _rRH
.m_pRowSet
;
49 ORowSetCacheIterator
& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator
& _rIter
)
51 m_aIter
->second
.aIterator
= _rIter
;
55 ORowSetRow
& ORowSetCacheIterator::operator *()
57 return *m_aIter
->second
.aIterator
;
60 const ORowSetRow
& ORowSetCacheIterator::operator *() const
62 if ( !m_pRowSet
->isInsertRow() && m_aIter
->second
.aIterator
== m_pCache
->m_pMatrix
->end() )
64 OSL_ENSURE(m_aIter
->second
.aBookmark
.hasValue(),"bookmark has no value!");
65 OSL_VERIFY(m_pCache
->moveToBookmark(m_aIter
->second
.aBookmark
));
66 m_aIter
->second
.aIterator
= m_pCache
->m_aMatrixIter
;
68 return *m_aIter
->second
.aIterator
;
71 ORowSetMatrix::iterator
& ORowSetCacheIterator::operator ->()
73 return m_aIter
->second
.aIterator
;
76 const ORowSetMatrix::iterator
& ORowSetCacheIterator::operator ->() const
78 if ( !m_pRowSet
->isInsertRow() && m_aIter
->second
.aIterator
== m_pCache
->m_pMatrix
->end() )
80 OSL_ENSURE(m_aIter
->second
.aBookmark
.hasValue(),"bookmark has no value!");
81 OSL_VERIFY(m_pCache
->moveToBookmark(m_aIter
->second
.aBookmark
));
82 m_aIter
->second
.aIterator
= m_pCache
->m_aMatrixIter
;
84 return m_aIter
->second
.aIterator
;
87 bool ORowSetCacheIterator::operator <=(const ORowSetMatrix::iterator
& _rRH
) const
89 return m_aIter
->second
.aIterator
<= _rRH
;
92 bool ORowSetCacheIterator::operator <(const ORowSetMatrix::iterator
& _rRH
) const
94 return m_aIter
->second
.aIterator
< _rRH
;
97 bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator
& _rRH
) const
99 return m_aIter
->second
.aIterator
!= _rRH
;
102 bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator
& _rRH
) const
104 return m_aIter
->second
.aIterator
== _rRH
;
107 void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any
& _rBookmark
)
109 m_aIter
->second
.aBookmark
= _rBookmark
;
112 bool ORowSetCacheIterator::isNull() const
114 bool bRet
= !m_pCache
|| !m_pRowSet
|| m_aIter
== m_pCache
->m_aCacheIterators
.end();
117 bRet
= ( m_pRowSet
->isInsertRow()
119 m_aIter
->second
.aIterator
== m_pCache
->m_pInsertMatrix
->end()
121 m_aIter
->second
.aIterator
== m_pCache
->m_pMatrix
->end()
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */