LCOV - code coverage report
Current view: top level - basctl/source/basicide - breakpoint.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 75 0.0 %
Date: 2012-08-25 Functions: 0 15 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 "breakpoint.hxx"
      21                 :            : 
      22                 :            : #include <basic/sbmod.hxx>
      23                 :            : #include <tools/debug.hxx>
      24                 :            : 
      25                 :            : #include <stddef.h>
      26                 :            : 
      27                 :          0 : BreakPointList::BreakPointList()
      28                 :          0 : {}
      29                 :            : 
      30                 :          0 : BreakPointList::BreakPointList(BreakPointList const & rList)
      31                 :            : {
      32                 :          0 :     for (size_t i = 0; i < rList.size(); ++i)
      33                 :          0 :         maBreakPoints.push_back( new BreakPoint(*rList.at( i ) ) );
      34                 :          0 : }
      35                 :            : 
      36                 :          0 : BreakPointList::~BreakPointList()
      37                 :            : {
      38                 :          0 :     reset();
      39                 :          0 : }
      40                 :            : 
      41                 :          0 : void BreakPointList::reset()
      42                 :            : {
      43                 :          0 :     for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
      44                 :          0 :         delete maBreakPoints[ i ];
      45                 :          0 :     maBreakPoints.clear();
      46                 :          0 : }
      47                 :            : 
      48                 :          0 : void BreakPointList::transfer(BreakPointList & rList)
      49                 :            : {
      50                 :          0 :     reset();
      51                 :          0 :     for (size_t i = 0; i < rList.size(); ++i)
      52                 :          0 :         maBreakPoints.push_back( rList.at( i ) );
      53                 :          0 :     rList.clear();
      54                 :          0 : }
      55                 :            : 
      56                 :          0 : void BreakPointList::InsertSorted(BreakPoint* pNewBrk)
      57                 :            : {
      58                 :          0 :     for ( ::std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
      59                 :            :     {
      60                 :          0 :         if ( pNewBrk->nLine <= (*i)->nLine )
      61                 :            :         {
      62                 :            :             DBG_ASSERT( ( (*i)->nLine != pNewBrk->nLine ) || pNewBrk->bTemp, "BreakPoint existiert schon!" );
      63                 :          0 :             maBreakPoints.insert( i, pNewBrk );
      64                 :          0 :             return;
      65                 :            :         }
      66                 :            :     }
      67                 :            :     // no insert position found => LIST_APPEND
      68                 :          0 :     maBreakPoints.push_back( pNewBrk );
      69                 :            : }
      70                 :            : 
      71                 :          0 : void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
      72                 :            : {
      73                 :          0 :     pModule->ClearAllBP();
      74                 :            : 
      75                 :          0 :     for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
      76                 :            :     {
      77                 :          0 :         BreakPoint* pBrk = maBreakPoints[ i ];
      78                 :          0 :         if ( pBrk->bEnabled )
      79                 :          0 :             pModule->SetBP( (sal_uInt16)pBrk->nLine );
      80                 :            :     }
      81                 :          0 : }
      82                 :            : 
      83                 :          0 : BreakPoint* BreakPointList::FindBreakPoint(size_t nLine)
      84                 :            : {
      85                 :          0 :     for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
      86                 :            :     {
      87                 :          0 :         BreakPoint* pBrk = maBreakPoints[ i ];
      88                 :          0 :         if ( pBrk->nLine == nLine )
      89                 :          0 :             return pBrk;
      90                 :            :     }
      91                 :          0 :     return NULL;
      92                 :            : }
      93                 :            : 
      94                 :          0 : void BreakPointList::AdjustBreakPoints(size_t nLine, bool bInserted)
      95                 :            : {
      96                 :          0 :     for ( size_t i = 0; i < maBreakPoints.size(); )
      97                 :            :     {
      98                 :          0 :         BreakPoint* pBrk = maBreakPoints[ i ];
      99                 :          0 :         bool bDelBrk = false;
     100                 :          0 :         if ( pBrk->nLine == nLine )
     101                 :            :         {
     102                 :          0 :             if ( bInserted )
     103                 :          0 :                 pBrk->nLine++;
     104                 :            :             else
     105                 :          0 :                 bDelBrk = true;
     106                 :            :         }
     107                 :          0 :         else if ( pBrk->nLine > nLine )
     108                 :            :         {
     109                 :          0 :             if ( bInserted )
     110                 :          0 :                 pBrk->nLine++;
     111                 :            :             else
     112                 :          0 :                 pBrk->nLine--;
     113                 :            :         }
     114                 :            : 
     115                 :          0 :         if ( bDelBrk )
     116                 :            :         {
     117                 :          0 :             delete remove( pBrk );
     118                 :            :         }
     119                 :            :         else
     120                 :            :         {
     121                 :          0 :             ++i;
     122                 :            :         }
     123                 :            :     }
     124                 :          0 : }
     125                 :            : 
     126                 :          0 : void BreakPointList::ResetHitCount()
     127                 :            : {
     128                 :          0 :     for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
     129                 :            :     {
     130                 :          0 :         BreakPoint* pBrk = maBreakPoints[ i ];
     131                 :          0 :         pBrk->nHitCount = 0;
     132                 :            :     }
     133                 :          0 : }
     134                 :            : 
     135                 :          0 : BreakPoint* BreakPointList::remove(BreakPoint* ptr)
     136                 :            : {
     137                 :          0 :     for ( ::std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
     138                 :            :     {
     139                 :          0 :         if ( ptr == *i )
     140                 :            :         {
     141                 :          0 :             maBreakPoints.erase( i );
     142                 :          0 :             return ptr;
     143                 :            :         }
     144                 :            :     }
     145                 :          0 :     return NULL;
     146                 :            : }
     147                 :            : 
     148                 :          0 : size_t BreakPointList::size() const
     149                 :            : {
     150                 :          0 :     return maBreakPoints.size();
     151                 :            : }
     152                 :            : 
     153                 :          0 : BreakPoint* BreakPointList::at(size_t i)
     154                 :            : {
     155                 :          0 :     return i < maBreakPoints.size() ? maBreakPoints[ i ] : NULL;
     156                 :            : }
     157                 :            : 
     158                 :          0 : const BreakPoint* BreakPointList::at(size_t i) const
     159                 :            : {
     160                 :          0 :     return i < maBreakPoints.size() ? maBreakPoints[ i ] : NULL;
     161                 :            : }
     162                 :            : 
     163                 :          0 : void BreakPointList::clear()
     164                 :            : {
     165                 :          0 :     maBreakPoints.clear();
     166                 :          0 : }
     167                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10