~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to part/render/katerenderrange.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  This file is part of the KDE libraries and the Kate part.
2
 
 *
3
 
 *  Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
4
 
 *  Copyright (C) 2008 David Nolden <david.nolden.kdevelop@art-master.de>
5
 
 *
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.
10
 
 *
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.
15
 
 *
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.
20
 
 */
21
 
 
22
 
#ifndef KATERENDERRANGE_H
23
 
#define KATERENDERRANGE_H
24
 
 
25
 
#include <ktexteditor/range.h>
26
 
#include <ktexteditor/attribute.h>
27
 
 
28
 
#include <QtCore/QStack>
29
 
#include <QtCore/QList>
30
 
#include <QtCore/QPair>
31
 
 
32
 
class KateView;
33
 
class RenderRangeList;
34
 
 
35
 
class KateRenderRange
36
 
{
37
 
  public:
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;
43
 
};
44
 
 
45
 
typedef QPair<KTextEditor::Range*,KTextEditor::Attribute::Ptr> pairRA;
46
 
 
47
 
class NormalRenderRange : public KateRenderRange
48
 
{
49
 
  public:
50
 
    NormalRenderRange();
51
 
    virtual ~NormalRenderRange();
52
 
 
53
 
    void addRange(KTextEditor::Range* range, KTextEditor::Attribute::Ptr attribute);
54
 
 
55
 
    virtual KTextEditor::Cursor nextBoundary() const;
56
 
    virtual bool advanceTo(const KTextEditor::Cursor& pos);
57
 
    virtual KTextEditor::Attribute::Ptr currentAttribute() const;
58
 
 
59
 
  private:
60
 
    QList<pairRA> m_ranges;
61
 
    KTextEditor::Cursor m_nextBoundary;
62
 
    KTextEditor::Attribute::Ptr m_currentAttribute;
63
 
    int m_currentRange;
64
 
};
65
 
 
66
 
class RenderRangeList : public QList<KateRenderRange*>
67
 
{
68
 
  public:
69
 
    ~RenderRangeList();
70
 
    KTextEditor::Cursor nextBoundary() const;
71
 
    void advanceTo(const KTextEditor::Cursor& pos);
72
 
    bool hasAttribute() const;
73
 
    KTextEditor::Attribute::Ptr generateAttribute() const;
74
 
 
75
 
  private:
76
 
    KTextEditor::Cursor m_currentPos;
77
 
};
78
 
 
79
 
#endif