1
/* This file is part of the KDE libraries and the Kate part.
3
* Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
4
* Copyright (C) 2008 David Nolden <david.nolden.kdevelop@art-master.de>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
#ifndef KATERENDERRANGE_H
23
#define KATERENDERRANGE_H
25
#include <ktexteditor/range.h>
26
#include <ktexteditor/attribute.h>
28
#include <QtCore/QStack>
29
#include <QtCore/QList>
30
#include <QtCore/QPair>
33
class RenderRangeList;
38
virtual ~KateRenderRange() {}
39
virtual KTextEditor::Cursor nextBoundary() const = 0;
40
virtual bool advanceTo(const KTextEditor::Cursor& pos) = 0;
41
virtual KTextEditor::Attribute::Ptr currentAttribute() const = 0;
42
virtual bool isReady() const;
45
typedef QPair<KTextEditor::Range*,KTextEditor::Attribute::Ptr> pairRA;
47
class NormalRenderRange : public KateRenderRange
51
virtual ~NormalRenderRange();
53
void addRange(KTextEditor::Range* range, KTextEditor::Attribute::Ptr attribute);
55
virtual KTextEditor::Cursor nextBoundary() const;
56
virtual bool advanceTo(const KTextEditor::Cursor& pos);
57
virtual KTextEditor::Attribute::Ptr currentAttribute() const;
60
QList<pairRA> m_ranges;
61
KTextEditor::Cursor m_nextBoundary;
62
KTextEditor::Attribute::Ptr m_currentAttribute;
66
class RenderRangeList : public QList<KateRenderRange*>
70
KTextEditor::Cursor nextBoundary() const;
71
void advanceTo(const KTextEditor::Cursor& pos);
72
bool hasAttribute() const;
73
KTextEditor::Attribute::Ptr generateAttribute() const;
76
KTextEditor::Cursor m_currentPos;