LCOV - code coverage report
Current view: top level - connectivity/source/inc - TSkipDeletedSet.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 5 0.0 %
Date: 2014-04-14 Functions: 0 3 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             : #ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
      20             : #define CONNECTIVITY_SKIPDELETEDSSET_HXX
      21             : 
      22             : #include "TResultSetHelper.hxx"
      23             : #include <rtl/alloc.h>
      24             : #include <boost/unordered_map.hpp>
      25             : #include <vector>
      26             : #include "connectivity/dbtoolsdllapi.hxx"
      27             : 
      28             : namespace connectivity
      29             : {
      30             :     /**
      31             :         the class OSkipDeletedSet supports a general method to skip deleted rows
      32             :     */
      33             :     class OOO_DLLPUBLIC_DBTOOLS OSkipDeletedSet
      34             :     {
      35             :         ::std::vector<sal_Int32>                m_aBookmarksPositions;// vector of iterators to position map, the order is the logical position
      36             :         IResultSetHelper*                       m_pHelper;            // used for moving in the resultset
      37             :         bool                                    m_bDeletedVisible;
      38             : 
      39             :         sal_Bool    moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData);
      40             :     public:
      41             :         OSkipDeletedSet(IResultSetHelper* _pHelper);
      42             :         ~OSkipDeletedSet();
      43             : 
      44           0 :         inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
      45           0 :             { return ::rtl_allocateMemory( nSize ); }
      46             :         inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
      47             :             { return _pHint; }
      48           0 :         inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
      49           0 :             { ::rtl_freeMemory( pMem ); }
      50             :         inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
      51             :             {  }
      52             : 
      53             :         /**
      54             :             skipDeleted moves the resultset to the position defined by the parameters
      55             :             it garantees that the row isn't deleted
      56             :                 @param
      57             :                     IResultSetHelper::Movement  _eCursorPosition        in which direction the resultset should be moved
      58             :                     sal_Int32                   _nOffset                the position relativ to the movement
      59             :                     sal_Bool                    _bRetrieveData          is true when the current row should be filled which data
      60             :                 @return
      61             :                     true when the movement was successful otherwise false
      62             :         */
      63             :         sal_Bool    skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
      64             :         /**
      65             :             clear the map and the vector used in this class
      66             :         */
      67             :         void        clear();
      68             :         /**
      69             :             getMappedPosition returns the mapped position of a logical position
      70             :             @param
      71             :                 sal_Int32 _nBookmark    the logical position
      72             : 
      73             :             @return the mapped position
      74             :         */
      75             :         sal_Int32   getMappedPosition(sal_Int32 _nBookmark) const;
      76             :         /**
      77             :             insertNewPosition adds a new position to the map
      78             :             @param
      79             :                 sal_Int32 _nPos the logical position
      80             :         */
      81             :         void        insertNewPosition(sal_Int32 _nPos);
      82             :         /**
      83             :             deletePosition deletes this position from the map and decrement all following positions
      84             :             @param
      85             :                 sal_Int32 _nPos the logical position
      86             :         */
      87             :         void        deletePosition(sal_Int32 _nPos);
      88             :         /**
      89             :             getLastPosition returns the last position
      90             :             @return the last position
      91             :         */
      92             :         inline sal_Int32    getLastPosition() const { return m_aBookmarksPositions.size(); }
      93           0 :         inline void SetDeletedVisible(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; }
      94             :     };
      95             : }
      96             : #endif // CONNECTIVITY_SKIPDELETEDSSET_HXX
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10