LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetCacheIterator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 32 51 62.7 %
Date: 2012-08-25 Functions: 9 15 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 52 26.9 %

           Branch data     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                 :            : #include <rtl/logfile.hxx>
      24                 :            : 
      25                 :            : using namespace dbaccess;
      26                 :        524 : ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH)
      27                 :            : : m_aIter(_rRH.m_aIter)
      28                 :            : , m_pCache(_rRH.m_pCache)
      29                 :        524 : ,m_pRowSet(_rRH.m_pRowSet)
      30                 :            : {
      31                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::ORowSetCacheIterator" );
      32                 :        524 : }
      33                 :            : 
      34                 :         10 : ORowSetCacheIterator::operator ORowSetMatrix::iterator()
      35                 :            : {
      36                 :         10 :     return m_aIter->second.aIterator;
      37                 :            : }
      38                 :            : 
      39                 :         44 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterator& _rRH)
      40                 :            : {
      41         [ -  + ]:         44 :     if(this == &_rRH)
      42                 :          0 :         return *this;
      43                 :            : 
      44                 :         44 :     m_pCache = _rRH.m_pCache;
      45                 :         44 :     m_aIter  = _rRH.m_aIter;
      46                 :         44 :     m_pRowSet = _rRH.m_pRowSet;
      47                 :            : 
      48                 :         44 :     return *this;
      49                 :            : }
      50                 :            : 
      51                 :        462 : ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator& _rIter)
      52                 :            : {
      53                 :        462 :     m_aIter->second.aIterator = _rIter;
      54                 :        462 :     return *this;
      55                 :            : }
      56                 :            : 
      57                 :       6406 : ORowSetRow& ORowSetCacheIterator::operator *()
      58                 :            : {
      59                 :       6406 :     return *m_aIter->second.aIterator;
      60                 :            : }
      61                 :            : 
      62                 :          0 : const ORowSetRow& ORowSetCacheIterator::operator *() const
      63                 :            : {
      64 [ #  # ][ #  # ]:          0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
      65                 :            :     {
      66                 :            :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      67                 :          0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      68                 :          0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      69                 :            :     }
      70                 :          0 :     return *m_aIter->second.aIterator;
      71                 :            : }
      72                 :            : 
      73                 :       5608 : ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->()
      74                 :            : {
      75                 :       5608 :     return m_aIter->second.aIterator;
      76                 :            : }
      77                 :            : 
      78                 :          0 : const ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() const
      79                 :            : {
      80 [ #  # ][ #  # ]:          0 :     if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
      81                 :            :     {
      82                 :            :         OSL_ENSURE(m_aIter->second.aBookmark.hasValue(),"bookmark has no value!");
      83                 :          0 :         OSL_VERIFY(m_pCache->moveToBookmark(m_aIter->second.aBookmark));
      84                 :          0 :         m_aIter->second.aIterator = m_pCache->m_aMatrixIter;
      85                 :            :     }
      86                 :          0 :     return m_aIter->second.aIterator;
      87                 :            : }
      88                 :            : 
      89                 :          0 : bool ORowSetCacheIterator::operator <=(const ORowSetMatrix::iterator& _rRH) const
      90                 :            : {
      91                 :          0 :     return m_aIter->second.aIterator <= _rRH;
      92                 :            : }
      93                 :            : 
      94                 :          0 : bool ORowSetCacheIterator::operator <(const ORowSetMatrix::iterator& _rRH) const
      95                 :            : {
      96                 :          0 :     return m_aIter->second.aIterator < _rRH;
      97                 :            : }
      98                 :            : 
      99                 :       2852 : bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator& _rRH) const
     100                 :            : {
     101                 :       2852 :     return m_aIter->second.aIterator != _rRH;
     102                 :            : }
     103                 :            : 
     104                 :          0 : bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator& _rRH) const
     105                 :            : {
     106                 :          0 :     return m_aIter->second.aIterator == _rRH;
     107                 :            : }
     108                 :            : 
     109                 :        238 : void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any&    _rBookmark)
     110                 :            : {
     111                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::setBookmark" );
     112                 :        238 :     m_aIter->second.aBookmark = _rBookmark;
     113                 :        238 : }
     114                 :            : 
     115                 :       8336 : sal_Bool ORowSetCacheIterator::isNull() const
     116                 :            : {
     117                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::isNull" );
     118 [ +  - ][ +  - ]:       8336 :     sal_Bool bRet = !m_pCache || !m_pRowSet || m_aIter == m_pCache->m_aCacheIterators.end();
         [ -  + ][ +  - ]
     119         [ +  - ]:       8336 :     if ( !bRet )
     120                 :            :     {
     121                 :       8336 :         ORowSetCacheIterator_Helper aHelper = m_aIter->second;
     122                 :       8336 :         bRet = ( m_pRowSet->isInsertRow()
     123                 :            :             ?
     124 [ +  - ][ +  + ]:       8484 :             m_aIter->second.aIterator == m_pCache->m_pInsertMatrix->end()
                 [ #  # ]
     125                 :            :             :
     126 [ +  - ][ +  + ]:      16524 :             m_aIter->second.aIterator == m_pCache->m_pMatrix->end()
                 [ #  # ]
     127         [ +  + ]:      25008 :         );
     128                 :            :     }
     129                 :       8336 :     return  bRet;
     130                 :            : }
     131                 :            : 
     132                 :          0 : ::osl::Mutex* ORowSetCacheIterator::getMutex() const
     133                 :            : {
     134                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::getMutex" );
     135         [ #  # ]:          0 :     return m_pRowSet ? m_pRowSet->getMutex() : NULL;
     136                 :            : }
     137                 :            : 
     138                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10