LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetCacheIterator.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 28 50 56.0 %
Date: 2014-11-03 Functions: 8 15 53.3 %
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           0 : }
      31             : 
      32          10 : ORowSetCacheIterator::operator ORowSetMatrix::iterator()
      33             : {
      34          10 :     return m_aIter->second.aIterator;
      35             : }
      36             : 
      37          48 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterator& _rRH)
      38             : {
      39          48 :     if(this == &_rRH)
      40           0 :         return *this;
      41             : 
      42          48 :     m_pCache = _rRH.m_pCache;
      43          48 :     m_aIter  = _rRH.m_aIter;
      44          48 :     m_pRowSet = _rRH.m_pRowSet;
      45             : 
      46          48 :     return *this;
      47             : }
      48             : 
      49         576 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator& _rIter)
      50             : {
      51         576 :     m_aIter->second.aIterator = _rIter;
      52         576 :     return *this;
      53             : }
      54             : 
      55        5820 : ORowSetRow& ORowSetCacheIterator::operator *()
      56             : {
      57        5820 :     return *m_aIter->second.aIterator;
      58             : }
      59             : 
      60           0 : const ORowSetRow& ORowSetCacheIterator::operator *() const
      61             : {
      62           0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
      63             :     {
      64             :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      65           0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      66           0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      67             :     }
      68           0 :     return *m_aIter->second.aIterator;
      69             : }
      70             : 
      71        5786 : ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->()
      72             : {
      73        5786 :     return m_aIter->second.aIterator;
      74             : }
      75             : 
      76           0 : const ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() const
      77             : {
      78           0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
      79             :     {
      80             :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      81           0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      82           0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      83             :     }
      84           0 :     return m_aIter->second.aIterator;
      85             : }
      86             : 
      87           0 : bool ORowSetCacheIterator::operator <=(const ORowSetMatrix::iterator& _rRH) const
      88             : {
      89           0 :     return m_aIter->second.aIterator <= _rRH;
      90             : }
      91             : 
      92           0 : bool ORowSetCacheIterator::operator <(const ORowSetMatrix::iterator& _rRH) const
      93             : {
      94           0 :     return m_aIter->second.aIterator < _rRH;
      95             : }
      96             : 
      97        5778 : bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator& _rRH) const
      98             : {
      99        5778 :     return m_aIter->second.aIterator != _rRH;
     100             : }
     101             : 
     102           0 : bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator& _rRH) const
     103             : {
     104           0 :     return m_aIter->second.aIterator == _rRH;
     105             : }
     106             : 
     107         300 : void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any&    _rBookmark)
     108             : {
     109         300 :     m_aIter->second.aBookmark = _rBookmark;
     110         300 : }
     111             : 
     112        6044 : bool ORowSetCacheIterator::isNull() const
     113             : {
     114        6044 :     bool bRet = !m_pCache || !m_pRowSet || m_aIter == m_pCache->m_aCacheIterators.end();
     115        6044 :     if ( !bRet )
     116             :     {
     117        6044 :         bRet = ( m_pRowSet->isInsertRow()
     118             :             ?
     119        6080 :             m_aIter->second.aIterator == m_pCache->m_pInsertMatrix->end()
     120             :             :
     121       18108 :             m_aIter->second.aIterator == m_pCache->m_pMatrix->end()
     122       24164 :         );
     123             :     }
     124        6044 :     return  bRet;
     125             : }
     126             : 
     127           0 : ::osl::Mutex* ORowSetCacheIterator::getMutex() const
     128             : {
     129           0 :     return m_pRowSet ? m_pRowSet->getMutex() : NULL;
     130             : }
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10