Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / starmath / source / caret.cxx
blob87cb1153cdd42109baf67f9c280542b9b623d212
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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>
11 #include <o3tl/make_unique.hxx>
13 SmCaretPosGraph::SmCaretPosGraph() = default;
15 SmCaretPosGraph::~SmCaretPosGraph() = default;
17 SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPos pos,
18 SmCaretPosGraphEntry* left)
20 assert(pos.nIndex >= 0);
21 auto entry = o3tl::make_unique<SmCaretPosGraphEntry>(pos, left, nullptr);
22 SmCaretPosGraphEntry* e = entry.get();
23 //Set Left and Right to point to the entry itself if they are NULL
24 entry->Left = entry->Left ? entry->Left : e;
25 entry->Right = entry->Right ? entry->Right : e;
26 mvEntries.push_back(std::move(entry));
27 return e;
30 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */