LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetCacheIterator.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 50 0.0 %
Date: 2014-04-14 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include "RowSetCacheIterator.hxx"
      21             : #include "RowSetCache.hxx"
      22             : #include "RowSetBase.hxx"
      23             : 
      24             : using namespace dbaccess;
      25           0 : ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH)
      26             : : m_aIter(_rRH.m_aIter)
      27             : , m_pCache(_rRH.m_pCache)
      28           0 : ,m_pRowSet(_rRH.m_pRowSet)
      29             : {
      30             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::ORowSetCacheIterator" );
      31           0 : }
      32             : 
      33           0 : ORowSetCacheIterator::operator ORowSetMatrix::iterator()
      34             : {
      35           0 :     return m_aIter->second.aIterator;
      36             : }
      37             : 
      38           0 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterator& _rRH)
      39             : {
      40           0 :     if(this == &_rRH)
      41           0 :         return *this;
      42             : 
      43           0 :     m_pCache = _rRH.m_pCache;
      44           0 :     m_aIter  = _rRH.m_aIter;
      45           0 :     m_pRowSet = _rRH.m_pRowSet;
      46             : 
      47           0 :     return *this;
      48             : }
      49             : 
      50           0 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator& _rIter)
      51             : {
      52           0 :     m_aIter->second.aIterator = _rIter;
      53           0 :     return *this;
      54             : }
      55             : 
      56           0 : ORowSetRow& ORowSetCacheIterator::operator *()
      57             : {
      58           0 :     return *m_aIter->second.aIterator;
      59             : }
      60             : 
      61           0 : const ORowSetRow& ORowSetCacheIterator::operator *() const
      62             : {
      63           0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
      64             :     {
      65             :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      66           0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      67           0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      68             :     }
      69           0 :     return *m_aIter->second.aIterator;
      70             : }
      71             : 
      72           0 : ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->()
      73             : {
      74           0 :     return m_aIter->second.aIterator;
      75             : }
      76             : 
      77           0 : const ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() const
      78             : {
      79           0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
      80             :     {
      81             :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      82           0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      83           0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      84             :     }
      85           0 :     return m_aIter->second.aIterator;
      86             : }
      87             : 
      88           0 : bool ORowSetCacheIterator::operator <=(const ORowSetMatrix::iterator& _rRH) const
      89             : {
      90           0 :     return m_aIter->second.aIterator <= _rRH;
      91             : }
      92             : 
      93           0 : bool ORowSetCacheIterator::operator <(const ORowSetMatrix::iterator& _rRH) const
      94             : {
      95           0 :     return m_aIter->second.aIterator < _rRH;
      96             : }
      97             : 
      98           0 : bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator& _rRH) const
      99             : {
     100           0 :     return m_aIter->second.aIterator != _rRH;
     101             : }
     102             : 
     103           0 : bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator& _rRH) const
     104             : {
     105           0 :     return m_aIter->second.aIterator == _rRH;
     106             : }
     107             : 
     108           0 : void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any&    _rBookmark)
     109             : {
     110             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::setBookmark" );
     111           0 :     m_aIter->second.aBookmark = _rBookmark;
     112           0 : }
     113             : 
     114           0 : sal_Bool ORowSetCacheIterator::isNull() const
     115             : {
     116             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::isNull" );
     117           0 :     sal_Bool bRet = !m_pCache || !m_pRowSet || m_aIter == m_pCache->m_aCacheIterators.end();
     118           0 :     if ( !bRet )
     119             :     {
     120           0 :         bRet = ( m_pRowSet->isInsertRow()
     121             :             ?
     122           0 :             m_aIter->second.aIterator == m_pCache->m_pInsertMatrix->end()
     123             :             :
     124           0 :             m_aIter->second.aIterator == m_pCache->m_pMatrix->end()
     125           0 :         );
     126             :     }
     127           0 :     return  bRet;
     128             : }
     129             : 
     130           0 : ::osl::Mutex* ORowSetCacheIterator::getMutex() const
     131             : {
     132             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::getMutex" );
     133           0 :     return m_pRowSet ? m_pRowSet->getMutex() : NULL;
     134             : }
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10