LCOV - code coverage report
Current view: top level - sw/source/core/bastyp - ring.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 37 0.0 %
Date: 2014-04-14 Functions: 0 6 0.0 %
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           0 : Ring::Ring( Ring *pObj )
      23             : {
      24           0 :     if( !pObj )
      25             :     {
      26           0 :         pNext = this, pPrev = this;
      27             :     }
      28             :     else
      29             :     {
      30           0 :         pNext = pObj;
      31           0 :         pPrev = pObj->pPrev;
      32           0 :         pObj->pPrev = this;
      33           0 :         pPrev->pNext = this;
      34             :     }
      35           0 : }
      36             : 
      37           0 : Ring::~Ring()
      38             : {
      39           0 :     pNext->pPrev = pPrev;
      40           0 :     pPrev->pNext = pNext;
      41           0 : }
      42             : 
      43           0 : void Ring::MoveTo(Ring *pDestRing)
      44             : {
      45             :     // delete from "old"
      46           0 :     pNext->pPrev = pPrev;
      47           0 :     pPrev->pNext = pNext;
      48             : 
      49             :     // insert into "new"
      50           0 :     if( pDestRing )
      51             :     {
      52           0 :         pNext = pDestRing;
      53           0 :         pPrev = pDestRing->pPrev;
      54           0 :         pDestRing->pPrev = this;
      55           0 :         pPrev->pNext = this;
      56             :     }
      57             :     else
      58             :     {
      59           0 :         pNext = pPrev = this;
      60             :     }
      61             : 
      62           0 : }
      63             : 
      64           0 : void Ring::MoveRingTo(Ring *pDestRing)
      65             : {
      66             :     // insert the whole ring into DestRing
      67           0 :     Ring* pMyPrev = pPrev;
      68           0 :     Ring* pDestPrev = pDestRing->pPrev;
      69             : 
      70           0 :     pMyPrev->pNext = pDestRing;
      71           0 :     pDestPrev->pNext = this;
      72           0 :     pDestRing->pPrev = pMyPrev;
      73           0 :     pPrev = pDestPrev;
      74           0 : }
      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