LCOV - code coverage report
Current view: top level - sw/source/core/docnode - ndindex.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 60 67 89.6 %
Date: 2014-11-03 Functions: 14 15 93.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       37036 : SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
      23       37036 :     : aStart( rS ), aEnd( rE )
      24       37036 : {}
      25             : 
      26       51366 : SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
      27       51366 :     : aStart( rRange.aStart ), aEnd( rRange.aEnd )
      28       51366 : {}
      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       13823 : SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
      35             :                           const SwNodeIndex& rE, long nEndDiff )
      36       13823 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      37       13823 : {}
      38             : 
      39       10932 : SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
      40             :                           const SwNode& rE, long nEndDiff )
      41       10932 :     : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
      42       10932 : {}
      43             : 
      44     1931217 : SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
      45     1931217 :     : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
      46             : {
      47     1931217 :     rNds.RegisterIndex( *this );
      48     1931217 : }
      49             : 
      50     7889111 : SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
      51     7889111 :     : pNext( 0 ), pPrev( 0 )
      52             : {
      53     7889111 :     if( nDiff )
      54     1268927 :         pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
      55             :     else
      56     6620184 :         pNd = rIdx.pNd;
      57             : 
      58     7889111 :     pNd->GetNodes().RegisterIndex( *this );
      59     7889111 : }
      60             : 
      61     1762591 : SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
      62     1762591 :     : pNext( 0 ), pPrev( 0 )
      63             : {
      64     1762591 :     if( nDiff )
      65      170016 :         pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
      66             :     else
      67     1592575 :         pNd = (SwNode*)&rNd;
      68             : 
      69     1762591 :     pNd->GetNodes().RegisterIndex( *this );
      70     1762591 : }
      71             : 
      72    11582832 : void SwNodeIndex::Remove()
      73             : {
      74    11582832 :     pNd->GetNodes().DeRegisterIndex( *this );
      75    11582832 : }
      76             : 
      77     2515234 : SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
      78             : {
      79     2515234 :     if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
      80             :     {
      81         154 :         pNd->GetNodes().DeRegisterIndex( *this );
      82         154 :         pNd = rIdx.pNd;
      83         154 :         pNd->GetNodes().RegisterIndex( *this );
      84             :     }
      85             :     else
      86     2515080 :         pNd = rIdx.pNd;
      87     2515234 :     return *this;
      88             : }
      89             : 
      90      548440 : SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
      91             : {
      92      548440 :     if( &pNd->GetNodes() != &rNd.GetNodes() )
      93             :     {
      94           2 :         pNd->GetNodes().DeRegisterIndex( *this );
      95           2 :         pNd = (SwNode*)&rNd;
      96           2 :         pNd->GetNodes().RegisterIndex( *this );
      97             :     }
      98             :     else
      99      548438 :         pNd = (SwNode*)&rNd;
     100      548440 :     return *this;
     101             : }
     102             : 
     103           2 : SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
     104             : {
     105           2 :     if( &pNd->GetNodes() != &rNds )
     106             :     {
     107           2 :         pNd->GetNodes().DeRegisterIndex( *this );
     108           2 :         pNd = rNds[ nIdx ];
     109           2 :         pNd->GetNodes().RegisterIndex( *this );
     110             :     }
     111             :     else
     112           0 :         pNd = rNds[ nIdx ];
     113           2 :     return *this;
     114             : }
     115             : 
     116      101456 : SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
     117             : {
     118      101456 :     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      101456 :         pNd = (SwNode*)&rNd;
     126             : 
     127      101456 :     if( nOffset )
     128      101414 :         pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
     129             : 
     130      101456 :     return *this;
     131         270 : }
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10