LCOV - code coverage report
Current view: top level - sw/source/core/bastyp - ring.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 30 37 81.1 %
Date: 2014-04-11 Functions: 4 6 66.7 %
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 "ring.hxx"
      21             : 
      22      705718 : Ring::Ring( Ring *pObj )
      23             : {
      24      705718 :     if( !pObj )
      25             :     {
      26      705297 :         pNext = this, pPrev = this;
      27             :     }
      28             :     else
      29             :     {
      30         421 :         pNext = pObj;
      31         421 :         pPrev = pObj->pPrev;
      32         421 :         pObj->pPrev = this;
      33         421 :         pPrev->pNext = this;
      34             :     }
      35      705718 : }
      36             : 
      37      707428 : Ring::~Ring()
      38             : {
      39      707428 :     pNext->pPrev = pPrev;
      40      707428 :     pPrev->pNext = pNext;
      41      707428 : }
      42             : 
      43         105 : void Ring::MoveTo(Ring *pDestRing)
      44             : {
      45             :     // delete from "old"
      46         105 :     pNext->pPrev = pPrev;
      47         105 :     pPrev->pNext = pNext;
      48             : 
      49             :     // insert into "new"
      50         105 :     if( pDestRing )
      51             :     {
      52          35 :         pNext = pDestRing;
      53          35 :         pPrev = pDestRing->pPrev;
      54          35 :         pDestRing->pPrev = this;
      55          35 :         pPrev->pNext = this;
      56             :     }
      57             :     else
      58             :     {
      59          70 :         pNext = pPrev = this;
      60             :     }
      61             : 
      62         105 : }
      63             : 
      64           4 : void Ring::MoveRingTo(Ring *pDestRing)
      65             : {
      66             :     // insert the whole ring into DestRing
      67           4 :     Ring* pMyPrev = pPrev;
      68           4 :     Ring* pDestPrev = pDestRing->pPrev;
      69             : 
      70           4 :     pMyPrev->pNext = pDestRing;
      71           4 :     pDestPrev->pNext = this;
      72           4 :     pDestRing->pPrev = pMyPrev;
      73           4 :     pPrev = pDestPrev;
      74           4 : }
      75             : 
      76           0 : sal_uInt32 Ring::numberOf() const
      77             : {
      78           0 :     sal_uInt32 nRet = 1;
      79           0 :     const Ring* pNxt = pNext;
      80           0 :     while( pNxt != this )
      81             :     {
      82           0 :         ++nRet;
      83           0 :         pNxt = pNxt->GetNext();
      84             :     }
      85           0 :     return nRet;
      86             : }
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10