Kate
kateindentscript.h
Go to the documentation of this file.
00001 // This file is part of the KDE libraries 00002 // Copyright (C) 2008 Paul Giannaros <paul@giannaros.org> 00003 // Copyright (C) 2009 Dominik Haumann <dhaumann kde org> 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Library General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2 of the License, or (at your option) version 3. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Library General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Library General Public License 00016 // along with this library; see the file COPYING.LIB. If not, write to 00017 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 // Boston, MA 02110-1301, USA. 00019 00020 #ifndef KATE_INDENT_SCRIPT_H 00021 #define KATE_INDENT_SCRIPT_H 00022 00023 #include "katescript.h" 00024 #include "kateview.h" 00025 00026 #include <QtCore/QPair> 00027 00028 class KateScriptDocument; 00029 00030 class KateIndentScriptHeader 00031 { 00032 public: 00033 KateIndentScriptHeader() : m_priority(0) 00034 {} 00035 00036 inline void setName(const QString& name) 00037 { m_name = name; } 00038 inline const QString& name() const 00039 { return m_name; } 00040 00041 inline void setRequiredStyle(const QString& requiredStyle) 00042 { m_requiredStyle = requiredStyle; } 00043 inline const QString& requiredStyle() const 00044 { return m_requiredStyle; } 00045 00046 inline void setIndentLanguages(const QStringList& indentLanguages) 00047 { m_indentLanguages = indentLanguages; } 00048 inline const QStringList& indentLanguages() const 00049 { return m_indentLanguages; } 00050 00051 inline void setPriority(int priority) 00052 { m_priority = priority; } 00053 inline int priority() const 00054 { return m_priority; } 00055 00056 inline void setBaseName(const QString& baseName) 00057 { m_baseName = baseName; } 00058 inline const QString& baseName() const 00059 { return m_baseName; } 00060 00061 private: 00062 QString m_name; 00063 00069 QString m_requiredStyle; 00075 QStringList m_indentLanguages; 00081 int m_priority; 00082 00086 QString m_baseName; 00087 }; 00088 00089 00094 class KateIndentScript : public KateScript 00095 { 00096 public: 00097 KateIndentScript(const QString &url, const KateIndentScriptHeader &header); 00098 00099 const QString &triggerCharacters(); 00100 00101 const KateIndentScriptHeader& indentHeader() const; 00102 00107 QPair<int, int> indent(KateView* view, const KTextEditor::Cursor& position, 00108 QChar typedCharacter, int indentWidth); 00109 00110 private: 00111 QString m_triggerCharacters; 00112 bool m_triggerCharactersSet; 00113 KateIndentScriptHeader m_indentHeader; 00114 }; 00115 00116 00117 #endif 00118 00119 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference