Branch data 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 : 0 : SmCaretPosGraphEntry* SmCaretPosGraphIterator::Next(){
33 [ # # ]: 0 : if(nOffset >= pGraph->nOffset){
34 [ # # ]: 0 : if(pGraph->pNext){
35 : 0 : pGraph = pGraph->pNext;
36 : 0 : nOffset = 0;
37 : 0 : pEntry = Next();
38 : : }else
39 : 0 : pEntry = NULL;
40 : : }else
41 : 0 : pEntry = pGraph->Graph + nOffset++;
42 : 0 : return pEntry;
43 : : }
44 : :
45 : 0 : SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){
46 [ # # ]: 0 : 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 [ # # ]: 0 : entry.Left = entry.Left ? entry.Left : Graph + nOffset;
53 [ # # ]: 0 : entry.Right = entry.Right ? entry.Right : Graph + nOffset;
54 : : //Save the entry
55 : 0 : Graph[nOffset] = entry;
56 : 0 : return Graph + nOffset++;
57 : : }
58 : : }
59 : :
60 : 0 : SmCaretPosGraph::~SmCaretPosGraph(){
61 [ # # ]: 0 : if(pNext)
62 [ # # ]: 0 : delete pNext;
63 : 0 : pNext = NULL;
64 : 0 : }
65 : :
66 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|