summaryrefslogtreecommitdiffstats
path: root/kate/part/kateindentscriptabstracts.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kate/part/kateindentscriptabstracts.h
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/part/kateindentscriptabstracts.h')
-rw-r--r--kate/part/kateindentscriptabstracts.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/kate/part/kateindentscriptabstracts.h b/kate/part/kateindentscriptabstracts.h
new file mode 100644
index 000000000..a47a8431a
--- /dev/null
+++ b/kate/part/kateindentscriptabstracts.h
@@ -0,0 +1,99 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2005 Joseph Wenninger <jowenn@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _KATEINDENTSCRIPTABSTRACTS_H_
+#define _KATEINDENTSCRIPTABSTRACTS_H_
+
+#include <qstring.h>
+#include <kdebug.h>
+
+namespace Kate {
+ class View;
+}
+
+class KateDocCursor;
+
+
+class KateIndentScriptImplAbstract {
+ public:
+ friend class KateIndentScript;
+ KateIndentScriptImplAbstract(const QString& internalName,
+ const QString &filePath, const QString &niceName,
+ const QString &copyright, double version);
+ virtual ~KateIndentScriptImplAbstract();
+
+ virtual bool processChar( class Kate::View *view, QChar c, QString &errorMsg )=0;
+ virtual bool processLine( class Kate::View *view, const KateDocCursor &line, QString &errorMsg )=0;
+ virtual bool processNewline( class Kate::View *view, const KateDocCursor &begin, bool needcontinue, QString &errorMsg )=0;
+ protected:
+ virtual void decRef();
+ long refCount() {return m_refcount;}
+ QString filePath() const {return m_filePath;}
+ private:
+ void incRef();
+ long m_refcount;
+ QString m_internalName;
+ QString m_filePath;
+ QString m_niceName;
+ QString m_copyright;
+ double m_version;
+};
+
+
+class KateIndentScript {
+ public:
+ KateIndentScript(KateIndentScriptImplAbstract *scr):m_scr(scr) { if (scr) scr->incRef(); }
+ ~KateIndentScript() {if (m_scr) m_scr->decRef();}
+ KateIndentScript():m_scr(0) {}
+ KateIndentScript(const KateIndentScript &p):m_scr(p.m_scr){if (m_scr) m_scr->incRef();}
+ KateIndentScript &operator=(const KateIndentScript &p) {
+ if (m_scr==p.m_scr) return *this;
+ if (m_scr) m_scr->decRef();
+ m_scr=p.m_scr;
+ if (m_scr) m_scr->incRef();
+ return *this;
+ }
+ /*operator KateIndentJScript*() const { return m_scr; }*/
+ bool processChar( class Kate::View *view, QChar c, QString &errorMsg ) {
+ kdDebug(13050)<<"KateIndentScript::processChar: m_scr:"<<m_scr<<endl;
+ if (m_scr) return m_scr->processChar(view,c,errorMsg); else return true;
+ }
+ bool processLine( class Kate::View *view, const KateDocCursor& line, QString &errorMsg ) {
+ kdDebug(13050)<<"KateIndentScript::processLine: m_scr:"<<m_scr<<endl;
+ if (m_scr) return m_scr->processLine(view,line,errorMsg); else return true;
+ }
+ bool processNewline( class Kate::View *view, const KateDocCursor& begin, bool needcontinue, QString &errorMsg ) {
+ kdDebug(13050)<<"KateIndentScript::processNewLine: m_scr:"<<m_scr<<endl;
+ if (m_scr) return m_scr->processNewline(view,begin,needcontinue,errorMsg); else return true;
+ }
+
+ bool isNull () const {return (m_scr==0);}
+ private:
+ KateIndentScriptImplAbstract *m_scr;
+};
+
+class KateIndentScriptManagerAbstract
+{
+
+ public:
+ KateIndentScriptManagerAbstract () {};
+ virtual ~KateIndentScriptManagerAbstract () {};
+ virtual KateIndentScript script(const QString &scriptname)=0;
+};
+
+#endif