LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetCacheIterator.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 31 50 62.0 %
Date: 2014-04-11 Functions: 9 15 60.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         260 : ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH)
      26             : : m_aIter(_rRH.m_aIter)
      27             : , m_pCache(_rRH.m_pCache)
      28         260 : ,m_pRowSet(_rRH.m_pRowSet)
      29             : {
      30             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::ORowSetCacheIterator" );
      31         260 : }
      32             : 
      33           5 : ORowSetCacheIterator::operator ORowSetMatrix::iterator()
      34             : {
      35           5 :     return m_aIter->second.aIterator;
      36             : }
      37             : 
      38          22 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterator& _rRH)
      39             : {
      40          22 :     if(this == &_rRH)
      41           0 :         return *this;
      42             : 
      43          22 :     m_pCache = _rRH.m_pCache;
      44          22 :     m_aIter  = _rRH.m_aIter;
      45          22 :     m_pRowSet = _rRH.m_pRowSet;
      46             : 
      47          22 :     return *this;
      48             : }
      49             : 
      50         289 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator& _rIter)
      51             : {
      52         289 :     m_aIter->second.aIterator = _rIter;
      53         289 :     return *this;
      54             : }
      55             : 
      56        3702 : ORowSetRow& ORowSetCacheIterator::operator *()
      57             : {
      58        3702 :     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        3229 : ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->()
      73             : {
      74        3229 :     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        1583 : bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator& _rRH) const
      99             : {
     100        1583 :     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         149 : void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any&    _rBookmark)
     109             : {
     110             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::setBookmark" );
     111         149 :     m_aIter->second.aBookmark = _rBookmark;
     112         149 : }
     113             : 
     114        4819 : sal_Bool ORowSetCacheIterator::isNull() const
     115             : {
     116             :     SAL_INFO("dbaccess", "ORowSetCacheIterator::isNull" );
     117        4819 :     sal_Bool bRet = !m_pCache || !m_pRowSet || m_aIter == m_pCache->m_aCacheIterators.end();
     118        4819 :     if ( !bRet )
     119             :     {
     120        4819 :         bRet = ( m_pRowSet->isInsertRow()
     121             :             ?
     122        5041 :             m_aIter->second.aIterator == m_pCache->m_pInsertMatrix->end()
     123             :             :
     124       14309 :             m_aIter->second.aIterator == m_pCache->m_pMatrix->end()
     125       19202 :         );
     126             :     }
     127        4819 :     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