LCOV - code coverage report
Current view: top level - starmath/source - caret.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 16 22 72.7 %
Date: 2014-11-03 Functions: 5 5 100.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             : #include "caret.hxx"
      10             : 
      11             : /////////////////////////////// SmCaretPosGraph
      12             : 
      13         314 : SmCaretPosGraphEntry* SmCaretPosGraphIterator::Next(){
      14         314 :     if(nOffset >= pGraph->nOffset){
      15           6 :         if(pGraph->pNext){
      16           0 :             pGraph = pGraph->pNext;
      17           0 :             nOffset = 0;
      18           0 :             pEntry = Next();
      19             :         }else
      20           6 :             pEntry = NULL;
      21             :     }else
      22         308 :         pEntry = pGraph->Graph + nOffset++;
      23         314 :     return pEntry;
      24             : }
      25             : 
      26         272 : SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){
      27         272 :     if(nOffset >= SmCaretPosGraphSize){
      28           0 :         if(!pNext)
      29           0 :             pNext = new SmCaretPosGraph();
      30           0 :         return pNext->Add(entry);
      31             :     }else{
      32             :         //Set Left and Right to point to the entry itself if they are NULL
      33         272 :         entry.Left = entry.Left ? entry.Left : Graph + nOffset;
      34         272 :         entry.Right = entry.Right ? entry.Right : Graph + nOffset;
      35             :         //Save the entry
      36         272 :         Graph[nOffset] = entry;
      37         272 :         return Graph + nOffset++;
      38             :     }
      39             : }
      40             : 
      41          40 : SmCaretPosGraph::~SmCaretPosGraph(){
      42          40 :     delete pNext;
      43          40 :     pNext = NULL;
      44         112 : }
      45             : 
      46             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10