Kate
katerenderrange.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org> 00004 * Copyright (C) 2008 David Nolden <david.nolden.kdevelop@art-master.de> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KATERENDERRANGE_H 00023 #define KATERENDERRANGE_H 00024 00025 #include <ktexteditor/range.h> 00026 #include <ktexteditor/attribute.h> 00027 00028 #include <QtCore/QStack> 00029 #include <QtCore/QList> 00030 #include <QtCore/QPair> 00031 00032 class KateView; 00033 class RenderRangeList; 00034 00035 class KateRenderRange 00036 { 00037 public: 00038 virtual ~KateRenderRange() {} 00039 virtual KTextEditor::Cursor nextBoundary() const = 0; 00040 virtual bool advanceTo(const KTextEditor::Cursor& pos) = 0; 00041 virtual KTextEditor::Attribute::Ptr currentAttribute() const = 0; 00042 virtual bool isReady() const; 00043 }; 00044 00045 typedef QPair<KTextEditor::Range*,KTextEditor::Attribute::Ptr> pairRA; 00046 00047 class NormalRenderRange : public KateRenderRange 00048 { 00049 public: 00050 NormalRenderRange(); 00051 virtual ~NormalRenderRange(); 00052 00053 void addRange(KTextEditor::Range* range, KTextEditor::Attribute::Ptr attribute); 00054 00055 virtual KTextEditor::Cursor nextBoundary() const; 00056 virtual bool advanceTo(const KTextEditor::Cursor& pos); 00057 virtual KTextEditor::Attribute::Ptr currentAttribute() const; 00058 00059 private: 00060 QList<pairRA> m_ranges; 00061 KTextEditor::Cursor m_nextBoundary; 00062 KTextEditor::Attribute::Ptr m_currentAttribute; 00063 int m_currentRange; 00064 }; 00065 00066 class RenderRangeList : public QList<KateRenderRange*> 00067 { 00068 public: 00069 ~RenderRangeList(); 00070 KTextEditor::Cursor nextBoundary() const; 00071 void advanceTo(const KTextEditor::Cursor& pos); 00072 bool hasAttribute() const; 00073 KTextEditor::Attribute::Ptr generateAttribute() const; 00074 00075 private: 00076 KTextEditor::Cursor m_currentPos; 00077 }; 00078 00079 #endif
KDE 4.6 API Reference