KTextEditor

katerenderrange.h
1/*
2 SPDX-FileCopyrightText: 2003-2005 Hamish Rodda <rodda@kde.org>
3 SPDX-FileCopyrightText: 2008 David Nolden <david.nolden.kdevelop@art-master.de>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KATERENDERRANGE_H
9#define KATERENDERRANGE_H
10
11#include <ktexteditor/attribute.h>
12#include <ktexteditor/range.h>
13
14#include <utility>
15#include <vector>
16
17class NormalRenderRange
18{
19public:
20 void addRange(KTextEditor::Range range, KTextEditor::Attribute::Ptr attribute);
21
22 KTextEditor::Cursor nextBoundary() const;
23 bool advanceTo(const KTextEditor::Cursor pos);
24 KTextEditor::Attribute::Ptr currentAttribute() const;
25
26private:
27 std::vector<std::pair<KTextEditor::Range, KTextEditor::Attribute::Ptr>> m_ranges;
28 KTextEditor::Cursor m_nextBoundary;
29 KTextEditor::Attribute::Ptr m_currentAttribute;
30 size_t m_currentRange = 0;
31};
32
33class RenderRangeVector
34{
35public:
36 KTextEditor::Cursor nextBoundary() const;
37 void advanceTo(const KTextEditor::Cursor pos);
38 bool hasAttribute() const;
39 KTextEditor::Attribute::Ptr generateAttribute() const;
40 NormalRenderRange &pushNewRange();
41 bool isEmpty() const
42 {
43 return m_ranges.empty();
44 }
45 void reserve(size_t size)
46 {
47 m_ranges.reserve(size);
48 }
49
50private:
51 std::vector<NormalRenderRange> m_ranges;
52 KTextEditor::Cursor m_currentPos;
53};
54
55#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
An object representing a section of text, from one Cursor to another.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.