LCOV - code coverage report
Current view: top level - libreoffice/starmath/source - caret.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 23 69.6 %
Date: 2012-12-27 Functions: 3 3 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             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4             :  *
       5             :  * The contents of this file are subject to the Mozilla Public License Version
       6             :  * 1.1 (the "License"); you may not use this file except in compliance with
       7             :  * the License. You may obtain a copy of the License at
       8             :  * http://www.mozilla.org/MPL/
       9             :  *
      10             :  * Software distributed under the License is distributed on an "AS IS" basis,
      11             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12             :  * for the specific language governing rights and limitations under the
      13             :  * License.
      14             :  *
      15             :  * The Initial Developer of the Original Code is
      16             :  *       Jonas Finnemann Jensen <jopsen@gmail.com>
      17             :  * Portions created by the Initial Developer are Copyright (C) 2010 the
      18             :  * Initial Developer. All Rights Reserved.
      19             :  *
      20             :  * Contributor(s): Jonas Finnemann Jensen <jopsen@gmail.com>
      21             :  *
      22             :  * Alternatively, the contents of this file may be used under the terms of
      23             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26             :  * instead of those above.
      27             :  */
      28             : #include "caret.hxx"
      29             : 
      30             : /////////////////////////////// SmCaretPosGraph ////////////////////////////////
      31             : 
      32         157 : SmCaretPosGraphEntry* SmCaretPosGraphIterator::Next(){
      33         157 :     if(nOffset >= pGraph->nOffset){
      34           3 :         if(pGraph->pNext){
      35           0 :             pGraph = pGraph->pNext;
      36           0 :             nOffset = 0;
      37           0 :             pEntry = Next();
      38             :         }else
      39           3 :             pEntry = NULL;
      40             :     }else
      41         154 :         pEntry = pGraph->Graph + nOffset++;
      42         157 :     return pEntry;
      43             : }
      44             : 
      45         136 : SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){
      46         136 :     if(nOffset >= SmCaretPosGraphSize){
      47           0 :         if(!pNext)
      48           0 :             pNext = new SmCaretPosGraph();
      49           0 :         return pNext->Add(entry);
      50             :     }else{
      51             :         //Set Left and Right to point to the entry itself if they are NULL
      52         136 :         entry.Left = entry.Left ? entry.Left : Graph + nOffset;
      53         136 :         entry.Right = entry.Right ? entry.Right : Graph + nOffset;
      54             :         //Save the entry
      55         136 :         Graph[nOffset] = entry;
      56         136 :         return Graph + nOffset++;
      57             :     }
      58             : }
      59             : 
      60          20 : SmCaretPosGraph::~SmCaretPosGraph(){
      61          20 :     if(pNext)
      62           0 :         delete pNext;
      63          20 :     pNext = NULL;
      64          20 : }
      65             : 
      66             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10