LCOV - code coverage report
Current view: top level - sw/source/core/docnode - ndindex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 57 66 86.4 %
Date: 2012-08-25 Functions: 12 13 92.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 24 62.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "ndindex.hxx"
      31                 :            : 
      32                 :            : 
      33                 :       1437 : SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
      34         [ +  - ]:       1437 :     : aStart( rS ), aEnd( rE )
      35                 :       1437 : {}
      36                 :            : 
      37                 :       2196 : SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
      38         [ +  - ]:       2196 :     : aStart( rRange.aStart ), aEnd( rRange.aEnd )
      39                 :       2196 : {}
      40                 :            : 
      41                 :          0 : SwNodeRange::SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx )
      42         [ #  # ]:          0 :     : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx )
      43                 :          0 : {}
      44                 :            : 
      45                 :            : 
      46                 :       1712 : SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
      47                 :            :                           const SwNodeIndex& rE, long nEndDiff )
      48         [ +  - ]:       1712 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      49                 :       1712 : {}
      50                 :            : 
      51                 :        890 : SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
      52                 :            :                           const SwNode& rE, long nEndDiff )
      53         [ +  - ]:        890 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      54                 :        890 : {}
      55                 :            : 
      56                 :            : 
      57                 :     443066 : SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
      58                 :     443066 :     : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
      59                 :            : {
      60                 :     443066 :     rNds.RegisterIndex( *this );
      61                 :     443066 : }
      62                 :            : 
      63                 :            : 
      64                 :    1864814 : SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
      65                 :    1864814 :     : pNext( 0 ), pPrev( 0 )
      66                 :            : {
      67         [ +  + ]:    1864814 :     if( nDiff )
      68                 :     153869 :         pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
      69                 :            :     else
      70                 :    1710945 :         pNd = rIdx.pNd;
      71                 :            : 
      72                 :    1864814 :     pNd->GetNodes().RegisterIndex( *this );
      73                 :    1864814 : }
      74                 :            : 
      75                 :            : 
      76                 :     254074 : SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
      77                 :     254074 :     : pNext( 0 ), pPrev( 0 )
      78                 :            : {
      79         [ +  + ]:     254074 :     if( nDiff )
      80                 :       8377 :         pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
      81                 :            :     else
      82                 :     245697 :         pNd = (SwNode*)&rNd;
      83                 :            : 
      84                 :     254074 :     pNd->GetNodes().RegisterIndex( *this );
      85                 :     254074 : }
      86                 :            : 
      87                 :            : 
      88                 :    2560589 : void SwNodeIndex::Remove()
      89                 :            : {
      90                 :    2560589 :     pNd->GetNodes().DeRegisterIndex( *this );
      91                 :    2560589 : }
      92                 :            : 
      93                 :     379129 : SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
      94                 :            : {
      95         [ +  + ]:     379129 :     if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
      96                 :            :     {
      97                 :         38 :         pNd->GetNodes().DeRegisterIndex( *this );
      98                 :         38 :         pNd = rIdx.pNd;
      99                 :         38 :         pNd->GetNodes().RegisterIndex( *this );
     100                 :            :     }
     101                 :            :     else
     102                 :     379091 :         pNd = rIdx.pNd;
     103                 :     379129 :     return *this;
     104                 :            : }
     105                 :            : 
     106                 :      26284 : SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
     107                 :            : {
     108         [ +  + ]:      26284 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
     109                 :            :     {
     110                 :          2 :         pNd->GetNodes().DeRegisterIndex( *this );
     111                 :          2 :         pNd = (SwNode*)&rNd;
     112                 :          2 :         pNd->GetNodes().RegisterIndex( *this );
     113                 :            :     }
     114                 :            :     else
     115                 :      26282 :         pNd = (SwNode*)&rNd;
     116                 :      26284 :     return *this;
     117                 :            : }
     118                 :            : 
     119                 :         80 : SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
     120                 :            : {
     121         [ -  + ]:         80 :     if( &pNd->GetNodes() != &rNds )
     122                 :            :     {
     123                 :          0 :         pNd->GetNodes().DeRegisterIndex( *this );
     124                 :          0 :         pNd = rNds[ nIdx ];
     125                 :          0 :         pNd->GetNodes().RegisterIndex( *this );
     126                 :            :     }
     127                 :            :     else
     128                 :         80 :         pNd = rNds[ nIdx ];
     129                 :         80 :     return *this;
     130                 :            : }
     131                 :            : 
     132                 :      13110 : SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
     133                 :            : {
     134         [ -  + ]:      13110 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
     135                 :            :     {
     136                 :          0 :         pNd->GetNodes().DeRegisterIndex( *this );
     137                 :          0 :         pNd = (SwNode*)&rNd;
     138                 :          0 :         pNd->GetNodes().RegisterIndex( *this );
     139                 :            :     }
     140                 :            :     else
     141                 :      13110 :         pNd = (SwNode*)&rNd;
     142                 :            : 
     143         [ +  - ]:      13110 :     if( nOffset )
     144                 :      13110 :         pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
     145                 :            : 
     146                 :      13110 :     return *this;
     147                 :            : }
     148                 :            : 
     149                 :            : 
     150                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10