LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/docnode - ndindex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 47 66 71.2 %
Date: 2012-12-17 Functions: 11 13 84.6 %
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             : 
      21             : #include "ndindex.hxx"
      22             : 
      23             : 
      24        1582 : SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
      25        1582 :     : aStart( rS ), aEnd( rE )
      26        1582 : {}
      27             : 
      28        2478 : SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
      29        2478 :     : aStart( rRange.aStart ), aEnd( rRange.aEnd )
      30        2478 : {}
      31             : 
      32           0 : SwNodeRange::SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx )
      33           0 :     : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx )
      34           0 : {}
      35             : 
      36             : 
      37        1167 : SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
      38             :                           const SwNodeIndex& rE, long nEndDiff )
      39        1167 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      40        1167 : {}
      41             : 
      42         828 : SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
      43             :                           const SwNode& rE, long nEndDiff )
      44         828 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      45         828 : {}
      46             : 
      47             : 
      48      252838 : SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
      49      252838 :     : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
      50             : {
      51      252838 :     rNds.RegisterIndex( *this );
      52      252838 : }
      53             : 
      54             : 
      55      726287 : SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
      56      726287 :     : pNext( 0 ), pPrev( 0 )
      57             : {
      58      726287 :     if( nDiff )
      59      205495 :         pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
      60             :     else
      61      520792 :         pNd = rIdx.pNd;
      62             : 
      63      726287 :     pNd->GetNodes().RegisterIndex( *this );
      64      726287 : }
      65             : 
      66             : 
      67      120248 : SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
      68      120248 :     : pNext( 0 ), pPrev( 0 )
      69             : {
      70      120248 :     if( nDiff )
      71        5233 :         pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
      72             :     else
      73      115015 :         pNd = (SwNode*)&rNd;
      74             : 
      75      120248 :     pNd->GetNodes().RegisterIndex( *this );
      76      120248 : }
      77             : 
      78             : 
      79     1091989 : void SwNodeIndex::Remove()
      80             : {
      81     1091989 :     pNd->GetNodes().DeRegisterIndex( *this );
      82     1091989 : }
      83             : 
      84      162288 : SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
      85             : {
      86      162288 :     if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
      87             :     {
      88           0 :         pNd->GetNodes().DeRegisterIndex( *this );
      89           0 :         pNd = rIdx.pNd;
      90           0 :         pNd->GetNodes().RegisterIndex( *this );
      91             :     }
      92             :     else
      93      162288 :         pNd = rIdx.pNd;
      94      162288 :     return *this;
      95             : }
      96             : 
      97       16216 : SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
      98             : {
      99       16216 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
     100             :     {
     101           0 :         pNd->GetNodes().DeRegisterIndex( *this );
     102           0 :         pNd = (SwNode*)&rNd;
     103           0 :         pNd->GetNodes().RegisterIndex( *this );
     104             :     }
     105             :     else
     106       16216 :         pNd = (SwNode*)&rNd;
     107       16216 :     return *this;
     108             : }
     109             : 
     110           0 : SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
     111             : {
     112           0 :     if( &pNd->GetNodes() != &rNds )
     113             :     {
     114           0 :         pNd->GetNodes().DeRegisterIndex( *this );
     115           0 :         pNd = rNds[ nIdx ];
     116           0 :         pNd->GetNodes().RegisterIndex( *this );
     117             :     }
     118             :     else
     119           0 :         pNd = rNds[ nIdx ];
     120           0 :     return *this;
     121             : }
     122             : 
     123       10273 : SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
     124             : {
     125       10273 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
     126             :     {
     127           0 :         pNd->GetNodes().DeRegisterIndex( *this );
     128           0 :         pNd = (SwNode*)&rNd;
     129           0 :         pNd->GetNodes().RegisterIndex( *this );
     130             :     }
     131             :     else
     132       10273 :         pNd = (SwNode*)&rNd;
     133             : 
     134       10273 :     if( nOffset )
     135       10273 :         pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
     136             : 
     137       10273 :     return *this;
     138             : }
     139             : 
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10