LCOV - code coverage report
Current view: top level - sw/source/core/docnode - ndindex.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 59 66 89.4 %
Date: 2014-04-11 Functions: 12 13 92.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 "ndindex.hxx"
      21             : 
      22       15619 : SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
      23       15619 :     : aStart( rS ), aEnd( rE )
      24       15619 : {}
      25             : 
      26       21905 : SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
      27       21905 :     : aStart( rRange.aStart ), aEnd( rRange.aEnd )
      28       21905 : {}
      29             : 
      30           0 : SwNodeRange::SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx )
      31           0 :     : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx )
      32           0 : {}
      33             : 
      34        4624 : SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
      35             :                           const SwNodeIndex& rE, long nEndDiff )
      36        4624 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      37        4624 : {}
      38             : 
      39        3631 : SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
      40             :                           const SwNode& rE, long nEndDiff )
      41        3631 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      42        3631 : {}
      43             : 
      44      808748 : SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
      45      808748 :     : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
      46             : {
      47      808748 :     rNds.RegisterIndex( *this );
      48      808748 : }
      49             : 
      50     2913685 : SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
      51     2913685 :     : pNext( 0 ), pPrev( 0 )
      52             : {
      53     2913685 :     if( nDiff )
      54      480081 :         pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
      55             :     else
      56     2433604 :         pNd = rIdx.pNd;
      57             : 
      58     2913685 :     pNd->GetNodes().RegisterIndex( *this );
      59     2913685 : }
      60             : 
      61      662449 : SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
      62      662449 :     : pNext( 0 ), pPrev( 0 )
      63             : {
      64      662449 :     if( nDiff )
      65       63792 :         pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
      66             :     else
      67      598657 :         pNd = (SwNode*)&rNd;
      68             : 
      69      662449 :     pNd->GetNodes().RegisterIndex( *this );
      70      662449 : }
      71             : 
      72     4384833 : void SwNodeIndex::Remove()
      73             : {
      74     4384833 :     pNd->GetNodes().DeRegisterIndex( *this );
      75     4384833 : }
      76             : 
      77     1003856 : SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
      78             : {
      79     1003856 :     if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
      80             :     {
      81          20 :         pNd->GetNodes().DeRegisterIndex( *this );
      82          20 :         pNd = rIdx.pNd;
      83          20 :         pNd->GetNodes().RegisterIndex( *this );
      84             :     }
      85             :     else
      86     1003836 :         pNd = rIdx.pNd;
      87     1003856 :     return *this;
      88             : }
      89             : 
      90      179296 : SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
      91             : {
      92      179296 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
      93             :     {
      94           1 :         pNd->GetNodes().DeRegisterIndex( *this );
      95           1 :         pNd = (SwNode*)&rNd;
      96           1 :         pNd->GetNodes().RegisterIndex( *this );
      97             :     }
      98             :     else
      99      179295 :         pNd = (SwNode*)&rNd;
     100      179296 :     return *this;
     101             : }
     102             : 
     103           1 : SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
     104             : {
     105           1 :     if( &pNd->GetNodes() != &rNds )
     106             :     {
     107           1 :         pNd->GetNodes().DeRegisterIndex( *this );
     108           1 :         pNd = rNds[ nIdx ];
     109           1 :         pNd->GetNodes().RegisterIndex( *this );
     110             :     }
     111             :     else
     112           0 :         pNd = rNds[ nIdx ];
     113           1 :     return *this;
     114             : }
     115             : 
     116       43588 : SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
     117             : {
     118       43588 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
     119             :     {
     120           0 :         pNd->GetNodes().DeRegisterIndex( *this );
     121           0 :         pNd = (SwNode*)&rNd;
     122           0 :         pNd->GetNodes().RegisterIndex( *this );
     123             :     }
     124             :     else
     125       43588 :         pNd = (SwNode*)&rNd;
     126             : 
     127       43588 :     if( nOffset )
     128       43575 :         pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
     129             : 
     130       43588 :     return *this;
     131             : }
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10