• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katerenderrange.h

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

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal