summaryrefslogtreecommitdiffstats
path: root/lib/interfaces
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
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /lib/interfaces
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/interfaces')
-rw-r--r--lib/interfaces/KDevCoreIface.cpp59
-rw-r--r--lib/interfaces/KDevCoreIface.h51
-rw-r--r--lib/interfaces/KDevPartControllerIface.cpp95
-rw-r--r--lib/interfaces/KDevPartControllerIface.h63
-rw-r--r--lib/interfaces/Mainpage.dox10
-rw-r--r--lib/interfaces/Makefile.am40
-rw-r--r--lib/interfaces/codemodel.cpp1823
-rw-r--r--lib/interfaces/codemodel.h1612
-rw-r--r--lib/interfaces/codemodel_treeparser.cpp108
-rw-r--r--lib/interfaces/codemodel_treeparser.h85
-rw-r--r--lib/interfaces/codemodel_utils.cpp747
-rw-r--r--lib/interfaces/codemodel_utils.h570
-rw-r--r--lib/interfaces/extensions/Mainpage.dox61
-rw-r--r--lib/interfaces/extensions/Makefile.am23
-rw-r--r--lib/interfaces/extensions/codebrowserfrontend.h40
-rw-r--r--lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp76
-rw-r--r--lib/interfaces/extensions/dcop/KDevAppFrontendIface.h52
-rw-r--r--lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp46
-rw-r--r--lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h45
-rw-r--r--lib/interfaces/extensions/dcop/Makefile.am10
-rw-r--r--lib/interfaces/extensions/kdevappfrontend.cpp2
-rw-r--r--lib/interfaces/extensions/kdevappfrontend.h115
-rw-r--r--lib/interfaces/extensions/kdevcreatefile.h146
-rw-r--r--lib/interfaces/extensions/kdevdifffrontend.cpp33
-rw-r--r--lib/interfaces/extensions/kdevdifffrontend.h79
-rw-r--r--lib/interfaces/extensions/kdevelopappfrontend.desktop38
-rw-r--r--lib/interfaces/extensions/kdevelopcodebrowserfrontend.desktop28
-rw-r--r--lib/interfaces/extensions/kdevelopcreatefile.desktop38
-rw-r--r--lib/interfaces/extensions/kdevelopdifffrontend.desktop41
-rw-r--r--lib/interfaces/extensions/kdevelopmakefrontend.desktop41
-rw-r--r--lib/interfaces/extensions/kdevelopquickopen.desktop58
-rw-r--r--lib/interfaces/extensions/kdevelopsourceformatter.desktop39
-rw-r--r--lib/interfaces/extensions/kdevelopversioncontrol.desktop40
-rw-r--r--lib/interfaces/extensions/kdevmakefrontend.cpp2
-rw-r--r--lib/interfaces/extensions/kdevmakefrontend.h106
-rw-r--r--lib/interfaces/extensions/kdevquickopen.h130
-rw-r--r--lib/interfaces/extensions/kdevsourceformatter.h69
-rw-r--r--lib/interfaces/extensions/kdevversioncontrol.h237
-rw-r--r--lib/interfaces/external/Mainpage.dox57
-rw-r--r--lib/interfaces/external/Makefile.am15
-rw-r--r--lib/interfaces/external/designer.cpp30
-rw-r--r--lib/interfaces/external/designer.h98
-rw-r--r--lib/interfaces/extras/Mainpage.dox11
-rw-r--r--lib/interfaces/extras/Makefile.am18
-rw-r--r--lib/interfaces/extras/kdevcompileroptions.cpp6
-rw-r--r--lib/interfaces/extras/kdevcompileroptions.h90
-rw-r--r--lib/interfaces/extras/kdevelopcompileroptions.desktop48
-rw-r--r--lib/interfaces/extras/kdevelopvcsintegrator.desktop45
-rw-r--r--lib/interfaces/extras/kdevvcsintegrator.cpp26
-rw-r--r--lib/interfaces/extras/kdevvcsintegrator.h76
-rw-r--r--lib/interfaces/hashedstring.cpp362
-rw-r--r--lib/interfaces/hashedstring.h155
-rw-r--r--lib/interfaces/katedocumentmanagerinterface.cpp104
-rw-r--r--lib/interfaces/katedocumentmanagerinterface.h58
-rw-r--r--lib/interfaces/kdevapi.cpp93
-rw-r--r--lib/interfaces/kdevapi.h103
-rw-r--r--lib/interfaces/kdevcoderepository.cpp71
-rw-r--r--lib/interfaces/kdevcoderepository.h94
-rw-r--r--lib/interfaces/kdevcore.cpp298
-rw-r--r--lib/interfaces/kdevcore.h387
-rw-r--r--lib/interfaces/kdevdesignerintegration.cpp40
-rw-r--r--lib/interfaces/kdevdesignerintegration.h97
-rw-r--r--lib/interfaces/kdevdesignerintegrationiface.cpp63
-rw-r--r--lib/interfaces/kdevdesignerintegrationiface.h49
-rw-r--r--lib/interfaces/kdeveloplanguagesupport.desktop41
-rw-r--r--lib/interfaces/kdevelopplugin.desktop75
-rw-r--r--lib/interfaces/kdevelopproject.desktop40
-rw-r--r--lib/interfaces/kdevgenericfactory.h91
-rw-r--r--lib/interfaces/kdevlanguagesupport.cpp166
-rw-r--r--lib/interfaces/kdevlanguagesupport.h260
-rw-r--r--lib/interfaces/kdevmainwindow.cpp28
-rw-r--r--lib/interfaces/kdevmainwindow.h101
-rw-r--r--lib/interfaces/kdevpartcontroller.cpp30
-rw-r--r--lib/interfaces/kdevpartcontroller.h175
-rw-r--r--lib/interfaces/kdevplugin.cpp139
-rw-r--r--lib/interfaces/kdevplugin.h200
-rw-r--r--lib/interfaces/kdevplugincontroller.cpp49
-rw-r--r--lib/interfaces/kdevplugincontroller.h118
-rw-r--r--lib/interfaces/kdevplugininfo.cpp181
-rw-r--r--lib/interfaces/kdevplugininfo.h111
-rw-r--r--lib/interfaces/kdevproject.cpp164
-rw-r--r--lib/interfaces/kdevproject.h218
-rw-r--r--lib/interfaces/kdevprojectiface.cpp186
-rw-r--r--lib/interfaces/kdevprojectiface.h81
84 files changed, 11806 insertions, 0 deletions
diff --git a/lib/interfaces/KDevCoreIface.cpp b/lib/interfaces/KDevCoreIface.cpp
new file mode 100644
index 00000000..e2e53346
--- /dev/null
+++ b/lib/interfaces/KDevCoreIface.cpp
@@ -0,0 +1,59 @@
+
+
+/* This file is part of the KDE project
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <kdebug.h>
+#include <dcopclient.h>
+#include "KDevCoreIface.h"
+#include "kdevcore.h"
+
+
+KDevCoreIface::KDevCoreIface(KDevCore *core)
+ : QObject(core), DCOPObject("KDevCore"), m_core(core)
+{
+ connect( m_core, SIGNAL(projectOpened()), this, SLOT(forwardProjectOpened()) );
+ connect( m_core, SIGNAL(projectClosed()), this, SLOT(forwardProjectClosed()) );
+}
+
+
+KDevCoreIface::~KDevCoreIface()
+{}
+
+
+void KDevCoreIface::forwardProjectOpened()
+{
+ kdDebug(9000) << "dcop emitting project opened" << endl;
+ emitDCOPSignal("projectOpened()", QByteArray());
+}
+
+
+void KDevCoreIface::forwardProjectClosed()
+{
+ kdDebug(9000) << "dcop emitting project closed" << endl;
+ emitDCOPSignal("projectClosed()", QByteArray());
+}
+
+void KDevCoreIface::openProject( const QString & projectFileName )
+{
+ m_core->openProject(projectFileName);
+}
+
+#include "KDevCoreIface.moc"
diff --git a/lib/interfaces/KDevCoreIface.h b/lib/interfaces/KDevCoreIface.h
new file mode 100644
index 00000000..5bf5b0ab
--- /dev/null
+++ b/lib/interfaces/KDevCoreIface.h
@@ -0,0 +1,51 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef _KDEVCOREIFACE_H_
+#define _KDEVCOREIFACE_H_
+
+#include <dcopobject.h>
+#include <dcopref.h>
+
+class KDevCore;
+
+
+class KDevCoreIface : public QObject, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+
+public:
+
+ KDevCoreIface( KDevCore *core );
+ ~KDevCoreIface();
+
+k_dcop:
+ void openProject(const QString& projectFileName);
+
+private slots:
+ void forwardProjectOpened();
+ void forwardProjectClosed();
+
+private:
+ KDevCore *m_core;
+};
+
+#endif
diff --git a/lib/interfaces/KDevPartControllerIface.cpp b/lib/interfaces/KDevPartControllerIface.cpp
new file mode 100644
index 00000000..be6564d4
--- /dev/null
+++ b/lib/interfaces/KDevPartControllerIface.cpp
@@ -0,0 +1,95 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <kdebug.h>
+#include <dcopclient.h>
+#include <kurl.h>
+
+
+#include "KDevPartControllerIface.h"
+#include "kdevpartcontroller.h"
+
+
+KDevPartControllerIface::KDevPartControllerIface(KDevPartController *pc)
+ : QObject(pc), DCOPObject("KDevPartController"), m_controller(pc)
+{
+ connect(pc, SIGNAL(loadedFile(const KURL &)), this, SLOT(forwardLoadedFile(const KURL &)));
+ connect(pc, SIGNAL(savedFile(const KURL &)), this, SLOT(forwardSavedFile(const KURL &)));
+ connect(pc, SIGNAL(closedFile(const KURL &)), this, SLOT(forwardClosedFile(const KURL &)));
+}
+
+
+KDevPartControllerIface::~KDevPartControllerIface()
+{
+}
+
+
+void KDevPartControllerIface::editDocument(const QString &url, int lineNum)
+{
+ m_controller->editDocument(KURL(url), lineNum);
+}
+
+
+void KDevPartControllerIface::showDocument(const QString &url, bool newWin)
+{
+ m_controller->showDocument(KURL(url), newWin);
+}
+
+
+void KDevPartControllerIface::saveAllFiles()
+{
+ m_controller->saveAllFiles();
+}
+
+
+void KDevPartControllerIface::revertAllFiles()
+{
+ m_controller->revertAllFiles();
+}
+
+
+void KDevPartControllerIface::forwardLoadedFile(const KURL &fileName)
+{
+ kdDebug(9000) << "dcop emitting loadedFile " << fileName << endl;
+ emitDCOPSignal("projectOpened()", QByteArray());
+}
+
+
+void KDevPartControllerIface::forwardSavedFile(const KURL &fileName)
+{
+ kdDebug(9000) << "dcop emitting savedFile " << fileName << endl;
+ emitDCOPSignal("projectClosed()", QByteArray());
+}
+
+void KDevPartControllerIface::forwardClosedFile(const KURL &fileName)
+{
+ kdDebug(9000) << "dcop emitting closedFile " << fileName << endl;
+ emitDCOPSignal("projectClosed()", QByteArray());
+}
+
+bool KDevPartControllerIface::closeAllFiles( )
+{
+ return m_controller->closeAllFiles();
+}
+
+uint KDevPartControllerIface::documentState( const KURL & url )
+{
+ return (uint) m_controller->documentState(url);
+}
+
+#include "KDevPartControllerIface.moc"
diff --git a/lib/interfaces/KDevPartControllerIface.h b/lib/interfaces/KDevPartControllerIface.h
new file mode 100644
index 00000000..90de786a
--- /dev/null
+++ b/lib/interfaces/KDevPartControllerIface.h
@@ -0,0 +1,63 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef _KDEVPARTCONTROLLERIFACE_H_
+#define _KDEVPARTCONTROLLERIFACE_H_
+
+#include <dcopobject.h>
+#include <dcopref.h>
+#include <kurl.h>
+
+class KDevPartController;
+
+class KDevPartControllerIface : public QObject, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+
+public:
+
+ KDevPartControllerIface(KDevPartController *pc);
+ ~KDevPartControllerIface();
+
+
+k_dcop:
+
+ void editDocument(const QString &url, int lineNum);
+ void showDocument(const QString &url, bool newWin);
+
+ void saveAllFiles();
+ void revertAllFiles();
+
+ bool closeAllFiles();
+ uint documentState( const KURL & url );
+
+private slots:
+
+ void forwardLoadedFile(const KURL &fileName);
+ void forwardSavedFile(const KURL &fileName);
+ void forwardClosedFile(const KURL &fileName);
+
+private:
+
+ KDevPartController *m_controller;
+
+};
+
+
+#endif
diff --git a/lib/interfaces/Mainpage.dox b/lib/interfaces/Mainpage.dox
new file mode 100644
index 00000000..2b4d818a
--- /dev/null
+++ b/lib/interfaces/Mainpage.dox
@@ -0,0 +1,10 @@
+/**
+@mainpage The KDevelop Interfaces Library
+
+This library contains all interfaces and classes that form KDevelop plugin architecture.
+
+<b>Link with</b>: -lkdevelop
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/interfaces
+*/
+
diff --git a/lib/interfaces/Makefile.am b/lib/interfaces/Makefile.am
new file mode 100644
index 00000000..6b171b10
--- /dev/null
+++ b/lib/interfaces/Makefile.am
@@ -0,0 +1,40 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/cppparser \
+ $(all_includes)
+
+noinst_LTLIBRARIES = libkdevinterfaces.la
+
+libkdevinterfaces_la_SOURCES = kdevcore.cpp kdevproject.cpp \
+ kdevlanguagesupport.cpp kdevpartcontroller.cpp kdevapi.cpp KDevCoreIface.skel \
+ kdevmainwindow.cpp KDevPartControllerIface.skel kdevplugin.cpp kdevcoderepository.cpp \
+ codemodel.cpp codemodel_treeparser.cpp codemodel_utils.cpp \
+ kdevdesignerintegration.cpp kdevplugincontroller.cpp kdevplugininfo.cpp KDevCoreIface.cpp \
+ KDevPartControllerIface.cpp katedocumentmanagerinterface.cpp katedocumentmanagerinterface.skel \
+ kdevprojectiface.cpp kdevprojectiface.skel kdevdesignerintegrationiface.cpp \
+ kdevdesignerintegrationiface.skel hashedstring.cpp
+libkdevinterfaces_la_LDFLAGS = -no-undefined $(all_libraries)
+libkdevinterfaces_la_LIBADD = $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la \
+ $(top_builddir)/lib/util/libkdevutil.la \
+ $(LIB_KDEUI) $(LIB_KHTML) $(LIB_KPARTS) -lktexteditor -lkscript -lDCOP
+
+kdevelopincludedir = $(includedir)/kdevelop/interfaces
+kdevelopinclude_HEADERS = kdevlanguagesupport.h kdevmainwindow.h \
+ kdevpartcontroller.h kdevplugin.h kdevproject.h kdevcore.h kdevcoderepository.h codemodel.h \
+ codemodel_utils.h codemodel_treeparser.h kdevgenericfactory.h kdevapi.h \
+ kdevdesignerintegration.h kdevplugincontroller.h kdevplugininfo.h KDevCoreIface.h \
+ KDevPartControllerIface.h katedocumentmanagerinterface.h \
+ hashedstring.h
+
+
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = kdevelopproject.desktop kdeveloplanguagesupport.desktop \
+ kdevelopplugin.desktop
+
+METASOURCES = AUTO
+
+SUBDIRS = extensions external extras
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions
+DOXYGEN_PROJECTNAME = KDevelop Interfaces Library
+DOXYGEN_DOCDIRPREFIX = kdev
+include ../../Doxyfile.am
+noinst_HEADERS = kdevprojectiface.h kdevdesignerintegrationiface.h
diff --git a/lib/interfaces/codemodel.cpp b/lib/interfaces/codemodel.cpp
new file mode 100644
index 00000000..567f785a
--- /dev/null
+++ b/lib/interfaces/codemodel.cpp
@@ -0,0 +1,1823 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "codemodel.h"
+#include "driver.h"
+#include <kdebug.h>
+#include <kdatastream.h>
+
+///Little helper-functions to save a lot of typing and possible errors
+template<class MapContainer>
+bool eachCanUpdate( const MapContainer& old, const MapContainer& newMap ) {
+ if( old.size() != newMap.size() ) return false;
+
+ typename MapContainer::const_iterator oldIt = old.begin();
+ typename MapContainer::const_iterator newIt = newMap.begin();
+ while( oldIt != old.end() ) {
+ typedef typename MapContainer::mapped_type ListType;
+ if( (*oldIt).size() != (*newIt).size() ) return false;
+ typename ListType::const_iterator it1 = (*oldIt).begin();
+ typename ListType::const_iterator it2 = (*newIt).begin();
+
+ while( it1 != (*oldIt).end() ) {
+ if( !(*it1)->canUpdate( *it2 ) ) return false;
+ ++it1;
+ ++it2;
+ }
+ ++oldIt;
+ ++newIt;
+ }
+ return true;
+}
+
+template<class MapContainer>
+void eachUpdate( MapContainer& old, const MapContainer& newMap ) {
+ if( old.size() != newMap.size() ) kdError( 9007 ) << "error in eachUpdate(...) 1" << endl;
+ typename MapContainer::iterator oldIt = old.begin();
+ typename MapContainer::const_iterator newIt = newMap.begin();
+ while( oldIt != old.end() ) {
+ if( (*oldIt).size() != (*newIt).size() ) kdError( 9007 ) << "error in eachUpdate(...) 2" << endl;
+ typedef typename MapContainer::mapped_type ListType;
+ typename ListType::iterator it1 = (*oldIt).begin();
+ typename ListType::const_iterator it2 = (*newIt).begin();
+ while( it1 != (*oldIt).end() ) {
+ (*it1)->update( *it2 );
+ ++it1;
+ ++it2;
+ }
+ ++oldIt;
+ ++newIt;
+ }
+}
+
+///Versions for contains that do not contain maps again
+template<class MapContainer>
+bool eachCanUpdateSingle( const MapContainer& old, const MapContainer& newMap ) {
+ if( old.size() != newMap.size() ) return false;
+
+ typename MapContainer::const_iterator oldIt = old.begin();
+ typename MapContainer::const_iterator newIt = newMap.begin();
+ while( oldIt != old.end() ) {
+ if( !(*oldIt)->canUpdate( *newIt ) ) return false;
+ ++oldIt;
+ ++newIt;
+ }
+ return true;
+}
+
+template<class MapContainer>
+void eachUpdateSingle( MapContainer& old, const MapContainer& newMap ) {
+ if( old.size() != newMap.size() ) kdError( 9007 ) << "error in eachUpdate(...) 1" << endl;
+ typename MapContainer::iterator oldIt = old.begin();
+ typename MapContainer::const_iterator newIt = newMap.begin();
+ while( oldIt != old.end() ) {
+ (*oldIt)->update( *newIt );
+ ++oldIt;
+ ++newIt;
+ }
+}
+
+CodeModel::CodeModel()
+{
+ wipeout();
+ m_currentGroupId = 1; ///0 stands for invalid group
+}
+
+CodeModel::~ CodeModel( )
+{
+}
+
+int CodeModel::newGroupId() {
+ return (m_currentGroupId++) * 2;
+}
+
+inline bool isSingleGroup( const int group ) {
+ return (group % 2) == 0;
+}
+
+QStringList CodeModel::getGroupStrings(int gid) const {
+ QStringList ret;
+ for(QMap<QString, FileDom>::ConstIterator it = m_files.begin(); it != m_files.end(); ++it) {
+ if((*it)->groupId() == gid) ret.append( (*it)-> name() );
+ }
+ return ret;
+}
+
+
+FileList CodeModel::getGroup(int gid) const {
+ FileList ret;
+ for(QMap<QString, FileDom>::ConstIterator it = m_files.begin(); it != m_files.end(); ++it) {
+ if((*it)->groupId() == gid) ret.append(*it);
+ }
+ return ret;
+}
+
+FileList CodeModel::getGroup( const FileDom& dom) const {
+ return getGroup( dom->groupId() );
+}
+
+int CodeModel::mergeGroups( int g1, int g2) {
+ if( !g1 || !g2 ) return 0;
+ if( g1 == g2 ) return g1;
+ int ng = isSingleGroup( g1 ) ? g2 : g1;
+ if( isSingleGroup( ng ) )
+ ng = newGroupId() + 1;
+
+ for( QMap<QString, FileDom>::iterator it = m_files.begin(); it != m_files.end(); ++it ) {
+ if( (*it)->groupId() == g2 || (*it)->groupId() == g1 ) (*it)->setGroupId( ng );
+ }
+ return ng;
+}
+
+template<class Type> static void dumpMap( std::ostream& file, QMap<QString, Type>& map ) {
+ typename QMap<QString, Type>::Iterator it = map.begin();
+ for( ; it != map.end(); ++it) {
+ typename Type::Iterator it2 = (*it).begin();
+ for( ; it2 != (*it).end(); ++it2) {
+ (*it2) -> dump( file, true );
+ }
+ }
+}
+
+template<class Type> static void dumpMapDirect( std::ostream& file, QMap<QString, Type>& map ) {
+ typename QMap<QString, Type>::Iterator it = map.begin();
+ for( ; it != map.end(); ++it) {
+ (*it) -> dump( file, true );
+ }
+}
+
+void CodeModelItem::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "name: " << name().ascii() << "\n";
+ str << "kind: " << m_kind << " ";
+
+ if( isFile() ) str << "isFile ";
+ if( isNamespace() ) str << "isNamespace ";
+ if( isClass() ) str << "isClass ";
+ if( isFunction() ) str << "isFunction ";
+ if( isFunctionDefinition() ) str << "isFunctionDefinition ";
+ if( isVariable() ) str << "isVariable ";
+ if( isArgument() ) str << "isArgument ";
+ if( isEnum() ) str << "isEnum ";
+ if( isEnumerator() ) str << "isEnumerator ";
+ if( isTypeAlias() ) str << "isTypeAlias ";
+ if( isCustom() ) str << "isCustom ";
+ str << "\n";
+ str << "File: " << fileName().ascii() << " ";
+ int line, col;
+ getStartPosition( &line, &col );
+ str << "s:(" << line << ", " << col << ") ";
+ getEndPosition( &line, &col );
+ str << "e:(" << line << ", " << col << ")\n";
+
+
+ Info.prepend( str.str().c_str() );
+
+ file << Info.ascii() << "\n";
+ if(recurse) {} ///just to get rid of the warning
+}
+
+void ClassModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+
+ str << "scope: " << m_scope.join("::").ascii() << "\n";
+ str << "bases: " << m_baseClassList.join(" ").ascii() << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if( recurse ) {
+ dumpMap( file, m_classes );
+ }
+}
+
+void NamespaceAliasModel::read( QDataStream& stream ) {
+ QString tempFileName;
+ stream >> m_name >> m_aliasName >> tempFileName;
+ m_fileName = HashedString( tempFileName );
+}
+
+void NamespaceAliasModel::write( QDataStream& stream ) const {
+ stream << m_name << m_aliasName << m_fileName.str();
+}
+
+void NamespaceImportModel::read( QDataStream& stream ) {
+ QString tempFileName;
+ stream >> m_name >> tempFileName;
+ m_fileName = HashedString( tempFileName );
+}
+
+void NamespaceImportModel::write( QDataStream& stream ) const {
+ stream << m_name << m_fileName.str();
+}
+
+void NamespaceModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ Info.prepend( str.str().c_str() );
+
+ ClassModel::dump( file, false, Info );
+
+ if( recurse ) {
+ dumpMapDirect( file, m_namespaces );
+ }
+}
+
+void ArgumentModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "type: " << m_type.ascii() << " default: " << m_defaultValue.ascii() << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if(recurse) {} ///just to get rid of the warning
+}
+
+void FunctionModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "access: " << m_access;
+
+ str << " scope: " << m_scope.join("::").ascii() << "\n";
+
+ if(isAbstract()) str << "isAbstract ";
+ if(isConstant()) str << "isConstant ";
+ if(isFunction()) str << "isFunction ";
+ if(isInline()) str << "isInline ";
+ if(isSignal()) str << "isSignal ";
+ if(isSlot()) str << "isSlot ";
+ if(isStatic()) str << "isStatic ";
+ if(isVirtual()) str << "isVirtual ";
+
+ str << "\n";
+ str << "result-type: " << resultType().ascii() << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if(recurse) {
+ for( ArgumentList::iterator it = m_arguments.begin(); it != m_arguments.end(); ++it) {
+ (*it) -> dump( file, true );
+ }
+ }
+}
+
+void VariableModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "access: " << m_access << "type: " << m_type.ascii() << "\n";
+
+ if(isStatic()) str << "isStatic ";
+
+ str << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if(recurse) {} ///just to get rid of the warning
+}
+
+void CodeModel::dump( std::ostream& file, QString Info ) {
+ ostringstream str(ostringstream::out);
+
+ Info.prepend( str.str().c_str() );
+
+ file << Info.ascii() << "\n";
+
+ QMap<QString, FileDom>::iterator it = m_files.begin();
+ for(; it != m_files.end(); ++it) {
+ (*it) -> dump( file, true );
+ }
+}
+
+void EnumModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "access: " << m_access << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if( recurse ) {
+ dumpMapDirect( file, m_enumerators );
+ }
+}
+
+void EnumeratorModel::dump( std::ostream& file, bool recurse, QString Info )
+{
+ ostringstream str( ostringstream::out );
+
+ str << "value: " << m_value.ascii() << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if(recurse) {} ///just to get rid of the warning
+}
+
+void TypeAliasModel::dump( std::ostream& file, bool recurse, QString Info ) {
+ ostringstream str( ostringstream::out );
+
+ str << "type: " << m_type.ascii() << "\n";
+
+ Info.prepend( str.str().c_str() );
+
+ CodeModelItem::dump( file, false, Info );
+
+ if(recurse) {} ///just to get rid of the warning
+}
+
+void CodeModel::wipeout()
+{
+ m_files.clear();
+ NamespaceDom ns = create<NamespaceModel>();
+ ns->setName( "::" );
+
+ m_globalNamespace = ns;
+}
+
+FileList CodeModel::fileList( )
+{
+ return m_files.values();
+}
+
+const FileList CodeModel::fileList( ) const
+{
+ return m_files.values();
+}
+
+bool CodeModel::hasFile( const QString & name ) const
+{
+ return m_files.contains( name );
+}
+
+FileDom CodeModel::fileByName( const QString & name )
+{
+ QMap<QString, FileDom>::const_iterator it = m_files.find( name );
+ if( it != m_files.end() ) {
+ return *it;
+ } else {
+ return FileDom();
+ }
+}
+
+const FileDom CodeModel::fileByName( const QString & name ) const
+{
+ QMap<QString, FileDom>::const_iterator it = m_files.find( name );
+ if( it != m_files.end() ) {
+ return *it;
+ } else {
+ return FileDom();
+ }
+}
+
+void CodeModel::addNamespace( NamespaceDom target, NamespaceDom source )
+{
+ if( source->name().isEmpty() ){
+ return;
+ } else if( !target->hasNamespace(source->name()) ){
+ NamespaceDom ns = this->create<NamespaceModel>();
+ ns->setName( source->name() );
+ ns->setFileName( source->fileName() ); /// \FIXME ROBE
+ ns->setScope( source->scope() );
+ target->addNamespace( ns );
+ }
+
+ NamespaceDom ns = target->namespaceByName( source->name() );
+
+ NamespaceList namespaceList = source->namespaceList();
+ ClassList classList = source->classList();
+ FunctionList functionList = source->functionList();
+ FunctionDefinitionList functionDefinitionList = source->functionDefinitionList();
+ VariableList variableList = source->variableList();
+ EnumList enumList = source->enumList();
+ TypeAliasList typeAliasList = source->typeAliasList();
+ const NamespaceModel::NamespaceAliasModelList& namespaceAliases = source->namespaceAliases();
+ const NamespaceModel::NamespaceImportModelList& namespaceImports = source->namespaceImports();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ addNamespace( ns, *it );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ ns->addClass( *it );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ ns->addFunction( *it );
+ for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ ns->addFunctionDefinition( *it );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ ns->addVariable( *it );
+ for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
+ ns->addEnum( *it );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ ns->addTypeAlias( *it );
+ for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
+ ns->addNamespaceAlias( *it );
+ for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
+ ns->addNamespaceImport( *it );
+}
+
+void CodeModel::removeNamespace( NamespaceDom target, NamespaceDom source )
+{
+ if( source->name().isEmpty() || !target->hasNamespace(source->name()) )
+ return;
+
+ NamespaceDom ns = target->namespaceByName( source->name() );
+
+ NamespaceList namespaceList = source->namespaceList();
+ ClassList classList = source->classList();
+ FunctionList functionList = source->functionList();
+ FunctionDefinitionList functionDefinitionList = source->functionDefinitionList();
+ VariableList variableList = source->variableList();
+ EnumList enumList = source->enumList();
+ TypeAliasList typeAliasList = source->typeAliasList();
+ const NamespaceModel::NamespaceAliasModelList& namespaceAliases = source->namespaceAliases();
+ const NamespaceModel::NamespaceImportModelList& namespaceImports = source->namespaceImports();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ removeNamespace( ns, *it );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ ns->removeClass( *it );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ ns->removeFunction( *it );
+ for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ ns->removeFunctionDefinition( *it );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ ns->removeVariable( *it );
+ for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
+ ns->removeEnum( *it );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ ns->removeTypeAlias( *it );
+ for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
+ ns->removeNamespaceAlias( *it );
+ for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
+ ns->removeNamespaceImport( *it );
+
+ if( ns->namespaceList().isEmpty() &&
+ ns->classList().isEmpty() &&
+ ns->functionList().isEmpty() &&
+ ns->functionDefinitionList().isEmpty() &&
+ ns->variableList().isEmpty() &&
+ ns->enumList().isEmpty() &&
+ ns->typeAliasList().isEmpty() &&
+ ns->namespaceImports().empty() &&
+ ns->namespaceAliases().empty() )
+ {
+ target->removeNamespace( ns );
+ }
+}
+
+bool CodeModel::addFile( FileDom file )
+{
+ if( file->name().isEmpty() )
+ return false;
+
+ if( m_files.find( file->name() ) != m_files.end() ) {
+ ///the error-channel is set to 9007 because this problem appears with the cpp-support, so it is needed while debugging it
+ kdDebug(9007) << "file " << file->name() << " was added to code-model without removing it before! \n" << kdBacktrace() << endl;
+ removeFile( fileByName( file->name() ) );
+ }
+
+ // update global namespace
+ NamespaceList namespaceList = file->namespaceList();
+ ClassList classList = file->classList();
+ FunctionList functionList = file->functionList();
+ FunctionDefinitionList functionDefinitionList = file->functionDefinitionList();
+ VariableList variableList = file->variableList();
+ EnumList enumList = file->enumList();
+ TypeAliasList typeAliasList = file->typeAliasList();
+ const NamespaceModel::NamespaceAliasModelList& namespaceAliases = file->namespaceAliases();
+ const NamespaceModel::NamespaceImportModelList& namespaceImports = file->namespaceImports();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ addNamespace( m_globalNamespace, *it );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ m_globalNamespace->addClass( *it );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ m_globalNamespace->addFunction( *it );
+ for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ m_globalNamespace->addFunctionDefinition( *it );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ m_globalNamespace->addVariable( *it );
+ for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
+ m_globalNamespace->addEnum( *it );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ m_globalNamespace->addTypeAlias( *it );
+ for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
+ m_globalNamespace->addNamespaceAlias( *it );
+ for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
+ m_globalNamespace->addNamespaceImport( *it );
+
+ m_files.insert( file->name(), file );
+ return true;
+}
+
+void CodeModel::removeFile( FileDom file )
+{
+ // update global namespace
+ NamespaceList namespaceList = file->namespaceList();
+ ClassList classList = file->classList();
+ FunctionList functionList = file->functionList();
+ FunctionDefinitionList functionDefinitionList = file->functionDefinitionList();
+ VariableList variableList = file->variableList();
+ EnumList enumList = file->enumList();
+ TypeAliasList typeAliasList = file->typeAliasList();
+ const NamespaceModel::NamespaceAliasModelList& namespaceAliases = file->namespaceAliases();
+ const NamespaceModel::NamespaceImportModelList& namespaceImports = file->namespaceImports();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ removeNamespace( m_globalNamespace, *it );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ m_globalNamespace->removeClass( *it );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ m_globalNamespace->removeFunction( *it );
+ for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ m_globalNamespace->removeFunctionDefinition( *it );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ m_globalNamespace->removeVariable( *it );
+ for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
+ m_globalNamespace->removeEnum( *it );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ m_globalNamespace->removeTypeAlias( *it );
+ for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
+ m_globalNamespace->removeNamespaceAlias( *it );
+ for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
+ m_globalNamespace->removeNamespaceImport( *it );
+
+ m_files.remove( file->name() );
+}
+
+// ------------------------------------------------------------------------
+CodeModelItem::CodeModelItem( int kind, CodeModel* model )
+ : m_kind( kind ), m_model( model )
+{
+ //kdDebug() << "CodeModelItem::CodeModelItem()" << endl;
+ m_startLine = 0;
+ m_startColumn = 0;
+ m_endLine = 0;
+ m_endColumn = 0;
+}
+
+CodeModelItem::~ CodeModelItem( )
+{
+}
+
+QString CodeModelItem::name( ) const
+{
+ return m_name;
+}
+
+void CodeModelItem::setName( const QString & name )
+{
+ m_name = name;
+}
+
+const FileDom CodeModelItem::file( ) const
+{
+ return m_model->fileByName( m_fileName );
+}
+
+FileDom CodeModelItem::file( )
+{
+ return m_model->fileByName( m_fileName );
+}
+
+QString CodeModelItem::fileName() const
+{
+ return m_fileName;
+}
+
+void CodeModelItem::setFileName( const QString& fileName )
+{
+ m_fileName = fileName;
+}
+
+void CodeModelItem::getStartPosition( int * line, int * column ) const
+{
+ if( line ) *line = m_startLine;
+ if( column ) *column = m_startColumn;
+}
+
+void CodeModelItem::setStartPosition( int line, int column )
+{
+ m_startLine = line;
+ m_startColumn = column;
+}
+
+void CodeModelItem::getEndPosition( int * line, int * column ) const
+{
+ if( line ) *line = m_endLine;
+ if( column ) *column = m_endColumn;
+}
+
+void CodeModelItem::setEndPosition( int line, int column )
+{
+ m_endLine = line;
+ m_endColumn = column;
+}
+
+void CodeModelItem::update( const CodeModelItem* i ) {
+ m_startLine = i->m_startLine;
+ m_startColumn = i->m_startColumn;
+ m_endLine = i->m_endLine;
+ m_endColumn = i->m_endColumn;
+}
+
+bool CodeModelItem::canUpdate( const CodeModelItem* i ) const {
+ if( i->m_kind != m_kind || i->m_name != m_name )
+ return false;
+ return true;
+}
+
+
+// ------------------------------------------------------------------------
+NamespaceModel::NamespaceModel( CodeModel* model )
+ : ClassModel( model )
+{
+ setKind( Namespace );
+}
+
+NamespaceList NamespaceModel::namespaceList( )
+{
+ return m_namespaces.values();
+}
+
+const NamespaceList NamespaceModel::namespaceList( ) const
+{
+ return m_namespaces.values();
+}
+
+NamespaceDom NamespaceModel::namespaceByName( const QString & name )
+{
+ return m_namespaces.contains( name ) ? m_namespaces[ name ] : NamespaceDom();
+}
+
+const NamespaceDom NamespaceModel::namespaceByName( const QString & name ) const
+{
+ return m_namespaces.contains( name ) ? m_namespaces[ name ] : NamespaceDom();
+}
+
+bool NamespaceModel::hasNamespace( const QString & name ) const
+{
+ return m_namespaces.contains( name );
+}
+
+bool NamespaceModel::addNamespace( NamespaceDom ns )
+{
+ if( ns->name().isEmpty() )
+ return false;
+
+ m_namespaces[ ns->name() ] = ns;
+ return true;
+}
+
+void NamespaceModel::removeNamespace( NamespaceDom ns )
+{
+ m_namespaces.remove( ns->name() );
+}
+
+// ------------------------------------------------------------------------
+FileModel::FileModel( CodeModel* model )
+ : NamespaceModel( model ), m_groupId( model->newGroupId() ), m_parseResult( 0 )
+{
+}
+
+// ------------------------------------------------------------------------
+ClassModel::ClassModel( CodeModel* model )
+ : CodeModelItem( Class, model)
+{
+}
+
+QStringList ClassModel::baseClassList( ) const
+{
+ return m_baseClassList;
+}
+
+bool ClassModel::addBaseClass( const QString & baseClass )
+{
+ m_baseClassList.push_back( baseClass );
+ return true;
+}
+
+void ClassModel::removeBaseClass( const QString & baseClass )
+{
+ m_baseClassList.remove( baseClass );
+}
+
+ClassList ClassModel::classList( )
+{
+ ClassList l;
+ QMap<QString, ClassList>::Iterator it = m_classes.begin();
+ while( it != m_classes.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+const ClassList ClassModel::classList( ) const
+{
+ ClassList l;
+ QMap<QString, ClassList>::ConstIterator it = m_classes.begin();
+ while( it != m_classes.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+bool ClassModel::hasClass( const QString & name ) const
+{
+ return m_classes.contains( name );
+}
+
+ClassList ClassModel::classByName( const QString & name )
+{
+ return m_classes.contains( name ) ? m_classes[ name ] : ClassList();
+}
+
+const ClassList ClassModel::classByName( const QString & name ) const
+{
+ return m_classes.contains( name ) ? m_classes[ name ] : ClassList();
+}
+
+bool ClassModel::addClass( ClassDom klass )
+{
+ if( klass->name().isEmpty() )
+ return false;
+
+ m_classes[ klass->name() ].push_back( klass );
+ return true;
+}
+
+void ClassModel::removeClass( ClassDom klass )
+{
+ m_classes[ klass->name() ].remove( klass );
+
+ if( m_classes[klass->name()].isEmpty() )
+ m_classes.remove( klass->name() );
+}
+
+FunctionList ClassModel::functionList( )
+{
+ FunctionList l;
+ QMap<QString, FunctionList>::Iterator it = m_functions.begin();
+ while( it != m_functions.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+const FunctionList ClassModel::functionList( ) const
+{
+ FunctionList l;
+ QMap<QString, FunctionList>::ConstIterator it = m_functions.begin();
+ while( it != m_functions.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+bool ClassModel::hasFunction( const QString & name ) const
+{
+ return m_functions.contains( name );
+}
+
+FunctionList ClassModel::functionByName( const QString & name )
+{
+ return m_functions.contains( name ) ? m_functions[ name ] : FunctionList();
+}
+
+const FunctionList ClassModel::functionByName( const QString & name ) const
+{
+ return m_functions.contains( name ) ? m_functions[ name ] : FunctionList();
+}
+
+bool ClassModel::addFunction( FunctionDom fun )
+{
+ if( fun->name().isEmpty() )
+ return false;
+
+ m_functions[ fun->name() ].push_back( fun );
+ return true;
+}
+
+void ClassModel::removeFunction( FunctionDom fun )
+{
+ m_functions[ fun->name() ].remove( fun );
+
+ if( m_functions[fun->name()].isEmpty() )
+ m_functions.remove( fun->name() );
+}
+
+FunctionDefinitionList ClassModel::functionDefinitionList( )
+{
+ FunctionDefinitionList l;
+ QMap<QString, FunctionDefinitionList>::Iterator it = m_functionDefinitions.begin();
+ while( it != m_functionDefinitions.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+const FunctionDefinitionList ClassModel::functionDefinitionList( ) const
+{
+ FunctionDefinitionList l;
+ QMap<QString, FunctionDefinitionList>::ConstIterator it = m_functionDefinitions.begin();
+ while( it != m_functionDefinitions.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+bool ClassModel::hasFunctionDefinition( const QString & name ) const
+{
+ return m_functionDefinitions.contains( name );
+}
+
+FunctionDefinitionList ClassModel::functionDefinitionByName( const QString & name )
+{
+ return m_functionDefinitions.contains( name ) ? m_functionDefinitions[ name ] : FunctionDefinitionList();
+}
+
+const FunctionDefinitionList ClassModel::functionDefinitionByName( const QString & name ) const
+{
+ return m_functionDefinitions.contains( name ) ? m_functionDefinitions[ name ] : FunctionDefinitionList();
+}
+
+bool ClassModel::addFunctionDefinition( FunctionDefinitionDom fun )
+{
+ if( fun->name().isEmpty() )
+ return false;
+
+ m_functionDefinitions[ fun->name() ].push_back( fun );
+ return true;
+}
+
+void ClassModel::removeFunctionDefinition( FunctionDefinitionDom fun )
+{
+ m_functionDefinitions[ fun->name() ].remove( fun );
+
+ if( m_functionDefinitions[fun->name()].isEmpty() )
+ m_functionDefinitions.remove( fun->name() );
+}
+
+VariableList ClassModel::variableList( )
+{
+ return m_variables.values();
+}
+
+const VariableList ClassModel::variableList( ) const
+{
+ return m_variables.values();
+}
+
+VariableDom ClassModel::variableByName( const QString & name )
+{
+ return m_variables.contains( name ) ? m_variables[ name ] : VariableDom();
+}
+
+const VariableDom ClassModel::variableByName( const QString & name ) const
+{
+ return m_variables.contains( name ) ? m_variables[ name ] : VariableDom();
+}
+
+bool ClassModel::hasVariable( const QString & name ) const
+{
+ return m_variables.contains( name );
+}
+
+bool ClassModel::addVariable( VariableDom var )
+{
+ if( var->name().isEmpty() )
+ return false;
+
+ m_variables.insert( var->name(), var );
+ return true;
+}
+
+void ClassModel::removeVariable( VariableDom var )
+{
+ m_variables.remove( var->name() );
+}
+
+EnumList ClassModel::enumList( )
+{
+ return m_enumerators.values();
+}
+
+const EnumList ClassModel::enumList( ) const
+{
+ return m_enumerators.values();
+}
+
+EnumDom ClassModel::enumByName( const QString & name )
+{
+ return m_enumerators.contains( name ) ? m_enumerators[ name ] : EnumDom();
+}
+
+const EnumDom ClassModel::enumByName( const QString & name ) const
+{
+ return m_enumerators.contains( name ) ? m_enumerators[ name ] : EnumDom();
+}
+
+bool ClassModel::hasEnum( const QString & name ) const
+{
+ return m_enumerators.contains( name );
+}
+
+bool ClassModel::addEnum( EnumDom e )
+{
+ if( e->name().isEmpty() )
+ return false;
+
+ m_enumerators.insert( e->name(), e );
+ return true;
+}
+
+void ClassModel::update( const ClassModel* klass ) {
+ CodeModelItem::update( klass );
+ eachUpdate( m_classes, klass->m_classes ) ;
+ eachUpdate( m_functions, klass->m_functions ) ;
+ eachUpdate( m_functionDefinitions, klass->m_functionDefinitions ) ;
+ eachUpdateSingle( m_variables, klass->m_variables ) ;
+ eachUpdateSingle( m_enumerators, klass->m_enumerators ) ;
+ eachUpdate( m_typeAliases, klass->m_typeAliases );
+}
+
+bool ClassModel::canUpdate( const ClassModel* klass ) const {
+ if( !CodeModelItem::canUpdate( klass ) )
+ return false;
+
+ return eachCanUpdate( m_classes, klass->m_classes ) &&
+ eachCanUpdate( m_functions, klass->m_functions ) &&
+ eachCanUpdate( m_functionDefinitions, klass->m_functionDefinitions ) &&
+ eachCanUpdateSingle( m_variables, klass->m_variables ) &&
+ eachCanUpdateSingle( m_enumerators, klass->m_enumerators ) &&
+ eachCanUpdate( m_typeAliases, klass->m_typeAliases );
+}
+
+void ClassModel::removeEnum( EnumDom e )
+{
+ m_enumerators.remove( e->name() );
+}
+
+TypeAliasList ClassModel::typeAliasList( )
+{
+ TypeAliasList l;
+ QMap<QString, TypeAliasList>::Iterator it = m_typeAliases.begin();
+ while( it != m_typeAliases.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+const TypeAliasList ClassModel::typeAliasList( ) const
+{
+ TypeAliasList l;
+ QMap<QString, TypeAliasList>::ConstIterator it = m_typeAliases.begin();
+ while( it != m_typeAliases.end() ){
+ l += *it;
+ ++it;
+ }
+
+ return l;
+}
+
+bool ClassModel::hasTypeAlias( const QString & name ) const
+{
+ return m_typeAliases.contains( name );
+}
+
+TypeAliasList ClassModel::typeAliasByName( const QString & name )
+{
+ return m_typeAliases.contains( name ) ? m_typeAliases[ name ] : TypeAliasList();
+}
+
+const TypeAliasList ClassModel::typeAliasByName( const QString & name ) const
+{
+ return m_typeAliases.contains( name ) ? m_typeAliases[ name ] : TypeAliasList();
+}
+
+bool ClassModel::addTypeAlias( TypeAliasDom typeAlias )
+{
+ if( typeAlias->name().isEmpty() )
+ return false;
+
+ m_typeAliases[ typeAlias->name() ].push_back( typeAlias );
+ return true;
+}
+
+void ClassModel::removeTypeAlias( TypeAliasDom typeAlias )
+{
+ m_typeAliases[ typeAlias->name() ].remove( typeAlias );
+
+ if( m_typeAliases[typeAlias->name()].isEmpty() )
+ m_typeAliases.remove( typeAlias->name() );
+}
+
+
+
+// ------------------------------------------------------------------------
+ArgumentModel::ArgumentModel( CodeModel* model )
+ : CodeModelItem( Argument, model)
+{
+}
+
+QString ArgumentModel::type( ) const
+{
+ return m_type;
+}
+
+void ArgumentModel::setType( const QString& type )
+{
+ m_type = type;
+}
+
+QString ArgumentModel::defaultValue( ) const
+{
+ return m_defaultValue;
+}
+
+void ArgumentModel::setDefaultValue( const QString & defaultValue )
+{
+ m_defaultValue = defaultValue;
+}
+
+// ------------------------------------------------------------------------
+FunctionModel::FunctionModel( CodeModel* model )
+ : CodeModelItem( Function, model)
+{
+ m_access = Public;
+ d.v.m_signal = false;
+ d.v.m_slot = false;
+ d.v.m_virtual = false;
+ d.v.m_static = false;
+ d.v.m_inline = false;
+ d.v.m_constant = false;
+ d.v.m_abstract = false;
+}
+
+bool FunctionModel::isVirtual( ) const
+{
+ return d.v.m_virtual;
+}
+
+void FunctionModel::setVirtual( bool isVirtual )
+{
+ d.v.m_virtual = isVirtual;
+}
+
+bool FunctionModel::isStatic( ) const
+{
+ return d.v.m_static;
+}
+
+void FunctionModel::setStatic( bool isStatic )
+{
+ d.v.m_static = isStatic;
+}
+
+bool FunctionModel::isInline( ) const
+{
+ return d.v.m_inline;
+}
+
+void FunctionModel::setInline( bool isInline )
+{
+ d.v.m_inline = isInline;
+}
+
+bool FunctionModel::isConstant( ) const
+{
+ return d.v.m_constant;
+}
+
+void FunctionModel::setConstant( bool isConstant )
+{
+ d.v.m_constant = isConstant;
+}
+
+bool FunctionModel::isAbstract( ) const
+{
+ return d.v.m_abstract;
+}
+
+void FunctionModel::setAbstract( bool isAbstract )
+{
+ d.v.m_abstract = isAbstract;
+}
+
+QString FunctionModel::resultType( ) const
+{
+ return m_resultType;
+}
+
+void FunctionModel::setResultType( const QString& type )
+{
+ m_resultType = type;
+}
+
+ArgumentList FunctionModel::argumentList( )
+{
+ return m_arguments;
+}
+
+const ArgumentList FunctionModel::argumentList( ) const
+{
+ return m_arguments;
+}
+
+bool FunctionModel::addArgument( ArgumentDom arg )
+{
+ m_arguments.push_back( arg );
+ return true;
+}
+
+void FunctionModel::removeArgument( ArgumentDom arg )
+{
+ m_arguments.remove( arg );
+}
+
+void FunctionModel::update( const FunctionModel* i ) {
+ m_access = i->m_access;
+ CodeModelItem::update( i );
+}
+
+bool FunctionModel::canUpdate( const FunctionModel* i ) const {
+ if( !CodeModelItem::canUpdate( i ) )
+ return false;
+ if( m_resultType != i->m_resultType || m_arguments.count() != i->m_arguments.count() || m_scope != i->m_scope )
+ return false;
+ return true;
+}
+
+
+// ------------------------------------------------------------------------
+VariableModel::VariableModel( CodeModel* model )
+ : CodeModelItem( Variable, model)
+{
+ m_access = Public;
+ m_static = false;
+ m_isEnumeratorVariable = false;
+}
+
+bool VariableModel::isStatic( ) const
+{
+ return m_static;
+}
+
+void VariableModel::setStatic( bool isStatic )
+{
+ m_static = isStatic;
+}
+
+QString VariableModel::type( ) const
+{
+ return m_type;
+}
+
+void VariableModel::setType( const QString& type )
+{
+ m_type = type;
+}
+
+bool VariableModel::isEnumeratorVariable() const {
+ return m_isEnumeratorVariable;
+}
+
+void VariableModel::setEnumeratorVariable( bool b) {
+ m_isEnumeratorVariable = b;
+}
+
+int FunctionModel::access( ) const
+{
+ return m_access;
+}
+
+void FunctionModel::setAccess( int access )
+{
+ m_access = access;
+}
+
+bool FunctionModel::isSignal( ) const
+{
+ return d.v.m_signal;
+}
+
+void FunctionModel::setSignal( bool isSignal )
+{
+ d.v.m_signal = isSignal;
+}
+
+bool FunctionModel::isSlot( ) const
+{
+ return d.v.m_slot;
+}
+
+void FunctionModel::setSlot( bool isSlot )
+{
+ d.v.m_slot = isSlot;
+}
+
+FunctionDefinitionModel::FunctionDefinitionModel( CodeModel* model )
+ : FunctionModel( model )
+{
+}
+
+int VariableModel::access( ) const
+{
+ return m_access;
+}
+
+void VariableModel::setAccess( int access )
+{
+ m_access = access;
+}
+
+const NamespaceDom CodeModel::globalNamespace( ) const
+{
+ return m_globalNamespace;
+}
+
+void CodeModelItem::read( QDataStream & stream )
+{
+ stream
+ >> m_kind
+ >> m_name
+ >> m_fileName
+ >> m_startLine
+ >> m_startColumn
+ >> m_endLine
+ >> m_endColumn
+ >> m_comment;
+
+ if( isTemplateable() ) {
+ TemplateModelItem* t = (TemplateModelItem*)( this );
+
+ t->read( stream );
+ }
+}
+
+void CodeModelItem::write( QDataStream & stream ) const
+{
+ stream
+ << m_kind
+ << m_name
+ << m_fileName
+ << m_startLine
+ << m_startColumn
+ << m_endLine
+ << m_endColumn
+ << m_comment;
+
+ if( isTemplateable() ) {
+ TemplateModelItem* t = (TemplateModelItem*)( this );
+ t-> write( stream );
+ }
+}
+
+void ClassModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+
+ TemplateModelItem::read( stream );
+
+ stream >> m_scope >> m_baseClassList;
+
+ int n;
+
+ m_classes.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ ClassDom klass = codeModel()->create<ClassModel>();
+ klass->read( stream );
+ addClass( klass );
+ }
+
+ m_functions.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ FunctionDom fun = codeModel()->create<FunctionModel>();
+ fun->read( stream );
+ addFunction( fun );
+ }
+
+ m_functionDefinitions.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ FunctionDefinitionDom fun = codeModel()->create<FunctionDefinitionModel>();
+ fun->read( stream );
+ addFunctionDefinition( fun );
+ }
+
+ m_variables.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ VariableDom var = codeModel()->create<VariableModel>();
+ var->read( stream );
+ addVariable( var );
+ }
+
+ m_enumerators.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ EnumDom e = codeModel()->create<EnumModel>();
+ e->read( stream );
+ addEnum( e );
+ }
+
+ m_typeAliases.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ TypeAliasDom typeAlias = codeModel()->create<TypeAliasModel>();
+ typeAlias->read( stream );
+ addTypeAlias( typeAlias );
+ }
+}
+
+void ClassModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+
+ TemplateModelItem::write( stream );
+
+ stream << m_scope << m_baseClassList;
+
+ const ClassList class_list = classList();
+ stream << int( class_list.size() );
+ for( ClassList::ConstIterator it = class_list.begin(); it!=class_list.end(); ++it )
+ (*it)->write( stream );
+
+ const FunctionList function_list = functionList();
+ stream << int( function_list.size() );
+ for( FunctionList::ConstIterator it = function_list.begin(); it!=function_list.end(); ++it )
+ (*it)->write( stream );
+
+ const FunctionDefinitionList function_definition_list = functionDefinitionList();
+ stream << int( function_definition_list.size() );
+ for( FunctionDefinitionList::ConstIterator it = function_definition_list.begin(); it!=function_definition_list.end(); ++it )
+ (*it)->write( stream );
+
+ const VariableList variable_list = variableList();
+ stream << int( variable_list.size() );
+ for( VariableList::ConstIterator it = variable_list.begin(); it!=variable_list.end(); ++it )
+ (*it)->write( stream );
+
+ const EnumList enum_list = enumList();
+ stream << int( enum_list.size() );
+ for( EnumList::ConstIterator it = enum_list.begin(); it!=enum_list.end(); ++it )
+ (*it)->write( stream );
+
+ const TypeAliasList type_alias_list = typeAliasList();
+ stream << int( type_alias_list.size() );
+ for( TypeAliasList::ConstIterator it = type_alias_list.begin(); it!=type_alias_list.end(); ++it )
+ (*it)->write( stream );
+
+}
+
+void NamespaceModel::read( QDataStream & stream )
+{
+ ClassModel::read( stream );
+
+ int n;
+
+ m_namespaces.clear(); m_namespaceAliases.clear(); m_namespaceImports.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ NamespaceDom ns = codeModel()->create<NamespaceModel>();
+ ns->read( stream );
+ addNamespace( ns );
+ }
+
+ stream >> n;
+ for( int a = 0; a < n; a++ ) {
+ NamespaceAliasModel m;
+ m.read( stream );
+ m_namespaceAliases.insert( m );
+ }
+ stream >> n;
+ for( int a = 0; a < n; a++ ) {
+ NamespaceImportModel m;
+ m.read( stream );
+ m_namespaceImports.insert( m );
+ }
+}
+
+void NamespaceModel::addNamespaceImport( const NamespaceImportModel& import ) {
+ m_namespaceImports.insert( import );
+}
+
+void NamespaceModel::addNamespaceAlias( const NamespaceAliasModel& alias ) {
+ m_namespaceAliases.insert( alias );
+}
+
+void NamespaceModel::removeNamespaceImport( const NamespaceImportModel& import ) {
+ m_namespaceImports.erase( import );
+}
+
+void NamespaceModel::removeNamespaceAlias( const NamespaceAliasModel& alias ) {
+ m_namespaceAliases.erase( alias );
+}
+
+void NamespaceModel::write( QDataStream & stream ) const
+{
+ ClassModel::write( stream );
+
+ const NamespaceList namespace_list = namespaceList();
+ stream << int( namespace_list.size() );
+ for( NamespaceList::ConstIterator it = namespace_list.begin(); it!=namespace_list.end(); ++it )
+ (*it)->write( stream );
+
+ stream << int( m_namespaceAliases.size() );
+ for( NamespaceAliasModelList::const_iterator it = m_namespaceAliases.begin(); it != m_namespaceAliases.end(); ++it )
+ (*it).write( stream );
+ stream << int( m_namespaceImports.size() );
+ for( NamespaceImportModelList::const_iterator it = m_namespaceImports.begin(); it != m_namespaceImports.end(); ++it )
+ (*it).write( stream );
+}
+
+bool NamespaceModel::canUpdate( const NamespaceModel* ns ) const {
+ if( !ClassModel::canUpdate( ns ) )
+ return false;
+
+ const NamespaceAliasModelList& aliases = namespaceAliases();
+ const NamespaceImportModelList& imports = namespaceImports();
+ const NamespaceAliasModelList& aliases2 = ns->namespaceAliases();
+ const NamespaceImportModelList& imports2 = ns->namespaceImports();
+
+ if( aliases.size() != aliases2.size() ) return false;
+ if( imports.size() != imports2.size() ) return false;
+
+ ///Test if all aliases are same, if not return false
+ NamespaceModel::NamespaceAliasModelList::const_iterator it_al1 = aliases.begin();
+ NamespaceModel::NamespaceAliasModelList::const_iterator it_al2 = aliases2.begin();
+ while( it_al1 != aliases.end() ) {
+ if( !(*it_al1 == *it_al2) )
+ return false;
+
+ ++it_al1;
+ ++it_al2;
+ }
+
+ ///Test if all imports are same, if not return false
+ NamespaceModel::NamespaceImportModelList::const_iterator it_ip1 = imports.begin();
+ NamespaceModel::NamespaceImportModelList::const_iterator it_ip2 = imports2.begin();
+ while( it_ip1 != imports.end() ) {
+ if( !(*it_ip1 == *it_ip2) )
+ return false;
+
+ ++it_ip1;
+ ++it_ip2;
+ }
+
+ return eachCanUpdateSingle( m_namespaces, ns->m_namespaces );
+}
+
+void NamespaceModel::update( const NamespaceModel* ns )
+{
+ ClassModel::update( ns );
+
+ eachUpdateSingle( m_namespaces, ns->m_namespaces );
+}
+
+void FileModel::read( QDataStream & stream )
+{
+ stream >> m_groupId;
+ bool b;
+ stream >> b;
+ if( b ) {
+ int i;
+ stream >> i;
+ ParsedFileType t( (ParsedFileType) i );
+ switch( t ) {
+ case CppParsedFile:
+ m_parseResult = (AbstractParseResult*)(new ParsedFile( stream ));
+ break;
+ }
+ }
+
+ NamespaceModel::read( stream );
+}
+
+void FileModel::write( QDataStream & stream ) const
+{
+ stream << m_groupId;
+ bool b = m_parseResult;
+ stream << b;
+ if( b ) {
+ int i = m_parseResult->type();
+ stream << i;
+ m_parseResult->write( stream );
+ }
+
+ NamespaceModel::write( stream );
+}
+
+void ArgumentModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+
+
+ stream >> m_type >> m_defaultValue;
+}
+
+void ArgumentModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+
+ stream << m_type << m_defaultValue;
+}
+
+void FunctionModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+ TemplateModelItem::read( stream );
+
+ stream >> m_scope;
+ stream >> d.flags;
+
+ int n;
+
+ m_arguments.clear();
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ ArgumentDom arg = codeModel()->create<ArgumentModel>();
+ arg->read( stream );
+ addArgument( arg );
+ }
+
+ stream
+ >> m_resultType;
+}
+
+void FunctionModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+ TemplateModelItem::write( stream );
+
+ stream << m_scope;
+ stream << d.flags;
+
+ const ArgumentList argument_list = argumentList();
+ stream << int( argument_list.size() );
+ for( ArgumentList::ConstIterator it = argument_list.begin(); it!=argument_list.end(); ++it )
+ (*it)->write( stream );
+
+ stream
+ << m_resultType;
+}
+
+void CodeModel::read( QDataStream & stream )
+{
+ int n;
+
+ m_files.clear();
+
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ FileDom file = this->create<FileModel>();
+ file->read( stream );
+ addFile( file );
+ }
+}
+
+void CodeModel::write( QDataStream & stream ) const
+{
+ const FileList file_list = fileList();
+ stream << int( file_list.size() );
+ for( FileList::ConstIterator it = file_list.begin(); it!=file_list.end(); ++it )
+ (*it)->write( stream );
+}
+
+void VariableModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+ stream >> m_access >> m_static >> m_type >> m_isEnumeratorVariable;
+}
+
+void VariableModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+ stream << m_access << m_static << m_type << m_isEnumeratorVariable;
+}
+
+void VariableModel::update( const VariableModel* i ) {
+ m_access = i->m_access;
+ CodeModelItem::update( i );
+}
+
+bool VariableModel::canUpdate( const VariableModel* i ) const {
+ if( !CodeModelItem::canUpdate( i ) )
+ return false;
+ if( m_access != i->m_access || m_static != i->m_static || m_type != i->m_type || m_isEnumeratorVariable != i->m_isEnumeratorVariable )
+ return false;
+ return true;
+}
+
+// -------------------------------------------------------
+EnumModel::EnumModel( CodeModel * model )
+ : CodeModelItem( Enum, model)
+{
+}
+
+int EnumModel::access( ) const
+{
+ return m_access;
+}
+
+void EnumModel::setAccess( int access )
+{
+ m_access = access;
+}
+
+EnumeratorList EnumModel::enumeratorList( )
+{
+ return m_enumerators.values();
+}
+
+const EnumeratorList EnumModel::enumeratorList( ) const
+{
+ return m_enumerators.values();
+}
+
+void EnumModel::addEnumerator( EnumeratorDom enumerator )
+{
+ m_enumerators.insert( enumerator->name(), enumerator );
+}
+
+void EnumModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+ stream >> m_access;
+
+ int n;
+ stream >> n;
+ for( int i=0; i<n; ++i ){
+ EnumeratorDom e = codeModel()->create<EnumeratorModel>();
+ e->read( stream );
+ addEnumerator( e );
+ }
+}
+
+void EnumModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+
+ stream << m_access;
+ const EnumeratorList enumerator_list = enumeratorList();
+ stream << int( enumerator_list.size() );
+ for( EnumeratorList::ConstIterator it = enumerator_list.begin(); it!=enumerator_list.end(); ++it )
+ (*it)->write( stream );
+}
+
+EnumeratorModel::EnumeratorModel( CodeModel * model )
+ : CodeModelItem( Enumerator, model )
+{
+}
+
+QString EnumeratorModel::value( ) const
+{
+ return m_value;
+}
+
+void EnumeratorModel::setValue( const QString & value )
+{
+ m_value = value;
+}
+
+void EnumeratorModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+ stream >> m_value;
+}
+
+void EnumeratorModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+ stream << m_value;
+}
+
+void EnumModel::removeEnumerator( EnumeratorDom e )
+{
+ m_enumerators.remove( e->name() );
+}
+
+void EnumModel::update( const EnumModel* i ) {
+ m_access = i->m_access;
+ CodeModelItem::update( i );
+}
+
+bool EnumModel::canUpdate( const EnumModel* i ) const {
+ if( !CodeModelItem::canUpdate( i ) )
+ return false;
+ ///@todo check not complete
+ if( m_access != i->m_access || m_enumerators.count() != i->m_enumerators.count() )
+ return false;
+ return true;
+}
+
+// ---------------------------------------------------------------
+TypeAliasModel::TypeAliasModel( CodeModel * model )
+ : CodeModelItem( TypeAlias, model )
+{
+}
+
+void TypeAliasModel::read( QDataStream & stream )
+{
+ CodeModelItem::read( stream );
+
+ stream >> m_type;
+}
+
+void TypeAliasModel::write( QDataStream & stream ) const
+{
+ CodeModelItem::write( stream );
+
+ stream << m_type;
+}
+
+QString TypeAliasModel::type( ) const
+{
+ return m_type;
+}
+
+void TypeAliasModel::setType( const QString & type )
+{
+ m_type = type;
+}
+
+void TypeAliasModel::update( const TypeAliasModel* i ) {
+ CodeModelItem::update( i );
+}
+
+bool TypeAliasModel::canUpdate( const TypeAliasModel* i ) const {
+ if( !CodeModelItem::canUpdate( i ) )
+ return false;
+ return m_type == i->m_type;
+}
+
+void FileModel::update( const FileModel* file ) {
+ m_parseResult = file->m_parseResult;
+ NamespaceModel::update( file );
+}
+
+FileList FileModel::wholeGroup() {
+ if( isSingleGroup( m_groupId ) ) return ( FileList() << FileDom(this) );
+ return codeModel()->getGroup( m_groupId );
+}
+
+QStringList FileModel::wholeGroupStrings() const {
+ if( isSingleGroup( m_groupId ) ) return (QStringList() << name() );
+ return codeModel()->getGroupStrings( m_groupId );
+}
+
+ParseResultPointer FileModel::parseResult() const {
+ return m_parseResult;
+}
+
+void FileModel::setParseResult( const ParseResultPointer& result ) {
+ m_parseResult = result;
+}
diff --git a/lib/interfaces/codemodel.h b/lib/interfaces/codemodel.h
new file mode 100644
index 00000000..b8c0c894
--- /dev/null
+++ b/lib/interfaces/codemodel.h
@@ -0,0 +1,1612 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2004 Matt Rogers <mattr@kde.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef CODEMODEL_H
+#define CODEMODEL_H
+
+/**
+@file codemodel.h
+Code Model - a memory symbol store.
+*/
+
+
+#include <qmap.h>
+#include <qstringlist.h>
+#include <ksharedptr.h>
+#include <qvaluevector.h>
+#include "hashedstring.h"
+
+#include <iostream>
+#include <ostream>
+#include <string>
+#include <sstream>
+#include <set>
+
+enum ParsedFileType {
+ CppParsedFile
+};
+
+class AbstractParseResult : public KShared {
+public:
+ virtual void read( QDataStream& stream ) = 0;
+
+ virtual void write( QDataStream& stream ) const = 0;
+
+ virtual ParsedFileType type() const = 0;
+};
+
+typedef KSharedPtr<AbstractParseResult> ParseResultPointer;
+
+using namespace std;
+
+class CodeModel;
+class CodeModelItem;
+class FileModel;
+class NamespaceModel;
+class ClassModel;
+class FunctionModel;
+class FunctionDefinitionModel;
+class VariableModel;
+class ArgumentModel;
+class EnumModel;
+class EnumeratorModel;
+class TypeAliasModel;
+
+/**
+@class ItemDom
+Safe pointer to the @ref CodeModelItem.
+This is a type definition: @code typedef KSharedPtr<CodeModelItem> ItemDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<CodeModelItem> ItemDom;
+
+/**
+@class FileDom
+Safe pointer to the @ref FileModel.
+This is a type definition: @code typedef KSharedPtr<FileModel> FileDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<FileModel> FileDom;
+
+/**
+@class NamespaceDom
+Safe pointer to the @ref NamespaceModel.
+This is a type definition: @code typedef KSharedPtr<NamespaceModel> NamespaceDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<NamespaceModel> NamespaceDom;
+
+/**
+@class ClassDom
+Safe pointer to the @ref ClassModel.
+This is a type definition: @code typedef KSharedPtr<ClassModel> ClassDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<ClassModel> ClassDom;
+
+/**
+@class FunctionDom
+Safe pointer to the @ref FunctionModel.
+This is a type definition: @code typedef KSharedPtr<FunctionModel> FunctionDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<FunctionModel> FunctionDom;
+
+/**
+@class FunctionDefinitionDom
+Safe pointer to the @ref FunctionDefinitionModel.
+This is a type definition: @code typedef KSharedPtr<FunctionDefinitionModel> FunctionDefinitionDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<FunctionDefinitionModel> FunctionDefinitionDom;
+
+/**
+@class VariableDom
+Safe pointer to the @ref VariableModel.
+This is a type definition: @code typedef KSharedPtr<VariableModel> VariableDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<VariableModel> VariableDom;
+
+/**
+@class ArgumentDom
+Safe pointer to the @ref ArgumentModel.
+This is a type definition: @code typedef KSharedPtr<ArgumentModel> ArgumentDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<ArgumentModel> ArgumentDom;
+
+/**
+@class EnumDom
+Safe pointer to the @ref EnumModel.
+This is a type definition: @code typedef KSharedPtr<EnumModel> EnumDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<EnumModel> EnumDom;
+
+/**
+@class TypeAliasDom
+Safe pointer to the @ref TypeAliasModel.
+This is a type definition: @code typedef KSharedPtr<TypeAliasModel> TypeAliasDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<TypeAliasModel> TypeAliasDom;
+
+/**
+@class EnumeratorDom
+Safe pointer to the @ref EnumeratorModel.
+This is a type definition: @code typedef KSharedPtr<EnumeratorModel> EnumeratorDom; @endcode
+@sa KSharedPtr
+*/
+typedef KSharedPtr<EnumeratorModel> EnumeratorDom;
+
+/**
+@class ItemList
+The list of code model items.
+This is a type definition: @code typedef QValueList<ItemDom> ItemList; @endcode
+@sa QValueList
+*/
+typedef QValueList<ItemDom> ItemList;
+
+/**
+@class FileList
+The list of code model files.
+This is a type definition: @code typedef QValueList<FileDom> FileList; @endcode
+@sa QValueList
+*/
+typedef QValueList<FileDom> FileList;
+
+/**
+@class NamespaceList
+The list of code model namespaces.
+This is a type definition: @code typedef QValueList<NamespaceDom> NamespaceList; @endcode
+@sa QValueList
+*/
+typedef QValueList<NamespaceDom> NamespaceList;
+
+/**
+@class ClassList
+The list of code model classes.
+This is a type definition: @code typedef QValueList<ClassDom> ClassList; @endcode
+@sa QValueList
+*/
+typedef QValueList<ClassDom> ClassList;
+
+/**
+@class FunctionList
+The list of code model functions.
+This is a type definition: @code typedef QValueList<FunctionDom> FunctionList; @endcode
+@sa QValueList
+*/
+typedef QValueList<FunctionDom> FunctionList;
+
+/**
+@class FunctionDefinitionList
+The list of code model function definitions.
+This is a type definition: @code typedef QValueList<FunctionDefinitionDom> FunctionDefinitionList; @endcode
+@sa QValueList
+*/
+
+typedef QValueList<FunctionDefinitionDom> FunctionDefinitionList;
+/**
+@class VariableList
+The list of code model variables.
+This is a type definition: @code typedef QValueList<VariableDom> VariableList; @endcode
+@sa QValueList
+*/
+typedef QValueList<VariableDom> VariableList;
+
+/**
+@class ArgumentList
+The list of code model arguments.
+This is a type definition: @code typedef QValueList<ArgumentDom> ArgumentList; @endcode
+@sa QValueList
+*/
+typedef QValueList<ArgumentDom> ArgumentList;
+
+/**
+@class EnumList
+The list of code model enums.
+This is a type definition: @code typedef QValueList<EnumDom> EnumList; @endcode
+@sa QValueList
+*/
+typedef QValueList<EnumDom> EnumList;
+
+/**
+@class TypeAliasList
+The list of code model type aliases.
+This is a type definition: @code typedef QValueList<TypeAliasDom> TypeAliasList; @endcode
+@sa QValueList
+*/
+typedef QValueList<TypeAliasDom> TypeAliasList;
+
+/**
+@class EnumeratorList
+The list of code model enumerators.
+This is a type definition: @code typedef QValueList<EnumeratorDom> EnumeratorList; @endcode
+@sa QValueList
+*/
+typedef QValueList<EnumeratorDom> EnumeratorList;
+
+/**
+Iterates through @p lst and creates sorted list of code model item names.
+Can be used, for example, to get the list of classes in the store:
+@code
+QStringList classList = sortedNameList(codeModel()->globalNamespace()->classList());
+@endcode
+@param lst The list to iterate.
+@return Sorted list of code model item names.
+*/
+template <class ItemList>
+QStringList sortedNameList( const ItemList& lst )
+{
+ QStringList nameList;
+
+ typename ItemList::ConstIterator it = lst.begin();
+ while( it != lst.end() ){
+ if( !(*it)->name().isEmpty() )
+ nameList << (*it)->name();
+ ++it;
+ }
+
+ nameList.sort();
+ return nameList;
+}
+
+/**
+Casts safe code model pointers (@p KSharedPtr<T> objects like
+FileDom, NamespaceDom, etc.) to the @p Result type.
+
+Example:
+@code
+//ns is of type NamespaceDom
+ClassDom cl = model_cast<ClassDom>(ns);
+@endcode
+@param x Object to cast.
+*/
+template <class Result, class T>
+Result model_cast( KSharedPtr<T> x )
+{
+ Result r( static_cast<T*>(x) );
+ return r;
+}
+
+/**
+Casts code model pointers (objects like
+FileModel, NamespaceModel, etc.) to the @p Result type.
+
+Example:
+@code
+//ns is of type NamespaceModel*
+ClassDom cl = model_cast<ClassDom>(ns);
+@endcode
+@param x Object to cast.
+*/
+template <class Result, class T>
+Result model_cast( T* x )
+{
+ Result r( static_cast<T*>(x) );
+ return r;
+}
+
+
+/**
+Code Model - a memory symbol store.
+Symbol store (aka class store) is a database of symbols
+found in code with the important information about those symbols.
+
+For example, programming language support plugins use symbol store
+to remember information about classes, functions, etc. For each type
+of symbol a certain information can be stored - symbol name, the
+location in source file, etc.
+
+@sa codemodel.h documentation for a list of typedefs and other convenience functions.
+
+@sa codemodel_utils.h documentation for an additional code model utility functions and classes reference.
+*/
+class CodeModel
+{
+public:
+ /**Constructor.*/
+ CodeModel();
+ /**Destructor.*/
+ virtual ~CodeModel();
+
+ /**Creates a code model item. This should be used to create
+ code model items.
+
+ For example, to create a class model somewhere in your plugin, use:
+ @code
+ klass = codeModel()->create<ClassModel>();
+ klass->setName("ClassName");
+ klass->setFileName("FileName");
+ klass->setStartPosition(line, column);
+ @endcode
+ @return Created code model item.*/
+ template <class T> typename T::Ptr create()
+ {
+ typename T::Ptr ptr( new T(this) );
+ return ptr;
+ }
+
+ /**Resets the CodeModel.*/
+ void wipeout();
+
+ /**Gets the list of files in the store.
+ @return The FileList object that contains the list of files.*/
+ FileList fileList();
+
+ /**Gets the list of files in the store.
+ This is a const version for convenience.
+ @return The FileList object that contains the list of files.*/
+ const FileList fileList() const;
+
+ /**Checks to see if a file is in the store.
+ @return true if @p name is in the file list.*/
+ bool hasFile( const QString& name ) const;
+
+ /**Gets the FileDom object for a file.
+ @param name The name of the file to get the FileDom object for.*/
+ FileDom fileByName( const QString& name );
+
+ /**Gets the FileDom object for a file.
+ This is a const version provided for convenience.
+ @param name the name of the file to get the FileDom object for.*/
+ const FileDom fileByName( const QString& name ) const;
+
+ /**Adds a file to the store.
+ @param file The FileDom object to add to the store.
+ @return true if the file was added successfully.*/
+ bool addFile( FileDom file );
+
+ /**Removes a file from the store.
+ @param file the FileDom object to remove from the store.*/
+ void removeFile( FileDom file );
+
+ /**Gets the global namespace
+ @return The NamespaceDom object that represents the global namespace.*/
+ const NamespaceDom globalNamespace() const;
+
+ /**Reads the model from a stream.
+ Use this to save the memory symbol store to a file.
+
+ Language support plugins usually save symbols from projects before the project is
+ closed to avoid reparsing when the project is opened next time.
+ @param stream Stream to read from.
+ @return whether the read succeeded(may fail when the store-format is deprecated).*/
+ virtual void read( QDataStream& stream );
+ /**Writes the model to a stream.
+ Use this to restore the memory symbol store to a file.
+
+ Language support plugins usually save symbols from projects before the project is
+ closed to avoid reparsing when the project is opened next time.
+ @param stream Stream to write to.*/
+ virtual void write( QDataStream& stream ) const;
+
+ /** this will dump the whole tree into dot-file-format so it can be inspected, not ready yet*/
+ virtual void dump( std::ostream& file, QString Info="" );
+
+ /** Merges two groups, by changing the group-ids of the files.
+ Returns the id of the new group, or 0 on fail.
+ @param g1 first group
+ @param g2 second group */
+ int mergeGroups( int g1, int g2 );
+
+ /** Returns all files within the given group
+ it should be preferred calling FileModel::wholeGroup and
+ FileModel::wholeGroupStrings because those return in constant
+ time if they are the only member of the group */
+ FileList getGroup( int gid ) const;
+
+ FileList getGroup( const FileDom& file) const;
+
+ /** Same as above, but returns the names instead of the objects */
+ virtual QStringList getGroupStrings( int gid ) const;
+
+private:
+ /**Adds a namespace to the store.
+ @param target The NamespaceDom object that the namespace will be added to.
+ @param source The NamespaceDom object that contains the namespace to remove.*/
+ void addNamespace( NamespaceDom target, NamespaceDom source );
+
+ /**Removes a namespace from the store.
+ @param target The NamespaceDom object that the namespace will be removed from.
+ @param source The NamespaceDom object that contains the namespace to remove.*/
+ void removeNamespace( NamespaceDom target, NamespaceDom source );
+
+private:
+ QMap<QString, FileDom> m_files;
+ NamespaceDom m_globalNamespace;
+
+ virtual int newGroupId();
+ ///the groups were introduced to represent dependencies between different files.
+ ///Files can have slaves that are owned by other files within the same group.
+ ///While parsing, whole groups should always be parsed/reparsed together.
+ int m_currentGroupId; ///normally, each file has its own group.
+
+private:
+ CodeModel( const CodeModel& source );
+ void operator = ( const CodeModel& source );
+ friend class CodeModelItem;
+ friend class FileModel;
+};
+
+
+/**
+Item in code model (symbol store).
+Item is a symbol in a store. Code model provides several predefined classes
+for predefined item types (files, namespaces, classes, functions and function definitions,
+variables, arguments, enums and enumerators, type aliases.
+
+Instances of this class should be created using @ref CodeModel::create method but usually
+it is better to create instances of derived classes like ClassModel, NamespaceModel, FileModel, etc.
+*/
+class CodeModelItem: public KShared
+{
+public:
+ /**A definition of safe pointer to the code model item.*/
+ typedef ItemDom Ptr;
+
+ /**A type of a code model item.*/
+ enum Kind
+ {
+ File, /**<File.*/
+ Namespace, /**<Namespace.*/
+ Class, /**<Class.*/
+ Function, /**<Function or class method.*/
+ Variable, /**<Variable.*/
+ Argument, /**<Function or method parameter.*/
+ FunctionDefinition, /**<Function definition.*/
+ Enum, /**<Enum.*/
+ Enumerator, /**<Enumerator - a member of an Enum (example: @code enum Type { A, B, C} @endcode
+ Type will be an Enum; A, B and C - Enumerators.*/
+ TypeAlias, /**<Type alias (aka typedef in c++).*/
+
+ Custom = 1000 /**<Custom model items should have type greater than 1000*/
+ };
+
+ /**An access to the code model item.*/
+ enum Access
+ {
+ Public, /**<Public.*/
+ Protected, /**<Protected.*/
+ Private /**<Private.*/
+ };
+ void update( const CodeModelItem* i );
+ bool canUpdate( const CodeModelItem* i ) const;
+
+protected:
+ /**Constructor.
+ @param kind The type, see also @ref CodeModelItem::Kind.
+ @param model Code model which stores this item.*/
+ CodeModelItem( int kind, CodeModel* model );
+
+public:
+ /**Destructor.*/
+ virtual ~CodeModelItem();
+
+ /**@return The type (kind) of item.*/
+ int kind() const { return m_kind; }
+
+ /**Sets the type (kind) of item.
+ @param kind The type, see also @ref CodeModelItem::Kind.*/
+ void setKind( int kind ) { m_kind = kind; }
+
+ /**@return The name of the item.*/
+ QString name() const;
+
+ QString comment() const {
+ return m_comment;
+ }
+
+ void setComment( QString comment ) {
+ m_comment = comment;
+ }
+
+ /**Sets the name of the item.
+ @param name The name.*/
+ void setName( const QString& name );
+
+ /**Gets the file of the item.
+ @return The FileDom object for the item.*/
+ FileDom file();
+
+ /**Gets the file of the item
+ This is a const version provided for convenience.
+ @return The FileDom object for the item.*/
+ const FileDom file() const;
+
+ /**@return The filename of the item.*/
+ QString fileName() const;
+
+ /**Sets the filename of the item.
+ @param fileName The file name.*/
+ void setFileName( const QString& fileName );
+
+ /**Gets the start position of the item.
+ @param line Will be set to the line number of the items start position. Pass 0 if line number is not necessary.
+ @param col Will be set to the column number of the items start position. Pass 0 if column number is not necessary.*/
+ void getStartPosition( int* line, int* col ) const;
+
+ /**Sets the start position of the item.
+ @param line Line number.
+ @param col Column number.*/
+ void setStartPosition( int line, int col );
+
+ /**Get the end position of the item.
+ @param line Will be set to the line number of the items end position. Pass 0 if line number is not necessary.
+ @param col Will be set to the column number of the items end position. Pass 0 if column number is not necessary.*/
+ void getEndPosition( int* line, int* col ) const;
+
+ /**Set the end position of the item.
+ @param line Line number.
+ @param col Column number.*/
+ void setEndPosition( int line, int col );
+
+ /**@return true if an item is a FileModel.*/
+ virtual bool isFile() const { return false; }
+ /**@return true if an item is a NamespaceModel.*/
+ virtual bool isNamespace() const { return false; }
+ /**@return true if an item is a ClassModel.*/
+ virtual bool isClass() const { return false; }
+ /**@return true if an item is a FunctionModel.*/
+ virtual bool isFunction() const { return false; }
+ /**@return true if an item is a FileDefinitionModel.*/
+ virtual bool isFunctionDefinition() const { return false; }
+ /**@return true if an item is a VariableModel.*/
+ virtual bool isVariable() const { return false; }
+ /**@return true if an item is an ArgumentModel.*/
+ virtual bool isArgument() const { return false; }
+ /**@return true if an item is a EnumModel.*/
+ virtual bool isEnum() const { return false; }
+ /**@return true if an item is a EnumeratorModel.*/
+ virtual bool isEnumerator() const { return false; }
+ /**@return true if an item is a TypeAliasModel.*/
+ virtual bool isTypeAlias() const { return false; }
+ /**@return true if an item is a custom item.*/
+ virtual bool isCustom() const { return false; }
+
+ virtual bool isTemplateable() const { return false; }
+
+ /**Reads an item from the stream.
+ @param stream The stream to read from.*/
+ virtual void read( QDataStream& stream );
+ /**Writes an item to the stream.
+ @param stream The stream to write to.*/
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ /**@return The code model for this item.*/
+ CodeModel* codeModel() { return m_model; }
+
+ /**@note This is a const version provided for convenience.
+ @return The code model for this item*/
+ const CodeModel* codeModel() const { return m_model; }
+
+private:
+ int m_kind;
+ CodeModel* m_model;
+ QString m_name;
+ QString m_fileName;
+ QString m_comment; ///not stored yet
+ int m_startLine, m_startColumn;
+ int m_endLine, m_endColumn;
+
+private:
+ CodeModelItem( const CodeModelItem& source );
+ void operator = ( const CodeModelItem& source );
+};
+
+
+
+class TemplateModelItem {
+ public:
+ typedef QPair< QString, QString > ParamPair;
+ typedef QValueVector< ParamPair > ParamMap; ///The first is the name, and the second the default-parameter, or "" if there is none.
+
+ virtual const ParamMap& getTemplateParams() {
+ return m_params;
+ }
+
+ virtual void addTemplateParam( QString name, QString def = "" ) {
+ m_params.push_back( ParamPair( name, def ) );
+ }
+
+ virtual void clearTemplateParams() {
+ m_params.clear();
+ }
+
+ bool hasSpecializationDeclaration() const {
+ return !m_specialization.isEmpty();
+ }
+
+ virtual QString getSpecializationDeclaration() const {
+ return m_specialization;
+ }
+
+ void setSpecializationDeclaration( const QString& str ) {
+ m_specialization = str;
+ }
+
+ ///returns -1 if the parameter does not exist
+ virtual int findTemplateParam( const QString& name ) const {
+ for( unsigned int a = 0; a< m_params.size(); a++)
+ if( m_params[a].first == name ) return a;
+ return -1;
+ }
+
+ const ParamPair getParam( int index ) const {
+ return m_params[index];
+ }
+
+ virtual bool isTemplateable() const { return true; }
+
+ void write( QDataStream & stream ) const {
+ stream << m_specialization;
+ stream << (int)m_params.size();
+ for( ParamMap::const_iterator it = m_params.begin(); it != m_params.end(); ++it ) {
+ stream << (*it).first;
+ stream << (*it).second;
+ }
+ }
+
+ void read( QDataStream & stream ) {
+ int count;
+ stream >> m_specialization;
+ stream >> count;
+ for( int a = 0; a < count; a++ ) {
+ ParamPair tmp;
+ stream >> tmp.first;
+ stream >> tmp.second;
+ m_params.push_back( tmp );
+ }
+ }
+
+ protected:
+ ParamMap m_params;
+ QString m_specialization;
+};
+
+
+
+/**
+Class model.
+Represents a class in the code model.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class ClassModel: public CodeModelItem, public TemplateModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ ClassModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the class model.*/
+ typedef ClassDom Ptr;
+
+ virtual bool isClass() const { return true; }
+
+ /**@return The scope of the class. Scope is a string list composed from names of parent classes and namespaces.*/
+ QStringList scope() const { return m_scope; }
+ /**Sets the scope of this class.
+ @param scope The scope - a list of parent classes and namespaces.*/
+ void setScope( const QStringList& scope ) { m_scope = scope; }
+
+ /**@return The list of base class names.*/
+ QStringList baseClassList() const;
+
+ /**Adds a base class to the list of base classes.
+ @param baseClass The base class name.*/
+ bool addBaseClass( const QString& baseClass );
+
+ /**Removes a base class from the list of base classes.
+ @param baseClass The base class name.*/
+ void removeBaseClass( const QString& baseClass );
+
+ /**@return The list of (sub)classes in this model.*/
+ ClassList classList();
+
+ /**@note This is a const version provided for convenience.
+ @return The list of (sub)classes in this model.*/
+ const ClassList classList() const;
+
+ /**Checks if the class specified by @p name is in this model.
+ @param name The name of a class to look for.
+ @return true if the model has a class.*/
+ bool hasClass( const QString& name ) const;
+
+ /**@param name The name of a class.
+ @return A list of classes that match the name given by @p name.*/
+ ClassList classByName( const QString& name );
+
+ /**@param name The name of a class.
+ @return A list of classes that match the name given by @p name.
+ @note This is a const version provided for convenience.*/
+ const ClassList classByName( const QString& name ) const;
+
+ /**Adds a class to the model.
+ @param klass The class model to add.
+ @return true if addition was successful.*/
+ bool addClass( ClassDom klass );
+
+ /**Removes a class from the model.
+ @param klass The class model to remove.*/
+ void removeClass( ClassDom klass );
+
+ /**@return A list of functions in the model.*/
+ FunctionList functionList();
+
+ /**@return A list of functions in the model.
+ @note This is a const version provided for convenience.*/
+ const FunctionList functionList() const;
+
+ /**Check if the function specified by @p name is in the model.
+ @param name The name of a function to look for.
+ @return true if the model has a class.*/
+ bool hasFunction( const QString& name ) const;
+
+ /**@param name The name of a function to look for.
+ @return A list of functions that match the name given by @p name.*/
+ FunctionList functionByName( const QString& name );
+
+ /**@param name The name of a function to look for.
+ @return A list of functions that match the name given by @p name.
+ @note This is a const version provided for convenience.*/
+ const FunctionList functionByName( const QString& name ) const;
+
+ /**Adds a function to the class model.
+ @param fun The function model to add.
+ @return true if addition was successful.*/
+ bool addFunction( FunctionDom fun );
+
+ /**Removes a function from the class model.
+ @param fun The FunctionDom object to remove from the model.*/
+ void removeFunction( FunctionDom fun );
+
+ /**@return The list of function definitions in the model.*/
+ FunctionDefinitionList functionDefinitionList();
+
+ /**@return The list of function definitions
+ @note This is a const version provided for convenience.*/
+ const FunctionDefinitionList functionDefinitionList() const;
+
+ /**Checks if the function definition specified by \p name is in the model.
+ @param name The name of a function definition to look for.
+ @return true if the function definition was found.*/
+ bool hasFunctionDefinition( const QString& name ) const;
+
+ /**Gets the list of functions that match the name given by \p name.
+ If there are no matches, then the list returned is empty.
+ @param name The name of a function definition to look for.
+ @return The FunctionDefinitionList object containing the definitions that match.*/
+ FunctionDefinitionList functionDefinitionByName( const QString& name );
+
+ /**Gets the list of functions that match the name given by \p name.
+ If there are no matches, then the list returned is empty.
+ @param name The name of a function definition to look for.
+ @return The FunctionDefinitionList object containing the definitions that match.
+ @note This is a const version provided for convenience.*/
+ const FunctionDefinitionList functionDefinitionByName( const QString& name ) const;
+
+ /**Adds a function definition to the model.
+ @param fun The function fefinition model to add to the model.
+ @return true if the addition was successful.*/
+ bool addFunctionDefinition( FunctionDefinitionDom fun );
+
+ /**Removes a function definition from the model.
+ @param fun The function fefinition model to remove from the model.*/
+ void removeFunctionDefinition( FunctionDefinitionDom fun );
+
+ /**@return The list of variables in the model.*/
+ VariableList variableList();
+
+ /**@return The list of variables in the model.
+ @note This is a const version provided for convenience.*/
+ const VariableList variableList() const;
+
+ /**Checks if the variable specified by @p name is in the model.
+ @param name The name of a variable.
+ @return true if the variable was found.*/
+ bool hasVariable( const QString& name ) const;
+
+ /**Gets the variable specified by @p name.
+ If there are no matches, then the VariableDom object returned is empty.
+ @param name The name of a variable.
+ @return A VariableDom object that matches the name specified.*/
+ VariableDom variableByName( const QString& name );
+
+ /**Gets the variable specified by @p name.
+ If there are no matches, then the VariableDom object returned is empty.
+ @param name The name of a variable.
+ @return A VariableDom object that matches the name specified.
+ @note This is a const version provided for convenience.*/
+ const VariableDom variableByName( const QString& name ) const;
+
+ /**Adds a variable to the model.
+ @param var The variable model to add to the model.
+ @return true if the addition was successful.*/
+ bool addVariable( VariableDom var );
+
+ /**Removes a variable from the model.
+ @param var The variable model to remove from the model.*/
+ void removeVariable( VariableDom var );
+
+ /**@return The type alias list for this model.*/
+ TypeAliasList typeAliasList();
+
+ /**@return The type alias list for this model.
+ @note This is a const version provided for convenience.*/
+ const TypeAliasList typeAliasList() const;
+
+ /**Checks if the type alias specified by @p name is in the model.
+ @param name The name of a type alias.
+ @return true if the type alias was found.*/
+ bool hasTypeAlias( const QString& name ) const;
+
+ /**Gets the list of type aliases that match @p name.
+ If there are no matches, the TypeAliasList object is empty.
+ @param name The name of a type alias.
+ @return A TypeAliasList object that contains the matches.*/
+ TypeAliasList typeAliasByName( const QString& name );
+
+ /**Gets the list of type aliases that match @p name.
+ If there are no matches, the TypeAliasList object is empty.
+ @param name The name of a type alias.
+ @return A TypeAliasList object that contains the matches.
+ @note This is a const version provided for convenience.*/
+ const TypeAliasList typeAliasByName( const QString& name ) const;
+
+ /**Adds a type alias to the model.
+ @param typeAlias The type alias model to add to the model.
+ @return true if the addition was successful.*/
+ bool addTypeAlias( TypeAliasDom typeAlias );
+
+ /**Removes a type alias from the model.
+ @param typeAlias The TypeAliasDom object to remove from the model.*/
+ void removeTypeAlias( TypeAliasDom typeAlias );
+
+ /**@return The list of enums in the model.*/
+ EnumList enumList();
+
+ /**@return The list of enums in the model.
+ @note This is a const version provided for convenience.*/
+ const EnumList enumList() const;
+
+ /**Checks if the enum specified by @p name is in the model.
+ @param name The name of an enum.
+ @return true if the enum was found.*/
+ bool hasEnum( const QString& name ) const;
+
+ /**Gets the enum specified by @p name.
+ The EnumDom object returned will be empty if no match is found.
+ @param name The name of an enum.
+ @return The EnumDom object that contains the match.*/
+ EnumDom enumByName( const QString& name );
+
+ /**Gets the enum specified by @p name.
+ The EnumDom object returned will be empty if no match is found.
+ @param name The name of an enum.
+ @return The EnumDom object that contains the match.*/
+ const EnumDom enumByName( const QString& name ) const;
+
+ /**Adds an enum to the model.
+ @param e The enum model to add to the model.
+ @return true if the addition was successful.*/
+ bool addEnum( EnumDom e );
+
+ /**Removes an enum from the model.
+ @param e The enum model to remove from the model.*/
+ void removeEnum( EnumDom e );
+
+ void update( const ClassModel* i );
+ bool canUpdate( const ClassModel* i ) const;
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+private:
+ QStringList m_scope;
+ QStringList m_baseClassList;
+ QMap<QString, ClassList> m_classes;
+ QMap<QString, FunctionList> m_functions;
+ QMap<QString, FunctionDefinitionList> m_functionDefinitions;
+ QMap<QString, VariableDom> m_variables;
+ QMap<QString, TypeAliasList> m_typeAliases;
+ QMap<QString, EnumDom> m_enumerators;
+
+private:
+ ClassModel( const ClassModel& source );
+ void operator = ( const ClassModel& source );
+ friend class CodeModel;
+};
+
+class NamespaceAliasModel {
+public:
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ QString name() const {
+ return m_name;
+ }
+
+ void setName( const QString& name ) {
+ m_name = name;
+ }
+
+ void setAliasName( const QString& theValue ) {
+ m_aliasName = theValue;
+ }
+
+ QString aliasName() const {
+ return m_aliasName;
+ }
+
+ void setFileName( const HashedString& theValue ) {
+ m_fileName = theValue;
+ }
+
+ HashedString fileName() const {
+ return m_fileName;
+ }
+
+ bool operator < ( const NamespaceAliasModel& rhs ) const {
+ if( m_name < rhs.m_name ) return true;
+ if( m_name == rhs.m_name ) {
+ if( m_aliasName < rhs.m_aliasName ) return true;
+ if( m_aliasName == rhs.m_aliasName && m_fileName < rhs.m_fileName ) return true;
+ }
+ return false;
+ }
+
+ bool operator == ( const NamespaceAliasModel& rhs ) const {
+ return m_name == rhs.m_name && m_aliasName == rhs.m_aliasName && m_fileName == rhs.m_fileName;
+ }
+
+private:
+ QString m_name;
+ QString m_aliasName;
+ HashedString m_fileName;
+};
+
+class NamespaceImportModel {
+public:
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ QString name() const {
+ return m_name;
+ }
+
+ HashedString fileName() const {
+ return m_fileName;
+ }
+
+ void setName( const QString& name ) {
+ m_name = name;
+ }
+
+ void setFileName( const HashedString& file ) {
+ m_fileName = file;
+ }
+
+ bool operator < ( const NamespaceImportModel& rhs ) const {
+ if( m_name < rhs.m_name ) return true;
+ if( m_name == rhs.m_name )
+ if( m_fileName < rhs.m_fileName ) return true;
+
+ return false;
+ }
+
+ bool operator == ( const NamespaceImportModel& rhs ) const {
+ return m_name == rhs.m_name && m_fileName == rhs.m_fileName;
+ }
+
+private:
+ QString m_name;
+ HashedString m_fileName;
+};
+
+/**
+Namespace model.
+Represents a namespace in the code model.
+Namespace model can represent either usual c++ namespaces
+and packages or modules from other languages.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class NamespaceModel: public ClassModel
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ NamespaceModel( CodeModel* model );
+
+public:
+ typedef std::set<NamespaceAliasModel> NamespaceAliasModelList; ///I'm using std-sets here, because Qt-3 has no appropriate replacement
+ typedef std::set<NamespaceImportModel> NamespaceImportModelList;
+
+ /**A definition of safe pointer to the namespace model.*/
+ typedef NamespaceDom Ptr;
+
+ virtual bool isClass() const { return false; }
+ virtual bool isNamespace() const { return true; }
+
+ /**@return The list of namespaces in this model.*/
+ NamespaceList namespaceList();
+
+ /**@return The list of namespaces in this model.
+ @note This is a const version provided for convenience.*/
+ const NamespaceList namespaceList() const;
+
+ /**Checks if the namespace referenced by @p name is in the model.
+ @param name The name of a namespace.
+ @return true if the namespace was found.*/
+ bool hasNamespace( const QString& name ) const;
+
+ /**Gets the namespace specified by @p name.
+ If there are no matches, then the NamespaceDom object returned is empty.
+ @param name The name of a namespace.
+ @return The NamespaceDom object that contains the match.*/
+ NamespaceDom namespaceByName( const QString& name );
+
+ /**Gets the namespace specified by @p name.
+ If there are no matches, then the NamespaceDom object returned is empty.
+ @param name The name of a namespace.
+ @return The NamespaceDom object that contains the match.
+ @note This is a const version provided for convenience.*/
+ const NamespaceDom namespaceByName( const QString& name ) const;
+
+ /**Adds a namespace to the model.
+ @param ns The namespace model to add to the model.
+ @return true if addition was successful.*/
+ bool addNamespace( NamespaceDom ns );
+
+ /**Removes the namespace from the model.
+ @param ns The namespace model to remove from the model.*/
+ void removeNamespace( NamespaceDom ns );
+
+ /**Updates this model so it has the same content as the other one. Only the line/column is updated. canUpdate(..) must be tested before.
+ * @param ns the namespace to match
+ */
+ void update( const NamespaceModel* ns );
+ bool canUpdate( const NamespaceModel* ns ) const;
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ void addNamespaceImport( const NamespaceImportModel& import );
+ void addNamespaceAlias( const NamespaceAliasModel& alias );
+ void removeNamespaceImport( const NamespaceImportModel& import );
+ void removeNamespaceAlias( const NamespaceAliasModel& alias );
+
+ ///Must not be called on temporary objects because a reference is returned(for performance-reasons)
+ const NamespaceAliasModelList& namespaceAliases() const {
+ return m_namespaceAliases;
+ }
+
+ ///Must not be called on temporary objects because a reference is returned(for performance-reasons)
+ const NamespaceImportModelList& namespaceImports() const {
+ return m_namespaceImports;
+ }
+private:
+ QMap<QString, NamespaceDom> m_namespaces;
+ NamespaceAliasModelList m_namespaceAliases;
+ NamespaceImportModelList m_namespaceImports;
+
+private:
+
+ NamespaceModel( const NamespaceModel& source );
+ void operator = ( const NamespaceModel& source );
+ friend class CodeModel;
+};
+
+
+
+
+/**
+File model.
+Represents a file in the code model.
+Files in general contain classes, namespaces, functions,
+types, etc. Therefore FileModel is derived from NamespaceModel.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class FileModel: public NamespaceModel
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ FileModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the file model.*/
+ typedef FileDom Ptr;
+
+ virtual bool isFile() const { return true; }
+
+ virtual int groupId() const {
+ return m_groupId;
+ }
+
+ virtual void setGroupId(int newId) {
+ m_groupId = newId;
+ }
+
+ /** This function additionally does version-checking and
+ should be used instead of read when read should be called
+ from outside.
+ @return whether the read was successful */
+
+ virtual void write( QDataStream& stream ) const;
+
+ FileList wholeGroup() ;
+
+ QStringList wholeGroupStrings() const;
+
+ virtual void read( QDataStream& stream );
+
+ ParseResultPointer parseResult() const;
+ void setParseResult( const ParseResultPointer& result );
+
+ void update( const FileModel* i );
+private:
+ int m_groupId;
+ ParseResultPointer m_parseResult;
+ FileModel( const FileModel& );
+ void operator = ( const FileModel& );
+ friend class CodeModel;
+};
+
+
+/**
+Function (procedure) argument model.
+Represents an argument in the function.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class ArgumentModel: public CodeModelItem
+{
+protected:
+ ArgumentModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the argument model.*/
+ typedef ArgumentDom Ptr;
+
+ virtual bool isArgument() const { return true; }
+
+ /**@return The type of this argument.*/
+ QString type() const;
+
+ /**Sets the type of this argument.
+ @param type The type to set.*/
+ void setType( const QString& type );
+
+ /**@return The default value of this argument.*/
+ QString defaultValue() const;
+
+ /**Sets the default value of this argument.
+ @param defaultValue The default value to set.*/
+ void setDefaultValue( const QString& defaultValue );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+private:
+ QString m_type;
+ QString m_defaultValue;
+
+private:
+ ArgumentModel( const ArgumentModel& source );
+ void operator = ( const ArgumentModel& source );
+ friend class CodeModel;
+};
+
+
+/**
+Function model.
+Represents:
+- functions;
+- procedures;
+- class methods;
+.
+In languages that have separate function declarations and definitions (c++)
+this represents only function declarations. @see FunctionDefinitionModel
+for a model of function definitions.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class FunctionModel: public CodeModelItem, public TemplateModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ FunctionModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the function model.*/
+ typedef FunctionDom Ptr;
+
+ virtual bool isFunction() const { return true; }
+
+ /**@return The scope of the function. Scope is a string list composed
+ from names of parent functions, classes and namespaces.*/
+ QStringList scope() const { return m_scope; }
+
+ /**Sets the scope of the function.
+ @param scope The scope to set.*/
+ void setScope( const QStringList& scope ) { m_scope = scope; }
+
+ /**@return The access level of the function. Can return either values of type @ref CodeModelItem::Access or
+ other integers if the function has other access level (for example pascal methods can have "published"
+ access level).*/
+ int access() const;
+
+ /**Sets the access level of the function.
+ @param access The access level.*/
+ void setAccess( int access );
+
+ /**@return true if the function is a signal.*/
+ bool isSignal() const;
+ /**Sets the function to be a signal.
+ @param isSignal The signal flag.*/
+ void setSignal( bool isSignal );
+
+ /**@return true if the function is a slot.*/
+ bool isSlot() const;
+ /**Sets the function to be a slot.
+ @param isSlot The slot flag.*/
+ void setSlot( bool isSlot );
+
+ /**@return true if the function is a virtual function.*/
+ bool isVirtual() const;
+ /**Sets the function to be a virtual function.
+ @param isVirtual The virtual flag.*/
+ void setVirtual( bool isVirtual );
+
+ /**@return true if the function is a static function.*/
+ bool isStatic() const;
+ /**Sets the function to be a static function.
+ @param isStatic The static flag.*/
+ void setStatic( bool isStatic );
+
+ /**@return true if the function is an inline function.*/
+ bool isInline() const;
+ /**Sets the function to be an inline function.
+ @param isInline The inline flag.*/
+ void setInline( bool isInline );
+
+ /**@return true if the function is a constant function.*/
+ bool isConstant() const;
+ /**Sets the function to be a constant function.
+ @param isConstant The constant flag.*/
+ void setConstant( bool isConstant );
+
+ /**@return true if the function is an abstract function.*/
+ bool isAbstract() const;
+ /**Sets the function to be an inline function.
+ @param isAbstract The abstract flag.*/
+ void setAbstract( bool isAbstract );
+
+ /**@return The result type of a function.*/
+ QString resultType() const;
+ /**Sets the result type of a function.
+ @param type The type of a function result.*/
+ void setResultType( const QString& type );
+
+ /**Gets the list of arguments being passed to the function.
+ If there are no arguments, then the list is empty.
+ @return The ArgumentList object that contains the arguments for this function.*/
+ ArgumentList argumentList();
+
+ /**Gets the list of arguments being passed to the function.
+ If there are no arguments, then the list is empty.
+ @return The ArgumentList object that contains the arguments for this function.
+ @note This is a const version provided for convenience.*/
+ const ArgumentList argumentList() const;
+
+ /**Adds an argument to the function.
+ @param arg The argument model to add as an argument to the function.
+ @return true if the addition was successful.*/
+ bool addArgument( ArgumentDom arg );
+
+ /**Removes an argument from the function.
+ @param arg The argument model to remove from the function.*/
+ void removeArgument( ArgumentDom arg );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ void update( const FunctionModel* i );
+ bool canUpdate( const FunctionModel* i ) const;
+
+private:
+ QStringList m_scope;
+ int m_access;
+
+ union {
+ struct {
+ int m_signal : 1;
+ int m_slot : 1;
+ int m_virtual : 1;
+ int m_static : 1;
+ int m_inline : 1;
+ int m_constant : 1;
+ int m_abstract : 1;
+ } v;
+ int flags;
+ } d;
+
+ QString m_resultType;
+ ArgumentList m_arguments;
+
+private:
+ FunctionModel( const FunctionModel& source );
+ void operator = ( const FunctionModel& source );
+ friend class CodeModel;
+};
+
+/**
+Function model.
+Represents function definition for languages that have such.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class FunctionDefinitionModel: public FunctionModel
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ FunctionDefinitionModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the function definition model.*/
+ typedef FunctionDefinitionDom Ptr;
+
+ virtual bool isFunctionDefinition() const { return true; }
+
+private:
+ FunctionDefinitionModel( const FunctionDefinitionModel& source );
+ void operator = ( const FunctionDefinitionModel& source );
+ friend class CodeModel;
+};
+
+
+/**
+Variable model.
+Represents variables and class attributes.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class VariableModel: public CodeModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ VariableModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the variable model.*/
+ typedef VariableDom Ptr;
+
+ virtual bool isVariable() const { return true; }
+
+ /**@return The access level of the variable. Can return either values of type @ref CodeModelItem::Access or
+ other integers if the variable has other access level (for example pascal attributes can have "published"
+ access level).*/
+ int access() const;
+ /**Sets the access level of the variable.
+ @param access The access level.*/
+ void setAccess( int access );
+
+ /**@return true if the variable is a static variable.*/
+ bool isStatic() const;
+ /**Sets the variable to be a static variable.
+ @param isStatic The static flag.*/
+ void setStatic( bool isStatic );
+
+ /**@return A type of the variable.*/
+ QString type() const;
+ /**Sets the type of the variable.
+ @param type The type name.*/
+ void setType( const QString& type );
+
+ /**@return If this is an enumerator, the enum it is part of, else an empty string. This is just a hack, necessary because EnumeratorModel is not used at all by the cpp-code-model. */
+ bool isEnumeratorVariable() const;
+
+ void setEnumeratorVariable( bool b );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ void update( const VariableModel* i );
+ bool canUpdate( const VariableModel* i ) const;
+
+private:
+ int m_access;
+ int m_static;
+ QString m_type;
+ int m_isEnumeratorVariable;
+
+private:
+ VariableModel( const VariableModel& source );
+ void operator = ( const VariableModel& source );
+ friend class CodeModel;
+};
+
+
+/**
+Enum model.
+Represents enums.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class EnumModel: public CodeModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ EnumModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the enum model.*/
+ typedef EnumDom Ptr;
+
+ virtual bool isEnum() const { return true; }
+
+ /**@return The access level of the enum. Can return either values
+ of type @ref CodeModelItem::Access or other integers if the enum has other access level.*/
+ int access() const;
+ /**Sets the access level of the enum.
+ @param access The access level.*/
+ void setAccess( int access );
+
+ /**@return The list of enumerators in this enum.*/
+ EnumeratorList enumeratorList();
+ /**@return The list of enumerators in this enum.
+ @note This is a const version provided for convenience.*/
+ const EnumeratorList enumeratorList() const;
+ /**Adds an enumerator to the model.
+ @param e The enumerator model to add.*/
+ void addEnumerator( EnumeratorDom e );
+ /**Removes an enumerator from the model.
+ @param e The enumerator model to remove.*/
+ void removeEnumerator( EnumeratorDom e );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ ///The dump-function is not ready yet
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ void update( const EnumModel* i );
+ bool canUpdate( const EnumModel* i ) const;
+
+private:
+ int m_access;
+ QMap<QString, EnumeratorDom> m_enumerators;
+
+private:
+ EnumModel( const EnumModel& source );
+ void operator = ( const EnumModel& source );
+ friend class CodeModel;
+};
+
+
+/**
+Enumerator model.
+Represents enumerators. Enums consist of enumerators, for example in code:
+@code
+enum Type { A, B, C};
+@endcode
+Type is represented as EnumModel;\n
+A, B, C are represented with EnumeratorModel.
+
+Instances of this class should be created using @ref CodeModel::create method.
+*/
+class EnumeratorModel: public CodeModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ EnumeratorModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the enumerator model.*/
+ typedef EnumeratorDom Ptr;
+
+ virtual bool isEnumerator() const { return true; }
+
+ /**@return The value of an enumerator.*/
+ QString value() const;
+ /**Sets the value of an enumerator.
+ @param value The value.*/
+ void setValue( const QString& value );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+private:
+ QString m_value;
+
+private:
+ EnumeratorModel( const EnumeratorModel& source );
+ void operator = ( const EnumeratorModel& source );
+ friend class CodeModel;
+};
+
+
+/**
+Type alias model.
+Represents type aliases (like subtypes/derived types in Ada and typedefs in c++).
+*/
+class TypeAliasModel: public CodeModelItem
+{
+protected:
+ /**Constructor.
+ @param model Code model which stores this item.*/
+ TypeAliasModel( CodeModel* model );
+
+public:
+ /**A definition of safe pointer to the type alias model.*/
+ typedef TypeAliasDom Ptr;
+
+ virtual bool isTypeAlias() const { return true; }
+
+ /**@return The actual type of an alias.*/
+ QString type() const;
+ /**Sets the type of an alias.
+ @param type The type name.*/
+ void setType( const QString& type );
+
+ virtual void read( QDataStream& stream );
+ virtual void write( QDataStream& stream ) const;
+
+
+ virtual void dump( std::ostream& file, bool recurse=false, QString Info="" );
+
+ void update( const TypeAliasModel* i );
+ bool canUpdate( const TypeAliasModel* i ) const;
+
+private:
+ QString m_type;
+
+private:
+ TypeAliasModel( const TypeAliasModel& source );
+ void operator = ( const TypeAliasModel& source );
+ friend class CodeModel;
+};
+
+#endif
diff --git a/lib/interfaces/codemodel_treeparser.cpp b/lib/interfaces/codemodel_treeparser.cpp
new file mode 100644
index 00000000..b514a90e
--- /dev/null
+++ b/lib/interfaces/codemodel_treeparser.cpp
@@ -0,0 +1,108 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "codemodel.h"
+#include "codemodel_treeparser.h"
+
+CodeModelTreeParser::CodeModelTreeParser( )
+{
+}
+
+CodeModelTreeParser::~CodeModelTreeParser( )
+{
+}
+
+void CodeModelTreeParser::parseCode( const CodeModel * model )
+{
+ const FileList fileList = model->fileList();
+ for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it )
+ parseFile( *it );
+}
+
+void CodeModelTreeParser::parseFile( const FileModel * file )
+{
+ const NamespaceList namespaceList = file->namespaceList();
+ const ClassList classList = file->classList();
+ const FunctionList functionList = file->functionList();
+ const FunctionDefinitionList functionDefinitionList = file->functionDefinitionList();
+ const VariableList variableList = file->variableList();
+
+ for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ parseNamespace( *it );
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ parseClass( *it );
+ for( FunctionList::ConstIterator it=functionList.begin(); it!=functionList.end(); ++it )
+ parseFunction( *it );
+ for( FunctionDefinitionList::ConstIterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ parseFunctionDefinition( *it );
+ for( VariableList::ConstIterator it=variableList.begin(); it!=variableList.end(); ++it )
+ parseVariable( *it );
+}
+
+void CodeModelTreeParser::parseNamespace( const NamespaceModel * ns )
+{
+ const NamespaceList namespaceList = ns->namespaceList();
+ const ClassList classList = ns->classList();
+ const FunctionList functionList = ns->functionList();
+ const FunctionDefinitionList functionDefinitionList = ns->functionDefinitionList();
+ const VariableList variableList = ns->variableList();
+
+ for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ parseNamespace( *it );
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ parseClass( *it );
+ for( FunctionList::ConstIterator it=functionList.begin(); it!=functionList.end(); ++it )
+ parseFunction( *it );
+ for( FunctionDefinitionList::ConstIterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ parseFunctionDefinition( *it );
+ for( VariableList::ConstIterator it=variableList.begin(); it!=variableList.end(); ++it )
+ parseVariable( *it );
+}
+
+void CodeModelTreeParser::parseClass( const ClassModel * klass )
+{
+ const ClassList classList = klass->classList();
+ const FunctionList functionList = klass->functionList();
+ const FunctionDefinitionList functionDefinitionList = klass->functionDefinitionList();
+ const VariableList variableList = klass->variableList();
+
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ parseClass( *it );
+ for( FunctionList::ConstIterator it=functionList.begin(); it!=functionList.end(); ++it )
+ parseFunction( *it );
+ for( FunctionDefinitionList::ConstIterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ parseFunctionDefinition( *it );
+ for( VariableList::ConstIterator it=variableList.begin(); it!=variableList.end(); ++it )
+ parseVariable( *it );
+}
+
+void CodeModelTreeParser::parseFunction( const FunctionModel * /*fun*/ )
+{
+}
+
+void CodeModelTreeParser::parseFunctionDefinition( const FunctionDefinitionModel * /*fun*/ )
+{
+}
+
+void CodeModelTreeParser::parseVariable( const VariableModel * /*var*/ )
+{
+}
+
+
+
diff --git a/lib/interfaces/codemodel_treeparser.h b/lib/interfaces/codemodel_treeparser.h
new file mode 100644
index 00000000..9271ae64
--- /dev/null
+++ b/lib/interfaces/codemodel_treeparser.h
@@ -0,0 +1,85 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef CODEMODEL_TREEPARSER_H
+#define CODEMODEL_TREEPARSER_H
+
+/**
+@file codemodel_treeparser.h
+Tree parser for a code model.
+*/
+
+class FileModel;
+class NamespaceModel;
+class ClassModel;
+class FunctionModel;
+class FunctionDefinitionModel;
+class VariableModel;
+
+/**
+Tree parser for a code model.
+This is a base class which can be subclassed to create a code model "tree parser".
+Such tree parsers can be used to recursively walk through the whole code model
+or its parts and do some actions.
+
+Default implementation only walks through the model and does nothing. You need
+to reimplement necessary virtual methods of this class to add desired functionality.
+*/
+class CodeModelTreeParser
+{
+public:
+ /**Constructor.*/
+ CodeModelTreeParser();
+ /**Destructor.*/
+ virtual ~CodeModelTreeParser();
+
+ /**Parses recursively all code in the @p model.
+ @param model CodeModel to parse.*/
+ virtual void parseCode(const CodeModel* model);
+
+ /**Parses recursively all code in the @p file.
+ @param file FileModel to parse.*/
+ virtual void parseFile(const FileModel* file);
+
+ /**Parses recursively all code in the namespace @p ns.
+ @param ns NamespaceModel to parse.*/
+ virtual void parseNamespace(const NamespaceModel* ns);
+
+ /**Parses recursively all code in the class @p klass.
+ @param klass ClassModel to parse.*/
+ virtual void parseClass(const ClassModel* klass);
+
+ /**Parses function (function declaration) @p fun.
+ @param fun FunctionModel to parse.*/
+ virtual void parseFunction(const FunctionModel* fun);
+
+ /**Parses function definition @p fun.
+ @param fun FunctionDefinitionModel to parse.*/
+ virtual void parseFunctionDefinition(const FunctionDefinitionModel* fun);
+
+ /**Parses variable @p var.
+ @param var VariableModel to parse.*/
+ virtual void parseVariable(const VariableModel* var);
+
+private:
+ CodeModelTreeParser( const CodeModelTreeParser& source );
+ void operator = ( const CodeModelTreeParser& source );
+};
+
+#endif
diff --git a/lib/interfaces/codemodel_utils.cpp b/lib/interfaces/codemodel_utils.cpp
new file mode 100644
index 00000000..68211f34
--- /dev/null
+++ b/lib/interfaces/codemodel_utils.cpp
@@ -0,0 +1,747 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003 Alexander Dymo <adymo@kdevelop.org>
+ Copyright (C) 2004 Jonas Jacobi <j.jacobi@gmx.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "codemodel_utils.h"
+
+namespace CodeModelUtils
+{
+
+namespace Functions
+{
+
+void processClasses(FunctionList &list, const ClassDom dom)
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ }
+}
+
+void processNamespaces(FunctionList &list, const NamespaceDom dom)
+{
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list, *it);
+ }
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ }
+}
+
+void processNamespaces( FunctionList & list, const NamespaceDom dom, QMap< FunctionDom, Scope > & relations )
+{
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list, *it, relations);
+ }
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations, dom);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].ns = dom;
+ }
+}
+
+void processClasses( FunctionList & list, const ClassDom dom, QMap< FunctionDom, Scope > & relations )
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].klass = dom;
+ }
+}
+
+void processClasses( FunctionList & list, const ClassDom dom, QMap< FunctionDom, Scope > & relations, const NamespaceDom & nsdom )
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations, nsdom);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].klass = dom;
+ relations[*it].ns = nsdom;
+ }
+}
+
+} // end of Functions namespace
+
+
+
+namespace FunctionDefinitions
+{
+
+void processClasses(FunctionDefinitionList &list, const ClassDom dom)
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ }
+}
+
+void processNamespaces(FunctionDefinitionList &list, const NamespaceDom dom)
+{
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list, *it);
+ }
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ }
+}
+
+void processNamespaces( FunctionDefinitionList & list, const NamespaceDom dom, QMap< FunctionDefinitionDom, Scope > & relations )
+{
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list, *it, relations);
+ }
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations, dom);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].ns = dom;
+ }
+}
+
+void processClasses( FunctionDefinitionList & list, const ClassDom dom, QMap< FunctionDefinitionDom, Scope > & relations )
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].klass = dom;
+ }
+}
+
+void processClasses( FunctionDefinitionList & list, const ClassDom dom, QMap< FunctionDefinitionDom, Scope > & relations, const NamespaceDom & nsdom )
+{
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it, relations, nsdom);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ relations[*it].klass = dom;
+ relations[*it].ns = nsdom;
+ }
+}
+
+} // end of FunctionDefinitions namespace
+
+
+
+FunctionList allFunctions(const FileDom &dom)
+{
+ using namespace Functions;
+ FunctionList list;
+
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list, *it);
+ }
+
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list, *it);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.append(*it);
+ }
+
+ return list;
+}
+
+AllFunctions allFunctionsDetailed( const FileDom & dom )
+{
+ using namespace Functions;
+ AllFunctions list;
+
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list.functionList, *it, list.relations);
+ }
+
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list.functionList, *it, list.relations);
+ }
+
+ const FunctionList fnlist = dom->functionList();
+ for (FunctionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.functionList.append(*it);
+ }
+
+ return list;
+}
+
+AllFunctionDefinitions allFunctionDefinitionsDetailed( const FileDom & dom )
+{
+ using namespace FunctionDefinitions;
+ AllFunctionDefinitions list;
+
+ const NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::ConstIterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ processNamespaces(list.functionList, *it, list.relations);
+ }
+
+ const ClassList cllist = dom->classList();
+ for (ClassList::ConstIterator it = cllist.begin(); it != cllist.end(); ++it)
+ {
+ processClasses(list.functionList, *it, list.relations);
+ }
+
+ const FunctionDefinitionList fnlist = dom->functionDefinitionList();
+ for (FunctionDefinitionList::ConstIterator it = fnlist.begin(); it != fnlist.end(); ++it)
+ {
+ list.functionList.append(*it);
+ }
+
+ return list;
+}
+
+
+bool resultTypesFit( const FunctionDom & dec, const FunctionDefinitionDom & def ) {
+ if( !def->resultType().contains("::") ) return dec->resultType() == def->resultType();
+ QStringList l1 = dec->scope() + QStringList::split("::", dec->resultType() );
+ QStringList l2 = QStringList::split("::", def->resultType() );
+
+ if( l1.isEmpty() || l2.isEmpty() || l1.back() != l2.back() ) return false;
+
+ while( !l1.isEmpty() && !l2.isEmpty() ) {
+ if( l1.back() == l2.back() ) {
+ l1.pop_back();
+ l2.pop_back();
+ } else {
+ l1.pop_back();
+ }
+ }
+
+ if( l2.isEmpty() ) return true;
+
+ return false;
+}
+
+
+bool compareDeclarationToDefinition( const FunctionDom & dec, const FunctionDefinitionDom & def )
+{
+ if (dec->scope() == def->scope() && dec->name() == def->name() && resultTypesFit( dec, def ) && dec->isConstant() == def->isConstant())
+ {
+ const ArgumentList defList = def->argumentList(), decList = dec->argumentList();
+ if (defList.size() != decList.size())
+ return false;
+
+ size_t n = defList.size();
+ for(size_t i = 0; i < n; ++i)
+ if (defList[i]->type() != decList[i]->type())
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+
+bool compareDeclarationToDefinition( const FunctionDom & dec, const FunctionDefinitionDom & def, const std::set<NamespaceImportModel> & nsImports )
+{
+ if (dec->name() == def->name() && resultTypesFit( dec, def ) && dec->isConstant() == def->isConstant())
+ {
+ const ArgumentList defList = def->argumentList(), decList = dec->argumentList();
+ if (defList.size() != decList.size())
+ return false;
+
+ size_t n = defList.size();
+ for(size_t i = 0; i < n; ++i)
+ if (defList[i]->type() != decList[i]->type())
+ return false;
+
+ const QStringList &defScope = def->scope(), &decScope = dec->scope();
+ if (defScope != decScope)
+ {
+ if (defScope.size() >= decScope.size())
+ return false;
+
+ n = decScope.size();
+ for(size_t i1 = 0, i2 = 0; i1 < n; ++i1)
+ {
+ if (i2 >= defScope.size() || decScope[i1] != defScope[i2])
+ {
+ NamespaceImportModel model;
+ model.setName(decScope[i1]);
+ model.setFileName(def->fileName());
+ if (nsImports.find(model) == nsImports.end())
+ return false;
+ }
+ else
+ {
+ ++i2;
+ }
+ }
+ }
+
+ return true;
+ }
+ return false;
+}
+
+
+
+FunctionList allFunctionsExhaustive(FileDom &dom) {
+ PredAmOwner<FunctionDom> ow( dom );
+ FunctionList ret;
+
+ findFunctionDeclarations( ow, dom->wholeGroup(), ret );
+
+ return ret;
+}
+
+
+FunctionDefinitionList allFunctionDefinitionsExhaustive(FileDom &dom) {
+ PredAmOwner<FunctionDefinitionDom> ow( dom );
+ FunctionDefinitionList ret;
+
+ findFunctionDefinitions( ow, dom->wholeGroup(), ret );
+
+ return ret;
+}
+
+
+
+ClassDom findClassByPosition( NamespaceModel* nameSpace, int line, int col )
+{
+ if (nameSpace == 0)
+ return 0;
+
+ NamespaceList nsList = nameSpace->namespaceList();
+ for (NamespaceList::iterator i = nsList.begin(); i != nsList.end(); ++i)
+ {
+ ClassDom result = findClassByPosition(*i, line, col);
+ if (result != 0)
+ return result;
+ }
+
+ ClassList classes = nameSpace->classList();
+ for(ClassList::iterator i = classes.begin(); i != classes.end(); ++i)
+ {
+ ClassDom result = findClassByPosition( *i, line, col );
+ if (result != 0)
+ return result;
+ }
+
+ return 0;
+}
+
+ClassDom findClassByPosition( ClassModel* aClass, int line, int col )
+{
+ if (aClass == 0)
+ return 0;
+
+ ClassList classes = aClass->classList();
+ for(ClassList::iterator i = classes.begin(); i != classes.end(); ++i)
+ {
+ ClassDom result = findClassByPosition( *i, line, col );
+ if (result != 0)
+ return result;
+ }
+
+ int startLine, startCol;
+ aClass->getStartPosition(&startLine, &startCol);
+
+ if (startLine <= line)
+ {
+ int endLine, endCol;
+ aClass->getEndPosition(&endLine, &endCol);
+ if (endLine >= line)
+ return (aClass);
+ }
+
+ return 0;
+}
+
+int findLastMethodLine( ClassDom aClass, CodeModelItem::Access access )
+{
+ int point = -1;
+
+ const FunctionList functionList = aClass->functionList();
+ for( FunctionList::ConstIterator it=functionList.begin(); it!=functionList.end(); ++it )
+ {
+ int funEndLine, funEndColumn;
+ (*it)->getEndPosition( &funEndLine, &funEndColumn );
+
+ if ((*it)->access() == access && point < funEndLine)
+ point = funEndLine;
+ }
+
+ return point;
+}
+
+int findLastVariableLine( ClassDom aClass, CodeModelItem::Access access )
+{
+ int point = -1;
+
+ const VariableList varList = aClass->variableList();
+ for( VariableList::ConstIterator it= varList.begin(); it!= varList.end(); ++it )
+ {
+ int varEndLine, varEndColumn;
+ (*it)->getEndPosition( &varEndLine, &varEndColumn );
+
+ if ((*it)->access() == access && point < varEndLine)
+ point = varEndLine;
+ }
+
+ return point;
+}
+
+QString accessSpecifierToString( CodeModelItem::Access access )
+{
+ switch(access)
+ {
+ case CodeModelItem::Public: return "public";
+ case CodeModelItem::Protected: return "protected";
+ case CodeModelItem::Private: return "private";
+ default: return "unknown";
+ }
+}
+
+FunctionDefinitionDom CodeModelHelper::functionDefinitionAt(NamespaceDom ns, int line, int column)
+{
+ NamespaceList namespaceList = ns->namespaceList();
+ NamespaceList::iterator nslEnd = namespaceList.end();
+
+ for (NamespaceList::iterator it=namespaceList.begin(); it!=nslEnd; ++it)
+ {
+ if (FunctionDefinitionDom def = functionDefinitionAt(*it, line, column))
+ return def;
+ }
+
+ ClassList classList = ns->classList();
+ ClassList::iterator clEnd = classList.end();
+
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (FunctionDefinitionDom def = functionDefinitionAt(*it, line, column))
+ return def;
+ }
+
+ FunctionDefinitionList functionDefinitionList = ns->functionDefinitionList();
+ FunctionDefinitionList::iterator fdlEnd = functionDefinitionList.end();
+
+ for (FunctionDefinitionList::iterator it=functionDefinitionList.begin();
+ it!=fdlEnd; ++it )
+ {
+ if (FunctionDefinitionDom def = functionDefinitionAt(*it, line, column))
+ return def;
+ }
+
+ return FunctionDefinitionDom();
+}
+
+FunctionDefinitionDom CodeModelHelper::functionDefinitionAt(ClassDom klass, int line, int column)
+{
+ ClassList classList = klass->classList();
+ ClassList::iterator clEnd = classList.end();
+
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (FunctionDefinitionDom def = functionDefinitionAt(*it, line, column))
+ return def;
+ }
+
+ FunctionDefinitionList functionDefinitionList = klass->functionDefinitionList();
+ FunctionDefinitionList::iterator fdlEnd = functionDefinitionList.end();
+ for (FunctionDefinitionList::Iterator it=functionDefinitionList.begin();
+ it!=fdlEnd; ++it)
+ {
+ if (FunctionDefinitionDom def = functionDefinitionAt(*it, line, column))
+ return def;
+ }
+
+ return FunctionDefinitionDom();
+}
+
+FunctionDefinitionDom CodeModelHelper::functionDefinitionAt(FunctionDefinitionDom fun, int line, int // column
+ )
+{
+ int startLine, startColumn;
+ int endLine, endColumn;
+
+ fun->getStartPosition(&startLine, &startColumn);
+ fun->getEndPosition(&endLine, &endColumn);
+
+ if (!(line >= startLine && line <= endLine) || fun->fileName() != m_fileName )
+ return FunctionDefinitionDom();
+
+ /*
+ if (line == startLine && column < startColumn)
+ return FunctionDefinitionDom();
+
+ if (line == endLine && column > endColumn)
+ return FunctionDefinitionDom();*/
+
+ return fun;
+}
+
+
+
+FunctionDom CodeModelHelper::functionDeclarationAt(NamespaceDom ns, int line, int column)
+{
+ NamespaceList namespaceList = ns->namespaceList();
+ NamespaceList::iterator nsEnd = namespaceList.end();
+ for (NamespaceList::iterator it=namespaceList.begin(); it!=nsEnd; ++it)
+ {
+ if (FunctionDom def = functionDeclarationAt(*it, line, column))
+ return def;
+ }
+
+ ClassList classList = ns->classList();
+ ClassList::iterator clEnd = classList.end();
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (FunctionDom def = functionDeclarationAt(*it, line, column))
+ return def;
+ }
+
+ FunctionList functionList = ns->functionList();
+ FunctionList::iterator flEnd = functionList.end();
+ for (FunctionList::iterator it=functionList.begin();
+ it!=flEnd; ++it )
+ {
+ if (FunctionDom def = functionDeclarationAt(*it, line, column))
+ return def;
+ }
+
+ return FunctionDom();
+}
+
+FunctionDom CodeModelHelper::functionDeclarationAt(ClassDom klass, int line, int column)
+{
+ ClassList classList = klass->classList();
+ ClassList::iterator clEnd = classList.end();
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (FunctionDom def = functionDeclarationAt(*it, line, column))
+ return def;
+ }
+
+ FunctionList functionList = klass->functionList();
+ FunctionList::iterator flEnd = functionList.end();
+ for (FunctionList::Iterator it=functionList.begin();
+ it!=flEnd; ++it)
+ {
+ if (FunctionDom def = functionDeclarationAt(*it, line, column))
+ return def;
+ }
+
+ return FunctionDom();
+}
+
+FunctionDom CodeModelHelper::functionDeclarationAt(FunctionDom fun, int line, int // column
+ )
+{
+ int startLine, startColumn;
+ int endLine, endColumn;
+
+ fun->getStartPosition(&startLine, &startColumn);
+ fun->getEndPosition(&endLine, &endColumn);
+
+ if (!(line >= startLine && line <= endLine) || fun->fileName() != m_fileName )
+ return FunctionDom();
+
+
+ /* if (line == startLine && column < startColumn)
+ return FunctionDom();
+
+ if (line == endLine && column > endColumn)
+ return FunctionDom();*/
+
+ return fun;
+}
+
+
+
+
+ClassDom CodeModelHelper::classAt(NamespaceDom ns, int line, int column)
+{
+ NamespaceList namespaceList = ns->namespaceList();
+ NamespaceList::iterator nsEnd = namespaceList.end();
+
+ for (NamespaceList::iterator it=namespaceList.begin(); it!=nsEnd; ++it)
+ {
+ if (ClassDom def = classAt(*it, line, column))
+ return def;
+ }
+
+ ClassList classList = ns->classList();
+ ClassList::iterator clEnd = classList.end();
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (ClassDom def = classAt(*it, line, column))
+ return def;
+ }
+
+ return ClassDom();
+}
+
+ClassDom CodeModelHelper::classAt(ClassDom klass, int line, int column)
+{
+ ClassList classList = klass->classList();
+ ClassList::iterator clEnd = classList.end();
+ for (ClassList::iterator it=classList.begin(); it!=clEnd; ++it)
+ {
+ if (ClassDom def = classAt(*it, line, column))
+ return def;
+ }
+
+ int startLine, startColumn;
+ int endLine, endColumn;
+
+ klass->getStartPosition(&startLine, &startColumn);
+ klass->getEndPosition(&endLine, &endColumn);
+
+ if (!(line >= startLine && line <= endLine) || klass->fileName() != m_fileName )
+ return ClassDom();
+
+ return klass;
+}
+
+
+CodeModelHelper::CodeModelHelper( CodeModel* model, FileDom file ) : m_model( model ) {
+ if( !file ) return;
+ m_files = file->wholeGroup();
+ m_fileName = file->name();
+}
+
+
+FunctionDom CodeModelHelper::functionAt( int line, int column, FunctionTypes types ) {
+ if( m_files.isEmpty() ) return FunctionDom();
+
+
+ FunctionDom ret;
+ FileList::iterator it = m_files.begin();
+ while( it != m_files.end() ) {
+ if( types & Declaration ) {
+ ret = functionDeclarationAt(model_cast<NamespaceDom>(*it), line, column);
+ if(ret) return ret;
+ }
+ if( types & Definition ) {
+ FunctionDefinitionDom r = functionDefinitionAt(model_cast<NamespaceDom>(*it), line, column);
+ if(r) {
+ ret = model_cast<FunctionDom>( r );
+ return ret;
+ }
+ }
+ ++it;
+ }
+
+ return ret;
+}
+
+ClassDom CodeModelHelper::classAt( int line, int column ) {
+ if( m_files.isEmpty() ) return ClassDom();
+
+ ClassDom ret;
+ FileList::iterator it = m_files.begin();
+ while( it != m_files.end() ) {
+ ret = classAt( model_cast<NamespaceDom>(*it), line, column );
+ if(ret) return ret;
+ ++it;
+ }
+
+ return ret;
+}
+
+}//end of namespace CodeModeUtils
diff --git a/lib/interfaces/codemodel_utils.h b/lib/interfaces/codemodel_utils.h
new file mode 100644
index 00000000..dc970366
--- /dev/null
+++ b/lib/interfaces/codemodel_utils.h
@@ -0,0 +1,570 @@
+/* This file is part of KDevelop
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+ Copyright (C) 2004 Jonas Jacobi<j.jacobi@gmx.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef CODEMODEL_UTILS_H
+#define CODEMODEL_UTILS_H
+
+#include "codemodel.h"
+
+/**
+@file codemodel_utils.h
+Utility functions and classes for the CodeModel.
+*/
+
+/**
+@class Pred
+The predicate.
+Pred is not a real class, it is only a template parameter used in @ref CodeModelUtils functions.
+
+<b>How to create the predicate:</b>@n
+Predicate is simply a class that have
+@code bool operator() (predicateArgument) @endcode.
+The return value of that operator is the result of a predicate.
+
+For example we want to find all function definitions with a particular name.
+We can use @ref CodeModelUtils::findFunctionDefinitions functions that require
+you to write a predicate for function definition DOM's.
+This can be done with following code:
+@code
+class MyPred{
+public:
+ MyPred(const QString &name): m_name(name) {}
+
+ bool operator() (const FunctionDefinitionDom &def) const
+ {
+ return def->name() == m_name;
+ }
+
+private:
+ QString m_name;
+};
+@endcode
+*/
+
+
+/**Namespace which contains utility functions and classes for the CodeModel.*/
+namespace CodeModelUtils
+{
+
+/**Finds function definitions which match given predicate in files.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param fileList The list of files to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const FileList& fileList, FunctionDefinitionList & lst );
+
+/**Finds function definitions which match given predicate in the namespace.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param ns The namespace to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const NamespaceDom& ns, FunctionDefinitionList & lst );
+
+/**Finds function definitions which match given predicate in namespaces.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param namespaceList The list of namespaces to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const NamespaceList& namespaceList, FunctionDefinitionList & lst );
+
+/**Finds function definitions which match given predicate in classes.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param classList The list of classes to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const ClassList& classList, FunctionDefinitionList & lst );
+
+/**Finds function definitions which match given predicate in the list of function definitions.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param functionDefinitionList The list of function definitions to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const FunctionDefinitionList& functionDefinitionList, FunctionDefinitionList & lst );
+
+/**Finds function definitions which match given predicate in the class.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param klass The class to find function definitions in.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const ClassDom& klass, FunctionDefinitionList & lst );
+
+/**Applies a predicate to a function definition.
+
+Predicate can be considered as a condition. If it is true then the function definition is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function definition before it is returned.
+@param fun The function definition.
+@param lst The reference to a list of function definitions. Will be filled by this function.*/
+template <class Pred> void findFunctionDefinitions( Pred pred, const FunctionDefinitionDom& fun, FunctionDefinitionList & lst );
+
+/**Finds function declarations which match given predicate in files.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param fileList The list of files to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const FileList& fileList, FunctionList & lst );
+
+/**Finds function declarations which match given predicate in the namespace.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param ns The namespace to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const NamespaceDom& ns, FunctionList & lst );
+
+/**Finds function declarations which match given predicate in namespaces.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param namespaceList The list of namespaces to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const NamespaceList& namespaceList, FunctionList & lst );
+
+/**Finds function declarations which match given predicate in classes.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param classList The list of classes to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const ClassList& classList, FunctionList & lst );
+
+/**Finds function declarations which match given predicate in the list of function declarations.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param functionList The list of function declarations to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const FunctionList& functionList, FunctionList & lst );
+
+/**Finds function declarations which match given predicate in the class.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param klass The class to find function declarations in.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const ClassDom& klass, FunctionList & lst );
+
+/**Applies a predicate to a function declaration.
+
+Predicate can be considered as a condition. If it is true then the function declaration is
+added to the result list otherwise it is skipped.
+@see Pred class documentation for a detailed description on how to create and use predicates.
+
+@param pred Predicate which is applied to a function declaration before it is returned.
+@param fun The function declaration.
+@param lst The reference to a list of function declarations. Will be filled by this function.*/
+template <class Pred> void findFunctionDeclarations( Pred pred, const FunctionDom& fun, FunctionList & lst );
+
+
+//implementations of function templates defined above:
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const FileList& fileList, FunctionDefinitionList & lst )
+{
+ for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it )
+ findFunctionDefinitions( pred, model_cast<NamespaceDom>(*it), lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const NamespaceDom& ns, FunctionDefinitionList & lst )
+{
+ findFunctionDefinitions( pred, ns->namespaceList(), lst );
+ findFunctionDefinitions( pred, ns->classList(), lst );
+ findFunctionDefinitions( pred, ns->functionDefinitionList(), lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const NamespaceList& namespaceList, FunctionDefinitionList & lst )
+{
+ for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ findFunctionDefinitions( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const ClassList& classList, FunctionDefinitionList & lst )
+{
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ findFunctionDefinitions( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const FunctionDefinitionList& functionDefinitionList, FunctionDefinitionList & lst )
+{
+ for( FunctionDefinitionList::ConstIterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
+ findFunctionDefinitions( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const ClassDom& klass, FunctionDefinitionList & lst )
+{
+ findFunctionDefinitions( pred, klass->classList(), lst );
+ findFunctionDefinitions( pred, klass->functionDefinitionList(), lst );
+}
+
+template <class Pred>
+void findFunctionDefinitions( Pred pred, const FunctionDefinitionDom& fun, FunctionDefinitionList & lst )
+{
+ if( pred(fun) )
+ lst << fun;
+}
+
+
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const FileList& fileList, FunctionList & lst )
+{
+ for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it )
+ findFunctionDeclarations( pred, model_cast<NamespaceDom>(*it), lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const NamespaceDom& ns, FunctionList & lst )
+{
+ findFunctionDeclarations( pred, ns->namespaceList(), lst );
+ findFunctionDeclarations( pred, ns->classList(), lst );
+ findFunctionDeclarations( pred, ns->functionList(), lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const NamespaceList& namespaceList, FunctionList & lst )
+{
+ for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ findFunctionDeclarations( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const ClassList& classList, FunctionList & lst )
+{
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ findFunctionDeclarations( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const FunctionList& functionList, FunctionList & lst )
+{
+ for( FunctionList::ConstIterator it=functionList.begin(); it!=functionList.end(); ++it )
+ findFunctionDeclarations( pred, *it, lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const ClassDom& klass, FunctionList & lst )
+{
+ findFunctionDeclarations( pred, klass->classList(), lst );
+ findFunctionDeclarations( pred, klass->functionList(), lst );
+}
+
+template <class Pred>
+void findFunctionDeclarations( Pred pred, const FunctionDom& fun, FunctionList & lst )
+{
+ if( pred(fun) )
+ lst << fun;
+}
+
+/**A scope.*/
+struct Scope{
+ /**Class.*/
+ ClassDom klass;
+ /**Namespace.*/
+ NamespaceDom ns;
+};
+
+/**Information about functions.*/
+struct AllFunctions{
+ /**Scope of functions.*/
+ QMap<FunctionDom, Scope> relations;
+ /**List of functions.*/
+ FunctionList functionList;
+};
+/**Information about function definitions.*/
+struct AllFunctionDefinitions{
+ /**Scope of function definitions.*/
+ QMap<FunctionDefinitionDom, Scope> relations;
+ /**List of function definitions.*/
+ FunctionDefinitionList functionList;
+};
+
+/**Namespace with utilities to find functions in the @ref CodeModel.*/
+namespace Functions{
+/**Looks for functions in the class.
+@param list The list of functions found by this routine.
+@param dom The class to look for functions.*/
+void processClasses(FunctionList &list, const ClassDom dom);
+
+/**Looks for functions in the namespace.
+@param list The list of functions found by this routine.
+@param dom The namespace to look for functions.*/
+void processNamespaces(FunctionList &list, const NamespaceDom dom);
+
+/**Looks for functions in the class and also saves their scope.
+@param list The list of functions found by this routine.
+@param dom The class to look for functions.
+@param relations The scope information.*/
+void processClasses(FunctionList &list, const ClassDom dom, QMap<FunctionDom, Scope> &relations);
+
+/**Looks for functions in the class and also saves their scope.
+Used for classes withing a namespace.
+@param list The list of functions found by this routine.
+@param dom The class to look for functions.
+@param relations The scope information.
+@param nsdom The namespace which contains a class.*/
+void processClasses(FunctionList &list, const ClassDom dom, QMap<FunctionDom, Scope> &relations, const NamespaceDom &nsdom);
+
+/**Looks for functions in the namespace and also saves their scope.
+@param list The list of functions found by this routine.
+@param dom The namespace to look for functions.
+@param relations The scope information.*/
+void processNamespaces(FunctionList &list, const NamespaceDom dom, QMap<FunctionDom, Scope> &relations);
+}
+
+/**Namespace with utilities to find function definitions in the @ref CodeModel.*/
+namespace FunctionDefinitions{
+/**Looks for function definitions in the class.
+@param list The list of function definitions found by this routine.
+@param dom The class to look for function definitions.*/
+void processClasses(FunctionDefinitionList &list, const ClassDom dom);
+
+/**Looks for function definitions in the namespace.
+@param list The list of function definitions found by this routine.
+@param dom The namespace to look for function definitions.*/
+void processNamespaces(FunctionDefinitionList &list, const NamespaceDom dom);
+
+/**Looks for function definitions in the class and also saves their scope.
+@param list The list of function definitions found by this routine.
+@param dom The class to look for function definitions.
+@param relations The scope information.*/
+void processClasses(FunctionDefinitionList &list, const ClassDom dom, QMap<FunctionDefinitionDom, Scope> &relations);
+
+/**Looks for function definitions in the class and also saves their scope.
+Used for classes withing a namespace.
+@param list The list of function definitions found by this routine.
+@param dom The class to look for function definitions .
+@param relations The scope information.
+@param nsdom The namespace which contains a class.*/
+void processClasses(FunctionDefinitionList &list, const ClassDom dom, QMap<FunctionDefinitionDom, Scope> &relations, const NamespaceDom &nsdom);
+
+/**Looks for function definitions in the namespace and also saves their scope.
+@param list The list of function definitions found by this routine.
+@param dom The namespace to look for function definitions.
+@param relations The scope information.*/
+void processNamespaces(FunctionDefinitionList &list, const NamespaceDom dom, QMap<FunctionDefinitionDom, Scope> &relations);
+}
+
+/**
+ * Compares a declaration and a defintion of a function.
+ * @param dec declaration
+ * @param def definition
+ * @return true, if dec is the declaration of the function definition def, false otherwise
+ * @author Jonas Jacobi <j.jacobi@gmx.de>
+ */
+bool compareDeclarationToDefinition(const FunctionDom& dec, const FunctionDefinitionDom& def);
+
+/**
+ * Compares a declaration and a defintion of a function.
+ * @param dec declaration
+ * @param def definition
+ * @param nsImports namespace imports for the namespace the definition appears in
+ * @return true, if dec is the declaration of the function definition def, false otherwise
+ */
+bool compareDeclarationToDefinition(const FunctionDom& dec, const FunctionDefinitionDom& def, const std::set<NamespaceImportModel>& nsImports);
+
+/**
+ * Predicate for use with findFunctionDefintions. Searches for a defintion matching a declaration.
+ * @sa Pred documentation to learn more about predicates used with code model.
+ * @author Jonas Jacobi
+ */
+class PredDefinitionMatchesDeclaration{
+public:
+ PredDefinitionMatchesDeclaration(const FunctionDom& func) : m_declaration(func){};
+ bool operator() (const FunctionDefinitionDom& def) const
+ {
+ return compareDeclarationToDefinition(m_declaration, def);
+ }
+
+private:
+ const FunctionDom m_declaration;
+};
+
+template <class InputDomType>
+class PredAmOwner{
+ public:
+ PredAmOwner(const FileDom& file) : m_file(file){};
+ bool operator() (const InputDomType& def) const
+ {
+ return def->file() == m_file;
+ }
+
+ private:
+ const FileDom m_file;
+};
+
+/**@return A list of all functions in the file.
+@param dom File Dom to look for functions in.*/
+FunctionList allFunctions(const FileDom &dom);
+/**@return A detailed list of all functions in the file (detailed list contains
+the information about a scope of each FunctionDom found).
+@param dom File Dom to look for functions in.*/
+AllFunctions allFunctionsDetailed(const FileDom &dom);
+/**@return A detailed list of all function definitions in the file (detailed list contains
+the information about a scope of each FunctionDefinitionDom found).
+@param dom File Dom to look for functions in.*/
+AllFunctionDefinitions allFunctionDefinitionsDetailed(const FileDom &dom);
+
+/**@return A list of all functions in the file.
+This version searches the file's whole group for
+functions that may have been inserted into the other file's
+structure.
+Unlike the methods above, this guarantees that all returned
+functions physically belong to that file.
+@param dom File Dom to look for functions in. */
+FunctionList allFunctionsExhaustive(FileDom &dom);
+
+/**@return A list of all function-definitions in the file.
+This version searches the file's whole group for
+functions that may have been inserted into the other file's
+structure.
+Unlike the methods above, this guarantees that all returned
+functions physically belong to that file.
+@param dom File Dom to look for functions in. */
+FunctionDefinitionList allFunctionDefinitionsExhaustive(FileDom &dom);
+
+/**
+ * Finds a class by its position in a file(position inside the part of the file, where the class is declared).
+ * In the case of nested classes the innermost class which is declared at/around the provided position.
+ * @param nameSpace A namespace to search for the class.
+ * @param line A linenumber inside the class declaration.
+ * @param col The colum of line.
+ * @return The innermost class, which is declared at/around position defined with line / col, or 0 if no class is found.
+ * @author Jonas Jacobi <j.jacobi@gmx.de>
+ */
+ClassDom findClassByPosition( NamespaceModel* nameSpace, int line, int col );
+
+/**
+ * Same as above, just searches inside a class instead of a namespace.
+ */
+ClassDom findClassByPosition( ClassModel* aClass, int line, int col );
+
+/**
+ * Finds the last occurrence (line of file wise) of a method inside a class declaration with specific access specificer.
+ * This can be used e.g. to find a position to new methods to the class.
+ * @param aClass class to search for method.
+ * @param access the access specifier with which methods are searched for.
+ * @return The last line a Method with access specifier access is found,
+ * or -1 if no method with that access specifier was found.
+ * @author Jonas Jacobi <j.jacobi@gmx.de>
+ */
+int findLastMethodLine( ClassDom aClass, CodeModelItem::Access access );
+
+/**
+ * Same as above, but finds a membervariable instead of a method.
+ */
+int findLastVariableLine( ClassDom aClass, CodeModelItem::Access access );
+
+/**
+ * Get the string representation of an accesss pecifier
+ * @param access An access specifier to get a string representation of.
+ * @return string The representation of an access (e.g. "public").
+ * @author Jonas Jacobi <j.jacobi@gmx.de>
+ */
+QString accessSpecifierToString( CodeModelItem::Access access );
+
+
+class CodeModelHelper {
+ private:
+ CodeModel* m_model;
+ FileList m_files;
+ QString m_fileName;
+
+ FunctionDefinitionDom functionDefinitionAt(NamespaceDom ns, int line, int column);
+
+ FunctionDefinitionDom functionDefinitionAt(ClassDom klass, int line, int column);
+
+ FunctionDefinitionDom functionDefinitionAt(FunctionDefinitionDom fun, int line, int );
+
+ FunctionDom functionDeclarationAt(NamespaceDom ns, int line, int column);
+
+ FunctionDom functionDeclarationAt(ClassDom klass, int line, int column);
+
+ FunctionDom functionDeclarationAt(FunctionDom fun, int line, int column );
+
+
+ ClassDom classAt(NamespaceDom ns, int line, int column);
+
+ ClassDom classAt(ClassDom klass, int line, int column);
+
+ public:
+ CodeModelHelper( CodeModel* model, FileDom file );
+
+ enum FunctionTypes {
+ Declaration = 1,
+ Definition = 2
+ };
+
+ FunctionDom functionAt( int line, int column, FunctionTypes types = (FunctionTypes)3 );
+ ClassDom classAt( int line, int column );
+};
+
+}
+
+#endif
diff --git a/lib/interfaces/extensions/Mainpage.dox b/lib/interfaces/extensions/Mainpage.dox
new file mode 100644
index 00000000..d306a1e8
--- /dev/null
+++ b/lib/interfaces/extensions/Mainpage.dox
@@ -0,0 +1,61 @@
+/**
+@mainpage The KDevelop Extension Interfaces Library
+
+This library contains extension interfaces used by KDevelop plugin architecture.
+
+<b>Link with</b>: -lkdevelop
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/interfaces/extensions
+
+\section whatisextension What is the KDevelop extension
+
+Extension is a KDevelop plugin which implements one of extension interfaces.
+Extension is usually not important enough to be returned by @ref KDevApi and @ref KDevPlugin
+methods. Therefore extension instance can be obtained by @ref KDevPlugin::extension method.
+
+Note: extension plugins can be either core, global and project plugins. They are loaded
+in the same way other plugins are. But extensions differ from usual plugins.
+
+Note: many plugins implementing extension interface can be created but only one of
+those should be loaded at a time. This can be accomplished by:
+- using a shell plugin profile (as done in current generic shell implementation) - define
+ different X-KDevelop-Properties for different extension implementations;
+- writing project manager which looks into the project file and loads the neccesary extension.
+
+\section creatingextension Creating and using an extension
+- Define a service, use following .desktop file:
+ @code
+ [Desktop Entry]
+ Encoding=UTF-8
+ Type=ServiceType
+ X-KDE-ServiceType=KDevelop/MyExtension
+ X-KDE-Derived=KDevelop/Plugin
+ Name=My Extension Interface
+ [PropertyDef::X-KDevelop-Version]
+ Type=int
+ @endcode
+- Define an abstract base class for an extension like:
+ @code
+ class KDevMyExtension: public KDevPlugin {
+ public:
+ KDevMyExtension(const KDevPluginInfo *info, QObject* parent, const char* name)
+ :KDevPlugin(info, parent, name) {}
+
+ virtual void doSomething() = 0;
+ };
+ @endcode
+- Create an usual plugin, but instead of setting service type to "KDevelop/Plugin", set:
+ @code
+ ServiceTypes=KDevelop/MyExtension
+ @endcode
+- Use your extension:
+ @code
+ KDevMyExtension *myext = extension<KDevMyExtension>("KDevelop/MyExtension");
+ if (sf) {
+ // do something
+ } else {
+ // fail
+ }
+ @endcode
+*/
+
diff --git a/lib/interfaces/extensions/Makefile.am b/lib/interfaces/extensions/Makefile.am
new file mode 100644
index 00000000..4bc069cb
--- /dev/null
+++ b/lib/interfaces/extensions/Makefile.am
@@ -0,0 +1,23 @@
+kdevelopincludeextdir = $(includedir)/kdevelop/interfaces/extensions
+kdevelopincludeext_HEADERS = codebrowserfrontend.h kdevappfrontend.h \
+ kdevcreatefile.h kdevdifffrontend.h kdevmakefrontend.h kdevquickopen.h \
+ kdevsourceformatter.h kdevversioncontrol.h
+
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = kdevelopappfrontend.desktop \
+ kdevelopcodebrowserfrontend.desktop kdevelopcreatefile.desktop kdevelopdifffrontend.desktop \
+ kdevelopmakefrontend.desktop kdevelopquickopen.desktop kdevelopsourceformatter.desktop \
+ kdevelopversioncontrol.desktop
+
+SUBDIRS = dcop
+libkdevextensions_la_LDFLAGS = $(all_libraries)
+noinst_LTLIBRARIES = libkdevextensions.la
+libkdevextensions_la_SOURCES = kdevappfrontend.cpp kdevmakefrontend.cpp
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevinterfaces
+DOXYGEN_PROJECTNAME = KDevelop Extension Interfaces Library
+DOXYGEN_DOCDIRPREFIX = kdev
+include ../../../Doxyfile.am
+noinst_HEADERS = codebrowserfrontend.h
diff --git a/lib/interfaces/extensions/codebrowserfrontend.h b/lib/interfaces/extensions/codebrowserfrontend.h
new file mode 100644
index 00000000..57852ac8
--- /dev/null
+++ b/lib/interfaces/extensions/codebrowserfrontend.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ Copyright (C) 2006 David Nolden <david.nolden.kdevelop@art-master.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef CODEBROWSERRONTEND_H
+#define CODEBROWSERRONTEND_H
+
+
+#include <kdevplugin.h>
+#include <codemodel.h>
+
+namespace Extensions {
+
+class KDevCodeBrowserFrontend : public KDevPlugin {
+ Q_OBJECT
+
+ public:
+ KDevCodeBrowserFrontend(const KDevPluginInfo *info, QObject *parent=0, const char *name=0 )
+ :KDevPlugin(info, parent, name ? name : "CodeBrowserFrontend") {}
+
+ ///Used by the quickopen-plugin to notify extensions that it jumped to a searched item
+ virtual bool jumpedToItem( ItemDom item ) = 0;
+};
+}
+
+#endif
diff --git a/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp
new file mode 100644
index 00000000..8bf5b7ce
--- /dev/null
+++ b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp
@@ -0,0 +1,76 @@
+
+
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "KDevAppFrontendIface.h"
+#include "kdevappfrontend.h"
+
+
+KDevAppFrontendIface::KDevAppFrontendIface(KDevAppFrontend *appFrontend)
+ : DCOPObject("KDevAppFrontend"), m_appFrontend(appFrontend)
+{
+}
+
+
+KDevAppFrontendIface::~KDevAppFrontendIface()
+{}
+
+
+void KDevAppFrontendIface::startAppCommand(const QString &directory, const QString &command, bool inTerminal)
+{
+ m_appFrontend->startAppCommand(directory, command, inTerminal);
+}
+
+void KDevAppFrontendIface::stopApplication( )
+{
+ m_appFrontend->stopApplication();
+}
+
+bool KDevAppFrontendIface::isRunning( )
+{
+ return m_appFrontend->isRunning();
+}
+
+void KDevAppFrontendIface::clearView( )
+{
+ m_appFrontend->clearView();
+}
+
+void KDevAppFrontendIface::insertStderrLine( const QCString & line )
+{
+ m_appFrontend->insertStderrLine(line);
+}
+
+void KDevAppFrontendIface::insertStdoutLine( const QCString & line )
+{
+ m_appFrontend->insertStdoutLine(line);
+}
+
+void KDevAppFrontendIface::addPartialStderrLine( const QCString& line )
+{
+ m_appFrontend->addPartialStderrLine(line);
+}
+
+void KDevAppFrontendIface::addPartialStdoutLine( const QCString& line )
+{
+ m_appFrontend->addPartialStdoutLine(line);
+}
diff --git a/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h
new file mode 100644
index 00000000..e54e25b0
--- /dev/null
+++ b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef _KDEVAPPFRONTENDIFACE_H_
+#define _KDEVAPPFRONTENDIFACE_H_
+
+#include <dcopobject.h>
+
+class KDevAppFrontend;
+
+class KDevAppFrontendIface : public DCOPObject
+{
+ K_DCOP
+
+public:
+
+ KDevAppFrontendIface( KDevAppFrontend *appFrontend );
+ ~KDevAppFrontendIface();
+
+k_dcop:
+ void startAppCommand(const QString &directory, const QString &command, bool inTerminal);
+ void stopApplication();
+ bool isRunning();
+ void clearView();
+ void insertStderrLine(const QCString &line);
+ void insertStdoutLine(const QCString &line);
+ void addPartialStderrLine(const QCString &line);
+ void addPartialStdoutLine(const QCString &line);
+
+private:
+ KDevAppFrontend *m_appFrontend;
+};
+
+#endif
diff --git a/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp
new file mode 100644
index 00000000..2050a970
--- /dev/null
+++ b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp
@@ -0,0 +1,46 @@
+
+
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "KDevMakeFrontendIface.h"
+#include "kdevmakefrontend.h"
+
+
+KDevMakeFrontendIface::KDevMakeFrontendIface(KDevMakeFrontend *makeFrontend)
+ : DCOPObject("KDevMakeFrontend")
+{
+ m_makeFrontend = makeFrontend;
+}
+
+
+KDevMakeFrontendIface::~KDevMakeFrontendIface()
+{}
+
+
+void KDevMakeFrontendIface::queueCommand(const QString &dir, const QString &command)
+{
+ m_makeFrontend->queueCommand(dir, command);
+}
+
+bool KDevMakeFrontendIface::isRunning( )
+{
+ return m_makeFrontend->isRunning();
+}
diff --git a/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h
new file mode 100644
index 00000000..89ecdf5e
--- /dev/null
+++ b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h
@@ -0,0 +1,45 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef _KDEVMAKEFRONTENDIFACE_H_
+#define _KDEVMAKEFRONTENDIFACE_H_
+
+#include <dcopobject.h>
+
+class KDevMakeFrontend;
+
+class KDevMakeFrontendIface : public DCOPObject
+{
+ K_DCOP
+
+public:
+
+ KDevMakeFrontendIface( KDevMakeFrontend *makeFrontend );
+ ~KDevMakeFrontendIface();
+
+k_dcop:
+ void queueCommand(const QString &dir, const QString &command);
+ bool isRunning();
+
+private:
+ KDevMakeFrontend *m_makeFrontend;
+};
+
+#endif
diff --git a/lib/interfaces/extensions/dcop/Makefile.am b/lib/interfaces/extensions/dcop/Makefile.am
new file mode 100644
index 00000000..0b904eeb
--- /dev/null
+++ b/lib/interfaces/extensions/dcop/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libkdevdcopextensions.la
+libkdevdcopextensions_la_LDFLAGS = $(all_libraries)
+libkdevdcopextensions_la_SOURCES = KDevAppFrontendIface.cpp \
+ KDevMakeFrontendIface.cpp KDevAppFrontendIface.skel KDevMakeFrontendIface.skel
+
+dcopincludeextdir = $(includedir)/kdevelop/interfaces/extensions/dcop
+dcopincludeext_HEADERS = KDevAppFrontendIface.h KDevMakeFrontendIface.h
diff --git a/lib/interfaces/extensions/kdevappfrontend.cpp b/lib/interfaces/extensions/kdevappfrontend.cpp
new file mode 100644
index 00000000..3d918fe2
--- /dev/null
+++ b/lib/interfaces/extensions/kdevappfrontend.cpp
@@ -0,0 +1,2 @@
+#include "kdevappfrontend.h"
+#include "kdevappfrontend.moc"
diff --git a/lib/interfaces/extensions/kdevappfrontend.h b/lib/interfaces/extensions/kdevappfrontend.h
new file mode 100644
index 00000000..65424ed9
--- /dev/null
+++ b/lib/interfaces/extensions/kdevappfrontend.h
@@ -0,0 +1,115 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+ Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVAPPFRONTEND_H
+#define KDEVAPPFRONTEND_H
+
+#include <qstringlist.h>
+#include <kdevplugin.h>
+
+/**
+@file kdevappfrontend.h
+Application frontend interface.
+*/
+
+/**
+Application frontend interface.
+This interface is responsible for handling the running of an application in KDevelop.
+Currently, this interface defines ways to do the following:
+- check if the application is running;
+- execute the application;
+- stop the currently running application;
+- control the output view as seen in the 'Application' tool dock.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevAppFrontend *apf = extension<KDevAppFrontend>("KDevelop/AppFrontend");
+if (apf) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa KDevPlugin::extension method documentation.
+*/
+class KDevAppFrontend : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevAppFrontend(const KDevPluginInfo *info, QObject *parent=0, const char *name=0 )
+ :KDevPlugin(info, parent, name ? name : "KDevAppFrontend") {}
+
+ /**@return Whether the application is currently running.*/
+ virtual bool isRunning() = 0;
+
+public slots:
+ /**
+ * The component shall start to execute an app-like command.
+ * Running the application is always asynchronous.
+ * @param directory The working directory to start the app in,
+ * if empty then the user's home directory is used.
+ * @param program A program to start.
+ * @param inTerminal If true then the program is started in an external konsole.
+ */
+ virtual void startAppCommand(const QString &directory, const QString &program, bool inTerminal) = 0;
+
+ /**
+ * Stops the currently running application.
+ */
+ virtual void stopApplication() = 0;
+
+ /**
+ * Inserts a string into the application output view.
+ * @param line A string to insert.
+ */
+ virtual void insertStdoutLine(const QCString &line) = 0;
+
+ /**
+ * Inserts a string into the application output view marked as stderr output
+ * (usually colored).
+ * @param line An error string to insert.
+ */
+ virtual void insertStderrLine(const QCString &line) = 0;
+
+ virtual void addPartialStderrLine( const QCString& line ) = 0;
+ virtual void addPartialStdoutLine( const QCString& line ) = 0;
+
+ /**
+ * Clears the output view.
+ */
+ virtual void clearView() = 0;
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevcreatefile.h b/lib/interfaces/extensions/kdevcreatefile.h
new file mode 100644
index 00000000..b142cd4d
--- /dev/null
+++ b/lib/interfaces/extensions/kdevcreatefile.h
@@ -0,0 +1,146 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Julian Rockey <linux@jrockey.com>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVCREATEFILE_H
+#define KDEVCREATEFILE_H
+
+#include <qstring.h>
+
+#include <kdevplugin.h>
+
+/**
+@file kdevcreatefile.h
+File creation facility interface.
+*/
+
+/**
+File creation facility interface.
+
+An abstract class for all extensions that are responsible for file creation.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevCreateFile *cf = extension<KDevCreateFile>("KDevelop/CreateFile");
+if (cf) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa KDevPlugin::extension method documentation.
+*/
+class KDevCreateFile : public KDevPlugin
+{
+
+public:
+ /**File created with @ref KDevCreateFile implementation.*/
+ class CreatedFile {
+
+ public:
+ /**The status of a file.*/
+ enum Status {
+ STATUS_OK /**<File was successfuly created.*/,
+ STATUS_CANCELED /**<File was not created due to user intervention.*/,
+ STATUS_NOTCREATED /**<File was not created due to error.*/,
+ STATUS_NOTWITHINPROJECT /**<File was successfuly created but not added to a project.*/
+ };
+
+ /**Constructor.
+ Sets status to STATUS_NOTCREATED.*/
+ CreatedFile()
+ : status( STATUS_NOTCREATED ) {}
+
+ CreatedFile( const CreatedFile& source )
+ : dir( source.dir ), filename( source.filename ),
+ ext( source.ext ), subtype( source.subtype ),
+ status( source.status ), addToProject(false) {}
+
+ CreatedFile& operator = ( const CreatedFile& source )
+ {
+ dir = source.dir;
+ filename = source.filename;
+ ext = source.ext;
+ subtype = source.subtype;
+ status = source.status;
+ addToProject = source.addToProject;
+ return( *this );
+ }
+
+ bool operator == ( const CreatedFile& source ) const
+ {
+ return
+ dir == source.dir &&
+ filename == source.filename &&
+ ext == source.ext &&
+ subtype == source.subtype &&
+ status == source.status &&
+ addToProject == source.addToProject;
+ }
+
+ // this should be private
+ /**The directory.*/
+ QString dir;
+ /**The name (without directory path).*/
+ QString filename;
+ /**The extension of a file. Extension defines a "type" of the file template
+ to use during file creation.*/
+ QString ext;
+ /**The subtype of a file. "Subtype" defines a file template to use when
+ there are several file templates for each extension.*/
+ QString subtype;
+ /**Current status.*/
+ Status status;
+ /**true if the file should be added to a project.*/
+ bool addToProject;
+ };
+
+
+public:
+
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevCreateFile(const KDevPluginInfo *info, QObject * parent = 0, const char * name = 0)
+ :KDevPlugin(info, parent, name) {}
+
+ /**Creates a new file, within or without the project.
+ Supply as much information as you know. Leave what you don't know as QString::null.
+ The user will be prompted as necessary for the missing information, and the
+ file created, and added to the project as necessary.
+ @param ext File extension (type).
+ @param dir The absolute path to a directory.
+ @param name The name of a file.
+ @param subtype The subtype, pass this only if an extension is not enough to find the
+ file template.
+ @return @ref CreatedFile instance with information about file and file creation process.*/
+ virtual CreatedFile createNewFile(QString ext = QString::null,
+ QString dir = QString::null,
+ QString name = QString::null,
+ QString subtype = QString::null) = 0;
+
+
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevdifffrontend.cpp b/lib/interfaces/extensions/kdevdifffrontend.cpp
new file mode 100644
index 00000000..a2e2c49b
--- /dev/null
+++ b/lib/interfaces/extensions/kdevdifffrontend.cpp
@@ -0,0 +1,33 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Harald Fernengel <harry@kdevelop.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevdifffrontend.h"
+
+
+KDevDiffFrontend::KDevDiffFrontend(const KDevPluginInfo *info, QObject *parent, const char *name)
+ : KDevPlugin(info, parent, name ? name : "KDevDiffFrontend")
+{
+}
+
+KDevDiffFrontend::~KDevDiffFrontend()
+{
+}
+
+#include "kdevdifffrontend.moc"
diff --git a/lib/interfaces/extensions/kdevdifffrontend.h b/lib/interfaces/extensions/kdevdifffrontend.h
new file mode 100644
index 00000000..7c5874a2
--- /dev/null
+++ b/lib/interfaces/extensions/kdevdifffrontend.h
@@ -0,0 +1,79 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Harald Fernengel <harry@kdevelop.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVDIFFFRONTEND_H
+#define KDEVDIFFFRONTEND_H
+
+#include <kurl.h>
+#include <kdevplugin.h>
+
+/**
+@file kdevdifffrontend.h
+Diff frontend interface.
+*/
+
+/**
+KDevelop diff frontend interface.
+This is the abstract base class for plugins that want to display differencies between
+files.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevDiffFrontend *df = extension<KDevDiffFrontend>("KDevelop/DiffFrontend");
+if (df) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa KDevPlugin::extension method documentation.
+*/
+class KDevDiffFrontend : public KDevPlugin
+{
+
+public:
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevDiffFrontend( const KDevPluginInfo *info, QObject *parent=0, const char *name=0 )
+ :KDevPlugin(info, parent, name ? name : "KDevDiffFrontend") {}
+
+ /**Displays the patch.
+ @param diff A string which contains a patch in unified format.*/
+ virtual void showDiff( const QString& diff ) = 0;
+
+ /**Displays a patch file.
+ @param url An url of the patch file.*/
+ virtual void openURL( const KURL &url ) = 0;
+
+ /**Displays the difference between the two files.
+ @param url1 First file to compare.
+ @param url2 Second file to compare.*/
+ virtual void showDiff( const KURL &url1, const KURL &url2 ) = 0;
+
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevelopappfrontend.desktop b/lib/interfaces/extensions/kdevelopappfrontend.desktop
new file mode 100644
index 00000000..60cd678b
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopappfrontend.desktop
@@ -0,0 +1,38 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/AppFrontend
+X-KDE-Derived=KDevelop/Plugin
+Name=App Frontend Interface
+Name[ca]=Interfície de l'entorn de les aplicacions
+Name[da]=Programbrugerflade-grænseflade
+Name[de]=Oberflächen-Schnittstelle (KDevelop)
+Name[el]=Διασύνδεση προγράμματος App
+Name[es]=Interfaz de entorno de aplicación
+Name[et]=Rakenduse kasutajaliides
+Name[eu]=Aplikazioaren inguruneko interfazea
+Name[fa]=واسط پایانۀ کاربرد
+Name[fr]=Interface graphique pour une application
+Name[gl]=Interface do frontal da aplicación
+Name[hu]=Alkalmazás kezelőfelülete
+Name[it]=Applicazione per le interfacce
+Name[ja]=App フロントエンド インターフェース
+Name[nds]=Programmböversiet-Koppelsteed
+Name[ne]=एप फ्रेन्टइन्ड इन्टरफेस
+Name[pl]=Interfejs do programów
+Name[pt]=Interface da Aplicação
+Name[pt_BR]=Interface Frontend para Aplicativos
+Name[ru]=Интерфейс менеджера приложений
+Name[sk]=Aplikačné rozhranie
+Name[sr]=Кориснички интерфејс програма
+Name[sr@Latn]=Korisnički interfejs programa
+Name[sv]=Programgränssnitt
+Name[ta]=ஆப் முன்னிருந்த இடைமுகம்
+Name[tg]=Интерфейси мудири гузориш
+Name[tr]=Uygulama Önucu Arayüzü
+Name[zh_CN]=应用程序前端接口
+Name[zh_TW]=App 前端介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopcodebrowserfrontend.desktop b/lib/interfaces/extensions/kdevelopcodebrowserfrontend.desktop
new file mode 100644
index 00000000..9dd7f8d2
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopcodebrowserfrontend.desktop
@@ -0,0 +1,28 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/CodeBrowserFrontend
+X-KDE-Derived=KDevelop/Plugin
+Name=Code Browser Frontend
+Name[ca]=Interfície per al navegador de codi
+Name[da]=Kodebrowser-grænseflade
+Name[de]=Quelltextbrowser-Oberfläche
+Name[el]=Πρόγραμμα περιήγησης κώδικα
+Name[es]=Interfaz para el navegador de código
+Name[et]=Koodibrauseri kasutajaliides
+Name[fr]=Interface de navigation dans le code
+Name[hu]=Kódböngésző
+Name[it]=Interfaccia di navigazione del codice
+Name[ja]=コードブラウザのフロントエンド
+Name[nds]=Kodekieker-Böversiet
+Name[pl]=Interfejs do przeglądarki kodu
+Name[pt]=Interface de Navegação do Código
+Name[pt_BR]=Interface de Navegação do Código
+Name[ru]=Навигатор по коду
+Name[sk]=Rozhranie pre prehliadač kódu
+Name[sr]=Интерфејс прегледача кода
+Name[sr@Latn]=Interfejs pregledača koda
+Name[sv]=Kodbläddringsgränssnitt
+Name[zh_TW]=源碼瀏覽器前端介面
+
+[PropertyDef::X-KDevelop-Version]
+Type=int
diff --git a/lib/interfaces/extensions/kdevelopcreatefile.desktop b/lib/interfaces/extensions/kdevelopcreatefile.desktop
new file mode 100644
index 00000000..d100b330
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopcreatefile.desktop
@@ -0,0 +1,38 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/CreateFile
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Create File Interface
+Name[ca]=Interfície de creació de fitxers per a KDevelop
+Name[da]=KDevelop opret filgrænseflade
+Name[de]=KDevelop-Schnittstelle zum Anlegen von Dateien
+Name[el]=Διασύνδεση δημιουργίας αρχείου KDevelop
+Name[es]=Interfaz de creación de archivos de KDevelop
+Name[et]=KDevelopi faili loomise liides
+Name[eu]=KDevelop-en "Sortu fitxategia" interfazea
+Name[fa]=واسط پروندۀ ایجاد KDevelop
+Name[fr]=Interface de création de fichiers pour KDevelop
+Name[gl]=Interface de crear ficheiro de KDevelop
+Name[hu]=KDevelop fájllétrehozási felület
+Name[it]=Interfaccia KDevelop per creare file
+Name[ja]=KDevelop Create File インターフェース
+Name[nds]=KDevelop-Koppelsteed för't Dateiopstellen
+Name[ne]=केडीई विकास फाइल इन्टरफेस सिर्जना
+Name[nl]=KDevelop Bestand aanmaken-interface
+Name[pl]=Interfejs KDevelopa do tworzenia pliku
+Name[pt]=Interface de Criação de Ficheiro do KDevelop
+Name[pt_BR]=Interface para Criar Arquivo do KDevelop
+Name[ru]=Интерфейс средства создания файлов для KDevelop
+Name[sk]=KDevelop rozhranie na vytvorenie súboru
+Name[sl]=Vmesnik za ustvarjanje datotek v KDevelopu
+Name[sr]=KDevelop-ов интерфејс за прављење фајла
+Name[sr@Latn]=KDevelop-ov interfejs za pravljenje fajla
+Name[sv]=KDevelop gränssnitt för att skapa filer
+Name[tr]=KDevelop Dosya Yaratma Arayüzü
+Name[zh_CN]=KDevelop 文件创建接口
+Name[zh_TW]=KDevelop 建立檔案介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopdifffrontend.desktop b/lib/interfaces/extensions/kdevelopdifffrontend.desktop
new file mode 100644
index 00000000..31dec5af
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopdifffrontend.desktop
@@ -0,0 +1,41 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/DiffFrontend
+X-KDE-Derived=KDevelop/Plugin
+Name=Diff Frontend Interface
+Name[ca]=Interfície de l'entorn per a diff
+Name[da]=Diff-brugerflade grænseflade
+Name[de]=Schnittstelle für Diff-Oberflächen (KDevelop)
+Name[el]=Διασύνδεση προγράμματος Diff
+Name[es]=Interfaz del entorno de diff
+Name[et]=Diff kasutajaliides
+Name[eu]=Desberdintasun ingurunearen interfazea
+Name[fa]=واسط پایانۀ تفاوت
+Name[fr]=Interface du programme « Diff »
+Name[gl]=Interface do frontal de Diff
+Name[hi]=डिफ़ फ्रन्टएण्ड इंटरफ़ेस
+Name[hu]=Diff-kezelési felület
+Name[it]=Interfaccia a Diff
+Name[ja]=Diff フロントエンド インターフェース
+Name[nds]=Koppelsteed för "Diff"-Böversiet
+Name[ne]=डिफ फ्रेन्टइन्ड इन्टरफेस
+Name[nl]=Diff Frontend-interface
+Name[pl]=Interfejs do programu diff
+Name[pt]=Interface para o 'Diff'
+Name[pt_BR]=Interface de Frontend do Diff
+Name[ru]=Интерфейс системы нахождения различий
+Name[sk]=Rozhranie rozdielu
+Name[sl]=Vmesnik za diff
+Name[sr]=Кориснички интерфејс за diff
+Name[sr@Latn]=Korisnički interfejs za diff
+Name[sv]=Gränssnitt för jämförelse
+Name[ta]=டிப் முன்நிறுத்த இடைமுகம்
+Name[tg]=Барномаи интерфейс барои ёфтани тағирпазирӣ
+Name[tr]=Diff Önuç Arayüzü
+Name[zh_CN]=Diff 前端接口
+Name[zh_TW]=Diff 前端介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopmakefrontend.desktop b/lib/interfaces/extensions/kdevelopmakefrontend.desktop
new file mode 100644
index 00000000..f38d2d14
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopmakefrontend.desktop
@@ -0,0 +1,41 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/MakeFrontend
+X-KDE-Derived=KDevelop/Plugin
+Name=Make Frontend Interface
+Name[ca]=Interfície de l'entorn per a make
+Name[da]=Make brugerflade-grænseflade
+Name[de]=Schnittstelle für Make-Oberflächen (KDevelop)
+Name[el]=Διασύνδεση προγράμματος Make
+Name[es]=Interfaz del entorno de make
+Name[et]=Make kasutajaliides
+Name[eu]=Make ingurunearen interfazea
+Name[fa]=واسط پایانۀ Make
+Name[fr]=Interface du programme « make »
+Name[gl]=Interface do frontal de Make
+Name[hi]=मेक फ्रन्टएण्ड इंटरफ़ेस
+Name[hu]=Make kezelőfelület
+Name[it]=Interfaccia per Make
+Name[ja]=Make フロントエンド インターフェース
+Name[nds]=Koppelsteed för "Make"-Böversiet
+Name[ne]=मेक फ्रेन्टइन्ड इन्टरफेस
+Name[nl]=Make Frontend-interface
+Name[pl]=Interfejs do Make
+Name[pt]=Interface para o Make
+Name[pt_BR]=Interface de Frontend do Make
+Name[ru]=Интерфейс Make
+Name[sk]=Rozhranie pre make
+Name[sl]=Vmesnik za make
+Name[sr]=Кориснички интерфејс за make
+Name[sr@Latn]=Korisnički interfejs za make
+Name[sv]=Byggränssnitt
+Name[ta]=முன்பகுதி இடை விளிம்பை அமை
+Name[tg]=Интерфейс пӯсти Make
+Name[tr]=Make Önuç Arayüzü
+Name[zh_CN]=Make 前端接口
+Name[zh_TW]=Make 前端介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopquickopen.desktop b/lib/interfaces/extensions/kdevelopquickopen.desktop
new file mode 100644
index 00000000..57ae2fd5
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopquickopen.desktop
@@ -0,0 +1,58 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/QuickOpen
+X-KDE-Derived=KDevelop/Plugin
+Name=Quick Open Interface
+Name[ca]=Interfície Open Quick
+Name[da]=Quick Open-grænseflade
+Name[de]=Schnittstelle für Schnellöffnen
+Name[el]=Διασύνδεση γρήγορου ανοίγματος
+Name[es]=Interfaz de apertura rápida
+Name[et]=Kiiravamise kasutajaliides
+Name[hu]=Gyors megnyitási kezelőfelület
+Name[it]=Interfaccia Quick Open
+Name[nds]=Fixopmaak-Koppelsteed
+Name[nl]=Snelopen-interface
+Name[pl]=Open Interface
+Name[pt]=Interface de Abertura Rápida
+Name[pt_BR]=Interface de Abertura Rápida
+Name[ru]=Интерфейс быстрого открытия
+Name[sk]=Rozhranie pre Quick Open
+Name[sr]=Интерфејс брзог отварања
+Name[sr@Latn]=Interfejs brzog otvaranja
+Name[sv]=Snabböppningsgränssnitt
+Name[zh_TW]=快速開啟介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/QuickOpen
+X-KDE-Derived=KDevelop/Plugin
+Name=Quick Open Interface
+Name[ca]=Interfície Open Quick
+Name[da]=Quick Open-grænseflade
+Name[de]=Schnittstelle für Schnellöffnen
+Name[el]=Διασύνδεση γρήγορου ανοίγματος
+Name[es]=Interfaz de apertura rápida
+Name[et]=Kiiravamise kasutajaliides
+Name[hu]=Gyors megnyitási kezelőfelület
+Name[it]=Interfaccia Quick Open
+Name[nds]=Fixopmaak-Koppelsteed
+Name[nl]=Snelopen-interface
+Name[pl]=Open Interface
+Name[pt]=Interface de Abertura Rápida
+Name[pt_BR]=Interface de Abertura Rápida
+Name[ru]=Интерфейс быстрого открытия
+Name[sk]=Rozhranie pre Quick Open
+Name[sr]=Интерфејс брзог отварања
+Name[sr@Latn]=Interfejs brzog otvaranja
+Name[sv]=Snabböppningsgränssnitt
+Name[zh_TW]=快速開啟介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopsourceformatter.desktop b/lib/interfaces/extensions/kdevelopsourceformatter.desktop
new file mode 100644
index 00000000..2bdadc38
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopsourceformatter.desktop
@@ -0,0 +1,39 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/SourceFormatter
+X-KDE-Derived=KDevelop/Plugin
+Name=Source Formatter Interface
+Name[ca]=Interfície del formatador de codi font
+Name[da]=Kildekodeformatering grænseflade
+Name[de]=Quelltext-Formatierer-Schnittstelle (KDevelop)
+Name[el]=Διασύνδεση μορφοποίησης κώδικα
+Name[es]=Interfaz del formateador de código fuente
+Name[et]=Koodi vormindamise liides
+Name[eu]=Iturburu formateatzailearen interfazea
+Name[fa]=واسط قالب‌دهندۀ منبع
+Name[fr]=Interface pour le formatage de code source
+Name[gl]=Interface do formateador de código
+Name[hu]=Forrásformázási felület
+Name[it]=Interfaccia per il formattatore del codice sorgente
+Name[ja]=ソースフォーマッタ インターフェース
+Name[nds]=Koppelsteed för Borntext-Formaterer
+Name[ne]=स्रोत ढाँचाबद्धक इन्टरफेस
+Name[nl]=Broncode formatteren-interface
+Name[pl]=Interfejs do programu formatowania źródeł
+Name[pt]=Interface de Formatação de Código
+Name[pt_BR]=Interface de Formatação de Fonte
+Name[ru]=Интерфейс форматирования исходного кода
+Name[sk]=Rozhranie pre formátovanie
+Name[sr]=Интерфејс форматера изворног кода
+Name[sr@Latn]=Interfejs formatera izvornog koda
+Name[sv]=Gränssnitt för källkodsformatering
+Name[ta]=வடிவமைப்பவரின் இடை விளிம்பு மூலம்
+Name[tg]=Интерфейс қолабгузори коди берунӣ
+Name[tr]=Kaynak Biçimleyici Arayüzü
+Name[zh_CN]=源代码格式化接口
+Name[zh_TW]=程式碼格式化介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevelopversioncontrol.desktop b/lib/interfaces/extensions/kdevelopversioncontrol.desktop
new file mode 100644
index 00000000..c772b9a6
--- /dev/null
+++ b/lib/interfaces/extensions/kdevelopversioncontrol.desktop
@@ -0,0 +1,40 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/VersionControl
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Version Control Interface
+Name[ca]=Interfície del control de versions per a KDevelop
+Name[da]=KDevelop versionskontrol grænseflade
+Name[de]=Versionsverwaltung-Schnittstelle (KDevelop)
+Name[el]=Διασύνδεση ελέγχου εκδόσεων KDevelop
+Name[es]=Interfaz del control de versiones de KDevelop
+Name[et]=KDevelopi versioonide kontrollimise liides
+Name[eu]=KDevelop bertsio kontrol interfazea
+Name[fa]=واسط کنترل نسخۀ KDevelop
+Name[fr]=Interface pour le contrôle de versions de KDevelop
+Name[gl]=Interface do control de versións de KDevelop
+Name[hi]=के-डेवलप संस्करण नियंत्रण इंटरफ़ेस
+Name[hu]=KDevelop verziókezelési felület
+Name[ja]=KDevelop バージョンコントロール インターフェース
+Name[nds]=Verschoonkuntrull-Koppelsteed vun KDevelop
+Name[ne]=केडीई विकास संस्करण नियन्त्रण इन्टरफेस
+Name[nl]=KDevelop Versiebeheer-interface
+Name[pl]=Interfejs Kdevelopa do kontroli wersji
+Name[pt]=Interface de Controlo de Versões do KDevelop
+Name[pt_BR]=Interface de Controle de Versão do KDevelop
+Name[ru]=Интерфейс системы управления версиями
+Name[sk]=KDevelop rozhranie pre riadenie verzií
+Name[sl]=Vmesnik nadzora različic za KDevelop
+Name[sr]=KDevelop-ов интерфејс за контролу верзије
+Name[sr@Latn]=KDevelop-ov interfejs za kontrolu verzije
+Name[sv]=KDevelop gränssnitt för versionskontroll
+Name[ta]=KDevelop பதிப்பு கட்டுப்பாட்டு இடைஇணைப்பு
+Name[tg]=Интерфейс барномаи идоракунии тафсирҳо
+Name[tr]=KDevelop Sürüm Kontrol Arayüzü
+Name[zh_CN]=KDevelop 版本控制接口
+Name[zh_TW]=KDevelop 版本控制介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extensions/kdevmakefrontend.cpp b/lib/interfaces/extensions/kdevmakefrontend.cpp
new file mode 100644
index 00000000..5e035270
--- /dev/null
+++ b/lib/interfaces/extensions/kdevmakefrontend.cpp
@@ -0,0 +1,2 @@
+#include "kdevmakefrontend.h"
+#include "kdevmakefrontend.moc"
diff --git a/lib/interfaces/extensions/kdevmakefrontend.h b/lib/interfaces/extensions/kdevmakefrontend.h
new file mode 100644
index 00000000..6014ff34
--- /dev/null
+++ b/lib/interfaces/extensions/kdevmakefrontend.h
@@ -0,0 +1,106 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001 Sandy Meier <smeier@kdevelop.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+ Copyright (C) 2003 Hamish Rodda <rodda@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVMAKEFRONTEND_H
+#define KDEVMAKEFRONTEND_H
+
+#include <qstringlist.h>
+#include <kdevplugin.h>
+
+/**
+@file kdevmakefrontend.h
+Make frontend interface.
+*/
+
+/**
+KDevelop make frontend interface.
+This is the abstract base class for plugins that are able to run "make"
+or similar commands to build a project, api documentation, etc.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevMakeFrontend *mf = extension<KDevMakeFrontend>("KDevelop/MakeFrontend");
+if (mf) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa KDevPlugin::extension method documentation.
+*/
+class KDevMakeFrontend : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevMakeFrontend(const KDevPluginInfo *info, QObject *parent=0, const char *name=0 )
+ :KDevPlugin(info, parent, name ? name : "KDevMakeFrontend") {}
+
+ /**@return The widget where the make output is shown.*/
+ virtual QWidget* widget() { return 0L; }
+
+ /**The component shall start to execute a make-like command.
+ * Commands are always asynchronous. You can submit several jobs
+ * without caring about another job already running. There are
+ * executed in the order in which they are submitted. If one of
+ * then fails, all following jobs are dropped.
+ * You should not make any assumptions about the directory in which
+ * the command is started. If the command depends on that, put and
+ * explicit 'cd' into the command.
+ * @param dir A starting directory to find files when parsing compiler error
+ * messages.
+ * @param command A shell command to execute.
+ */
+ virtual void queueCommand(const QString &dir, const QString &command) = 0;
+
+ /**@return Whether the application is currently running.*/
+ virtual bool isRunning() = 0;
+
+ /**Advices to synchronize the settings from KConfig because they were changed externally.*/
+ virtual void updateSettingsFromConfig() = 0;
+
+signals:
+ /**
+ * Only emitted if the command was succesfully finished.
+ */
+ void commandFinished(const QString &command);
+
+ /**
+ * Emitted if a command failed.
+ */
+ void commandFailed(const QString &command);
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevquickopen.h b/lib/interfaces/extensions/kdevquickopen.h
new file mode 100644
index 00000000..3fd108c8
--- /dev/null
+++ b/lib/interfaces/extensions/kdevquickopen.h
@@ -0,0 +1,130 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVQUICKOPEN_H
+#define KDEVQUICKOPEN_H
+
+#include <kdevplugin.h>
+#include <kurl.h>
+
+/**
+@file kdevquickopen.h
+Source formatter interface.
+*/
+
+/**
+Quick open plugin interface.
+
+Use it when you need to present a dialog to choose between files to open.
+@code
+KDevQuickOpen *qo = extension<KDevQuickOpen>("KDevelop/QuickOpen");
+if (qo) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa @ref KDevPlugin::extension method documentation.
+@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation.
+*/
+class KDevQuickOpen : public KDevPlugin
+{
+public:
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevQuickOpen(const KDevPluginInfo *info, QObject* parent, const char* name)
+ :KDevPlugin(info, parent, name) {}
+
+ /**Shows the file selection dialog.
+ @param text A list of urls to open.*/
+ virtual void quickOpenFile(const KURL::List urls) = 0;
+};
+
+#endif
+/* This file is part of the KDE project
+ Copyright (C) 2007 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVQUICKOPEN_H
+#define KDEVQUICKOPEN_H
+
+#include <kdevplugin.h>
+#include <kurl.h>
+
+/**
+@file kdevquickopen.h
+Source formatter interface.
+*/
+
+/**
+Quick open plugin interface.
+
+Use it when you need to present a dialog to choose between files to open.
+@code
+KDevQuickOpen *qo = extension<KDevQuickOpen>("KDevelop/QuickOpen");
+if (qo) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa @ref KDevPlugin::extension method documentation.
+@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation.
+*/
+class KDevQuickOpen : public KDevPlugin
+{
+public:
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevQuickOpen(const KDevPluginInfo *info, QObject* parent, const char* name)
+ :KDevPlugin(info, parent, name) {}
+
+ /**Shows the file selection dialog.
+ @param text A list of urls to open.*/
+ virtual void quickOpenFile(const KURL::List urls) = 0;
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevsourceformatter.h b/lib/interfaces/extensions/kdevsourceformatter.h
new file mode 100644
index 00000000..82a9531f
--- /dev/null
+++ b/lib/interfaces/extensions/kdevsourceformatter.h
@@ -0,0 +1,69 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVSOURCEFORMATTER_H
+#define KDEVSOURCEFORMATTER_H
+
+#include <kdevplugin.h>
+
+/**
+@file kdevsourceformatter.h
+Source formatter interface.
+*/
+
+/**
+Source formatter interface.
+This interface is responsible for formatting source files and strings of code.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevSourceFormatter *sf = extension<KDevSourceFormatter>("KDevelop/SourceFormatter");
+if (sf) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa @ref KDevPlugin::extension method documentation.
+@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation.
+*/
+class KDevSourceFormatter : public KDevPlugin
+{
+public:
+ /**Constructor.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevSourceFormatter(const KDevPluginInfo *info, QObject* parent, const char* name)
+ :KDevPlugin(info, parent, name) {}
+
+ /**Formats the source.
+ @param text A string with a code.
+ @return The formatted string.*/
+ virtual QString formatSource(const QString text) = 0;
+
+ /**@return The indentation string. For example, tab or four spaces can be returned.*/
+ virtual QString indentString() const = 0;
+};
+
+#endif
diff --git a/lib/interfaces/extensions/kdevversioncontrol.h b/lib/interfaces/extensions/kdevversioncontrol.h
new file mode 100644
index 00000000..d6e69e08
--- /dev/null
+++ b/lib/interfaces/extensions/kdevversioncontrol.h
@@ -0,0 +1,237 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVVERSIONCONTROL_H
+#define KDEVVERSIONCONTROL_H
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qwidget.h>
+#include <qmap.h>
+#include <qvaluelist.h>
+
+#include <kdevplugin.h>
+
+/**
+@file kdevversioncontrol.h
+Version control system interface and utility classes.
+*/
+
+/**
+Info about file state in VCS.
+
+Used, for example in file views to display VCS related information about files.
+*/
+struct VCSFileInfo
+{
+ /**State of the file.*/
+ enum FileState {
+ Unknown /**<No VCS information about a file is known.*/,
+ Added /**<File was added to the repository but not commited.*/,
+ Uptodate /**<File was updated or it is already at up to date version.*/,
+ Modified /**<File was modified locally.*/,
+ Conflict /**<Local version conflicts with the one in a repository.*/,
+ Sticky /**<File is sticky.*/,
+ NeedsPatch /**<File needs a patch.*/,
+ NeedsCheckout /**<File needs to be checkout again.*/,
+ Directory /**<This is a directory.*/ ,
+ Deleted /**<File or Directory is scheduled to be deleted. */ ,
+ Replaced /**<File was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place. */
+ };
+
+ /**Constructor.*/
+ VCSFileInfo() {}
+ /**Constructor.
+ @param fn The file name (without a path).
+ @param workRev The current working revision of a file.
+ @param repoRev The last revision of a file in the repository.
+ @param aState The state of a file.*/
+ VCSFileInfo( QString fn, QString workRev, QString repoRev, FileState aState )
+ : fileName(fn), workRevision(workRev), repoRevision(repoRev), state(aState) {}
+
+ /**The file name.*/
+ QString fileName; // Yeah, _just_ the file name ;-)
+ /**The working revision number.*/
+ QString workRevision;
+ /**The repository revision number.*/
+ QString repoRevision;
+ /**The state of a file.*/
+ FileState state;
+
+ /**@return A descriptive string with all VCS related info about the file.*/
+ QString toString() const
+ {
+ return "(" + fileName + ", " + workRevision + ", " + repoRevision + ", " + state2String( state ) + ")";
+ }
+
+ /**@return A textual VCS state description.*/
+ static QString state2String( FileState state )
+ {
+ switch (state)
+ {
+ case Added: return "added";
+ case Uptodate: return "up-to-date";
+ case Modified: return "modified";
+ case Conflict: return "conflict";
+ case Sticky: return "sticky";
+ case NeedsPatch: return "needs patch";
+ case NeedsCheckout: return "needs check-out";
+ case Directory: return "directory";
+ case Deleted: return "deleted";
+ case Replaced: return "replaced";
+ case Unknown:
+ default:
+ return "unknown";
+ }
+ }
+
+};
+
+/**@class FileDom
+Info for a bunch of files that got modified.
+This is a type definition: @code QMap<QString,VCSFileInfo> VCSFileInfoMap; @endcode
+*/
+typedef QMap<QString,VCSFileInfo> VCSFileInfoMap;
+
+class KDevVCSFileInfoProvider;
+
+
+/**
+KDevelop version control system interface.
+This is the abstract base class which encapsulates everything
+necessary for communicating with version control systems.
+VCS support plugins should implement this interface.
+
+Instances that implement this interface are available through extension architecture:
+@code
+KDevVersionControl *vcs = extension<KDevVersionControl>("KDevelop/VersionControl");
+if (vcs) {
+ // do something
+} else {
+ // fail
+}
+@endcode
+@sa KDevPlugin::extension method documentation.
+*/
+class KDevVersionControl: public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ /**Constructs a VCS plugin.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevVersionControl(const KDevPluginInfo *info, QObject *parent, const char *name )
+ :KDevPlugin(info, parent, name ) {}
+
+ /**Creates a new project in the passed path @p dir. This should instantiate
+ VCS infrastructure and import a project into the VCS in that directory.
+ @param dir The absolute path to the directory where VCS infrastructure should be
+ created.*/
+ virtual void createNewProject(const QString& dir) = 0;
+
+ /**Fetches a module from remote repository, so it can be used for importing.
+ @return true in case of success.*/
+ virtual bool fetchFromRepository() = 0;
+
+ /**@return The file info provider for this version control (0 if none is available).*/
+ virtual KDevVCSFileInfoProvider *fileInfoProvider() const = 0;
+
+ /**Checks if the directory is valid for this version control (for example
+ CVS may check for the presence of "<dirPath>/CVS/" subdir and something else)
+ @param dirPath The absolute path of the directory.
+ @return true if the directory is valid for this version control
+ <b>warning</b>: this returns false by default.*/
+ virtual bool isValidDirectory(const QString &dirPath) const = 0;
+
+
+signals:
+ /**Emitted when the Version Control has finished importing a module from remote
+ repository
+ @param destinationDir The directory where the module has been fetched.*/
+ void finishedFetching(QString destinationDir);
+
+};
+
+/**
+Basic interface for providing info on file registered in a version control repository repository.
+*/
+class KDevVCSFileInfoProvider: public QObject
+{
+ Q_OBJECT
+public:
+ /**Constructor.
+ @param parent The parent VCS plugin.
+ @param name The name of a provider object.*/
+ KDevVCSFileInfoProvider(KDevVersionControl *parent, const char *name)
+ : QObject( parent, name ), m_owner(parent) {}
+
+ /**Gets the status for local files in the specified directory:
+ the info are collected locally so they are necessarily in sync with the repository
+
+ This is a <b>synchronous operation</b> (blocking).
+ @param dirPath The relative (to project dir) directory path to stat.
+ @return Status for all <b>registered</b> files.*/
+ virtual const VCSFileInfoMap *status(const QString &dirPath) = 0;
+
+ /**Starts a request for directory status to the remote repository.
+ Requests and answers are asynchronous.
+
+ This is an <b>asynchronous operation for requesting data</b>, so
+ for obvious reasons: the caller must connect the statusReady() signal and
+ check for the return value of this method.
+ @param dirPath The (relative to project directory) directory which status you are asking for.
+ @param callerData The pointer to some data you want the provider will return
+ to you when it has done.
+ @param recursive If false, retrieve information only for dirPath's immediate children.
+ @param checkRepos If true, contact remote repository and augment repository's status.
+ If false, retrieve only for local modification information.
+ @return true if the request has been successfully started, false otherwise.*/
+ virtual bool requestStatus( const QString &dirPath, void *callerData, bool recursive = true, bool checkRepos = true ) = 0;
+
+signals:
+ /**Emitted when the status request to remote repository has finished.
+ @param fileInfoMap The status for <b>registered in repository</b> files.
+ @param callerData The pointer to some data you want the provider will return
+ to you when it has done
+ @see requestStatus for to find out when this signal should be used.*/
+ void statusReady(const VCSFileInfoMap &fileInfoMap, void *callerData);
+
+protected:
+ /**@return The version control which owns this provider.*/
+ KDevVersionControl *owner() const { return m_owner; }
+
+private:
+ KDevVersionControl *m_owner;
+
+private:
+ KDevVCSFileInfoProvider( const KDevVCSFileInfoProvider & );
+ KDevVCSFileInfoProvider &operator=( const KDevVCSFileInfoProvider & );
+};
+
+#endif
diff --git a/lib/interfaces/external/Mainpage.dox b/lib/interfaces/external/Mainpage.dox
new file mode 100644
index 00000000..4618c3d5
--- /dev/null
+++ b/lib/interfaces/external/Mainpage.dox
@@ -0,0 +1,57 @@
+/**
+@mainpage The %KInterfaceDesigner Library
+
+This library contains all %KInterfaceDesigner classes and interfaces which form the core of
+GUI Designer integration framework.
+
+<b>Link with</b>: -lkinterfacedesigner
+
+<b>Include path</b>: -I\$(kde_includes)/kinterfacedesigner
+
+\section designerintegration Overview of GUI designer integration process
+Each KPart that wants to act as a GUI Designer must implement @ref KInterfaceDesigner::Designer
+interface. It defines necessary signals to communicate with an IDE and abstract virtual
+functions to determine designer type.
+
+If a part which can "design" user interface files of a certain mimetype
+implements this interface and sets itself as a default handler for that
+mimetype then it becomes automatically integrated into KDevelop IDE.
+
+When a part is embedded into KDevelop shell, its signals (defined in @ref
+KInterfaceDesigner::Designer interface):
+@code
+ void addedFunction(DesignerType type, const QString &formName, Function function)
+ void removedFunction(DesignerType type, const QString &formName, Function function)
+ void editedFunction(DesignerType type, const QString &formName, Function oldFunction, Function function)
+ void editFunction(DesignerType type, const QString &formName, const QString &functionName)
+ void editSource(DesignerType type, const QString &formName);
+@endcode
+are connected to corresponding slots of KDevelop designer integration engine which can be implemented in KDevelop language support plugin.
+
+Each language support which wants to use integrated designer, must reimplement
+@code
+virtual KDevDesignerIntegration *KDevLanguageSupport::designer(KInterfaceDesigner::DesignerType type)
+@endcode
+method and return designer integration object.
+
+Convenience designer integration support library is available for programming language support
+developers. With the convenience library writing %Qt designer integration for the language is a
+trivial task.
+
+
+\section kdevdesigner KDevelop Designer technical overview
+KDevelop version >= 3.1 comes with a customized version (fork ;)) of %Qt Designer. It is called KDevelop Designer (KDevDesigner, kdevdesigner from the command line). KDevDesigner has some important differences:
+- KDevDesigner provides a read/write KPart which can be embedded into any application which wants to edit .ui files. KDevelop IDE embeds KDevDesigner this way.
+- KDevDesigner uses %KDE icons and dialogs and thus provides better integration with a system.
+.
+
+It is safe to preview forms with some %KDE widgets from kdeui and kio libraries - KDevDesigner part is linked to those libraries so it will not crash under some circumstances.
+
+KDevDesigner will not create .ui.h files - this feature is completely disabled. Integrated KDevDesigner will use subclassing approach, standalone does not allow to enter code.
+
+\section other Other information
+
+@note It is technically possible to integrate not only %Qt Designer, but also, for example, Glade. Glade-3 can be compiled as a library and probably be embedded via XParts technology.
+
+*/
+
diff --git a/lib/interfaces/external/Makefile.am b/lib/interfaces/external/Makefile.am
new file mode 100644
index 00000000..bcad37b3
--- /dev/null
+++ b/lib/interfaces/external/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = $(all_includes)
+
+METASOURCES = AUTO
+
+kinterfacedesignerdir = $(includedir)/kinterfacedesigner
+kinterfacedesigner_HEADERS = designer.h
+
+lib_LTLIBRARIES = libkinterfacedesigner.la
+libkinterfacedesigner_la_LIBADD = $(LIB_QT) $(LIB_KPARTS) $(LIB_KDEUI)
+libkinterfacedesigner_la_LDFLAGS = $(all_libraries)
+libkinterfacedesigner_la_SOURCES = designer.cpp
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils
+DOXYGEN_PROJECTNAME = KInterfaceDesigner Library
+include ../../../Doxyfile.am
diff --git a/lib/interfaces/external/designer.cpp b/lib/interfaces/external/designer.cpp
new file mode 100644
index 00000000..b7c5de7a
--- /dev/null
+++ b/lib/interfaces/external/designer.cpp
@@ -0,0 +1,30 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "designer.h"
+
+namespace KInterfaceDesigner{
+
+Designer::Designer(QObject *parent, const char *name)
+ :KParts::ReadWritePart(parent, name)
+{
+}
+
+}
+
+#include "designer.moc"
diff --git a/lib/interfaces/external/designer.h b/lib/interfaces/external/designer.h
new file mode 100644
index 00000000..5c7821fa
--- /dev/null
+++ b/lib/interfaces/external/designer.h
@@ -0,0 +1,98 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KINTERFACEDESIGNER_FORMEDITOR_H
+#define KINTERFACEDESIGNER_FORMEDITOR_H
+
+#include <kparts/part.h>
+
+/**Contains KInterfaceDesigner classes.*/
+namespace KInterfaceDesigner{
+
+/**The type of a GUI Designer.*/
+enum DesignerType {
+ QtDesigner /**<Qt Designer.*/,
+ Glade /**<Glade (version >= 3).*/
+};
+
+/**Function type.*/
+enum FunctionType {
+ ftFunction /**<Simple function or a callback.*/,
+ ftQtSlot /**<Qt slot.*/
+};
+
+/**Function.*/
+struct Function{
+ /**Return type.*/
+ QString returnType;
+ /**Function name.*/
+ QString function;
+ /**Specifier, e.g. virtual, static, etc.*/
+ QString specifier;
+ /**Access, e.g. private, protected, public, etc.*/
+ QString access;
+ /**Function type.*/
+ FunctionType type;
+};
+
+/**
+GUI Designer Part Interface.
+Each KPart that wants to act as a GUI Designer must implement this interface.
+It defines necessary signals to communicate with an IDE and abstract virtual
+functions to determine designer type.
+
+Parts that implement this interface must emit its signals when necessary.
+See signals documentation for an explanation on when to emit those.
+
+If a part which can "design" user interface files of a certain mimetype
+implements this interface and sets itself as a default handler for that
+mimetype then it becomes automatically integrated into KDevelop IDE.
+*/
+class Designer: public KParts::ReadWritePart{
+ Q_OBJECT
+public:
+ Designer(QObject *parent, const char *name);
+
+ /**Reimplement this to be able to open projects.*/
+ virtual void openProject(const QString &projectFile) = 0;
+ /**Reimplement this return the type of this designer.*/
+ virtual DesignerType designerType() = 0;
+
+signals:
+ /**Emit this signal when a function was added by a designer. For example, when a slot
+ or a callback function was defined.*/
+ void addedFunction(DesignerType type, const QString &formName, Function function);
+ /**Emit this signal when a function was removed by a designer.*/
+ void removedFunction(DesignerType type, const QString &formName, Function function);
+ /**Emit this signal when a function signature was edited by a designer.*/
+ void editedFunction(DesignerType type, const QString &formName, Function oldFunction, Function function);
+
+ /**Emit this signal when a designer wants to open the editor with function definition.*/
+ void editFunction(DesignerType type, const QString &formName, const QString &functionName);
+ /**Emit this signal when a designer wants to open the editor for a form sources.*/
+ void editSource(DesignerType type, const QString &formName);
+
+ /**Emitted when a form state is changed in the designer.
+ @param formName An absolute name of the form file.
+ @param status 0: form is clean, 1: form is modified.*/
+ void newStatus(const QString &formName, int status);
+};
+
+}
+
+#endif
diff --git a/lib/interfaces/extras/Mainpage.dox b/lib/interfaces/extras/Mainpage.dox
new file mode 100644
index 00000000..f72dade5
--- /dev/null
+++ b/lib/interfaces/extras/Mainpage.dox
@@ -0,0 +1,11 @@
+/**
+@mainpage The KDevelop Extra Interfaces Library
+
+This library contains extra interfaces that are not the part of KDevelop plugin architecture
+but that can be implemented by extra plugins or "plugins for plugins".
+
+<b>Link with</b>: -lkdevextras
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/interfaces/extras
+*/
+
diff --git a/lib/interfaces/extras/Makefile.am b/lib/interfaces/extras/Makefile.am
new file mode 100644
index 00000000..b8b3e091
--- /dev/null
+++ b/lib/interfaces/extras/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \
+ $(all_includes)
+METASOURCES = AUTO
+libkdevextras_la_LIBADD = $(LIB_QT)
+libkdevextras_la_LDFLAGS = $(all_libraries)
+lib_LTLIBRARIES = libkdevextras.la
+kdevelopincludedir = $(includedir)/kdevelop/interfaces/extras
+servicetypedir = $(kde_servicetypesdir)
+
+kdevelopinclude_HEADERS = kdevcompileroptions.h kdevvcsintegrator.h
+libkdevextras_la_SOURCES = kdevcompileroptions.cpp kdevvcsintegrator.cpp
+servicetype_DATA = kdevelopcompileroptions.desktop \
+ kdevelopvcsintegrator.desktop
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevinterfaces
+DOXYGEN_PROJECTNAME = KDevelop Extra Interfaces Library
+DOXYGEN_DOCDIRPREFIX = kdev
+include ../../../Doxyfile.am
diff --git a/lib/interfaces/extras/kdevcompileroptions.cpp b/lib/interfaces/extras/kdevcompileroptions.cpp
new file mode 100644
index 00000000..5d87eec7
--- /dev/null
+++ b/lib/interfaces/extras/kdevcompileroptions.cpp
@@ -0,0 +1,6 @@
+#include "kdevcompileroptions.h"
+
+KDevCompilerOptions::KDevCompilerOptions( QObject * parent, const char * name )
+ :QObject(parent, name)
+{
+}
diff --git a/lib/interfaces/extras/kdevcompileroptions.h b/lib/interfaces/extras/kdevcompileroptions.h
new file mode 100644
index 00000000..268ce0af
--- /dev/null
+++ b/lib/interfaces/extras/kdevcompileroptions.h
@@ -0,0 +1,90 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+@file kdevcompileroptions.h
+The interface to compiler options configuration.
+*/
+
+#ifndef _KDEVCOMPILEROPTIONS_H_
+#define _KDEVCOMPILEROPTIONS_H_
+
+#include <qobject.h>
+
+/**
+The interface to compiler options configuration.
+Used by build systems to give users a compiler options configuration dialog.
+
+Common use case:
+@code
+static KDevCompilerOptions *createCompilerOptions( const QString &name, QObject *parent )
+{
+ KService::Ptr service = KService::serviceByDesktopName( name );
+ if ( !service )
+ return 0;
+
+ KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library()));
+ if (!factory)
+ return 0;
+
+ QStringList args;
+ QVariant prop = service->property("X-KDevelop-Args");
+ if (prop.isValid())
+ args = QStringList::split(" ", prop.toString());
+
+ QObject *obj = factory->create(parent, service->name().latin1(),
+ "KDevCompilerOptions", args);
+
+ if (!obj->inherits("KDevCompilerOptions"))
+ return 0;
+
+ KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj;
+ return dlg;
+}
+
+...
+KDevCompilerOptions *plugin = createCompilerOptions(compilerName, parent);
+QString flags = ""; //old compiler flags
+if ( plugin )
+{
+ flags = plugin->exec( parent, flags ); //new compiler flags are returned
+ delete plugin;
+}
+@endcode
+*/
+class KDevCompilerOptions : public QObject
+{
+ Q_OBJECT
+
+public:
+ KDevCompilerOptions( QObject *parent=0, const char *name=0 );
+
+ /**
+ * Opens a dialog which allows the user to configure the
+ * compiler options. The initial settings in the dialog
+ * will be set from the flags argument of this method.
+ * After the dialog is accepted, the new settings will
+ * be returned as a string. If the dialog was cancelled,
+ * QString::null is returned.
+ */
+ virtual QString exec(QWidget *parent, const QString &flags) = 0;
+};
+
+#endif
diff --git a/lib/interfaces/extras/kdevelopcompileroptions.desktop b/lib/interfaces/extras/kdevelopcompileroptions.desktop
new file mode 100644
index 00000000..7ed1df67
--- /dev/null
+++ b/lib/interfaces/extras/kdevelopcompileroptions.desktop
@@ -0,0 +1,48 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/CompilerOptions
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Compiler Options Dialog Interface
+Name[ca]=Interfície del diàleg d'opcions del compilador per a KDevelop
+Name[da]=KDevelop grænseflade til oversætterindstillinger
+Name[de]=Schnittstelle für Compiler-Einstellungsdialoge (KDevelop)
+Name[el]=Διασύνδεση διαλόγου επιλογών μεταγλωττιστή KDevelop
+Name[en_GB]=KDevelop Compiler Options Dialogue Interface
+Name[es]=Interfaz del diálogo de opciones del compilador de KDevelop
+Name[et]=KDevelopi kompilaatori valikute dialoogiliides
+Name[eu]=KDevelop-en konpiladore aukeren elkarrizketa-koadro interfazea
+Name[fa]=واسط محاورۀ گزینه‌های مترجم KDevelop
+Name[fr]=Interface de la boîte de dialogue des options du compilateur de KDevelop
+Name[gl]=Interface do diálogo de opcións de compilación de KDevelop
+Name[hi]=के-डेवलप कम्पायलर विकल्प संवाद इंटरफ़ेस
+Name[hu]=A KDevelop fordítási opcióinak párbeszédablaka
+Name[it]=Interfaccia KDevelop per le opzioni di compilazione
+Name[ja]=KDevelop コンパイラオプションダイアログ インターフェース
+Name[nds]=KDevelop-Dialoogkoppelsteed för Kompilerer-Optschonen
+Name[ne]=केडीई विकास कम्पाइलर विकल्प संवाद इन्टरफेस
+Name[nl]=KDevelop Compileroptiesdialoog-interface
+Name[pl]=Interfejs KDevelopa do okna dialogowego opcji kompilatora
+Name[pt]=Interface da Janela de Opções do Compilador do KDevelop
+Name[pt_BR]=Interface de Diálogo de Opções do Compilador do KDevelop
+Name[ru]=Интерфейс диалога опций компилятора
+Name[sk]=KDevelop rozhranie pre možnosti kompilátora
+Name[sl]=Vmesnik za možnosti prevajanja v KDevelopu
+Name[sr]=KDevelop-ов интерфејс дијалога „Опције преводиоца“
+Name[sr@Latn]=KDevelop-ov interfejs dijaloga „Opcije prevodioca“
+Name[sv]=KDevelop dialoggränssnitt för kompilatoralternativ
+Name[ta]=கெடெவலப் தொகுப்பித் தேர்வுகள் உரை இடைமுகம்
+Name[tg]=Гуфтугуи интерфейси талфифгари интихоб
+Name[tr]=KDevelop Derleyici Seçenekleri Pencere Arayüzü
+Name[zh_CN]=KDevelop编译器选项对话框接口
+Name[zh_TW]=KDevelop 編譯器選項對話框介面
+
+[PropertyDef::X-KDevelop-Language]
+Type=QString
+
+[PropertyDef::X-KDevelop-Default]
+Type=bool
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extras/kdevelopvcsintegrator.desktop b/lib/interfaces/extras/kdevelopvcsintegrator.desktop
new file mode 100644
index 00000000..141bf189
--- /dev/null
+++ b/lib/interfaces/extras/kdevelopvcsintegrator.desktop
@@ -0,0 +1,45 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/VCSIntegrator
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop VCS Integrator
+Name[ca]=Integrador VCS per a KDevelop
+Name[da]=KDevelop VCS-importør
+Name[de]=VCS-Integration für KDevelop
+Name[el]=Ενσωματωτής VCS του KDevelop
+Name[es]=Integrador VCS de KDevelop
+Name[et]=KDevelopi VCS põimija
+Name[eu]=KDevelop-en VCS integratzailea
+Name[fa]=مجتمع‌ساز KDevelop VCS
+Name[fr]=Intégrateur VCS de KDevelop
+Name[gl]=Integrador de VCS de KDevelop
+Name[hu]=KDevelop VCS-integráló
+Name[it]=Integratore VCS di KDevelop
+Name[ja]=KDevelop VCS インテグレータ
+Name[nds]=VKS-Integreren för KDevelop
+Name[ne]=KDevelop VCS इन्टिगेटर
+Name[pl]=KDevelop: integracja z VCS
+Name[pt]=Importador de VCS do KDevelop
+Name[pt_BR]=Integrador VCS para o KDevelop
+Name[ru]=Модуль работы с системами контроля версий для KDevelop
+Name[sk]=Kdevelop VCS integrácia
+Name[sr]=KDevelop-ов VCS интегратор
+Name[sr@Latn]=KDevelop-ov VCS integrator
+Name[sv]=KDevelop VCS-import
+Name[tr]=KDevelop VCS Bütünleyicisi
+Name[zh_CN]=KDevelop VCS 集成器
+Name[zh_TW]=KDevelop VCS 整合器
+
+[PropertyDef::X-KDevelop-VCS]
+Type=QString
+
+[PropertyDef::X-KDevelop-VCSPlugin]
+Type=QString
+
+[PropertyDef::X-KDevelop-Default]
+Type=bool
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/extras/kdevvcsintegrator.cpp b/lib/interfaces/extras/kdevvcsintegrator.cpp
new file mode 100644
index 00000000..d231030a
--- /dev/null
+++ b/lib/interfaces/extras/kdevvcsintegrator.cpp
@@ -0,0 +1,26 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevvcsintegrator.h"
+
+KDevVCSIntegrator::KDevVCSIntegrator(QObject *parent, const char *name)
+ :QObject(parent, name)
+{
+}
+
+#include "kdevvcsintegrator.moc"
diff --git a/lib/interfaces/extras/kdevvcsintegrator.h b/lib/interfaces/extras/kdevvcsintegrator.h
new file mode 100644
index 00000000..d180e55f
--- /dev/null
+++ b/lib/interfaces/extras/kdevvcsintegrator.h
@@ -0,0 +1,76 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVVCSINTEGRATOR_H
+#define KDEVVCSINTEGRATOR_H
+
+#include <qobject.h>
+
+/**
+@file kdevvcsintegrator.h
+The interface to VCS integrators.
+*/
+
+class QDomDocument;
+class QWidget;
+
+/**
+VCS Integration Dialog.
+
+Usually it is created as:
+@code
+class MyVCSDialog: public QWidget, public VCSDialog {
+ MyVCSDialog(QWidget *parent = 0, const char *name = 0);
+ virtual void accept() { ... }
+ virtual void init(const QString &projectName, const QString &projectLocation) { ... }
+ virtual QWidget *self() {
+ return const_cast<MyVCSDialog*>(this);
+ }
+}
+@endcode
+*/
+class VCSDialog {
+public:
+ VCSDialog() { }
+ /**Implement all integration actions here. Do not use QDialog::accept method
+ to perform integration actions.*/
+ virtual void accept() = 0;
+ /**Init integration dialog with the project name and location.*/
+ virtual void init(const QString &projectName, const QString &projectLocation) = 0;
+ /**Reimplement to return an actual integration widget. Use QWidgets for that, not
+ QDialogs because integrator dialogs are usually have parent containers.*/
+ virtual QWidget *self() = 0;
+};
+
+/**
+The interface to VCS integrators.
+VCS integrator takes care about setting up VCS for new and existing projects.
+It can, for example, perform checkout or import operations.
+*/
+class KDevVCSIntegrator: public QObject {
+ Q_OBJECT
+public:
+ KDevVCSIntegrator(QObject *parent = 0, const char *name = 0);
+
+ /**Reimplement to return a dialog to fetch the project from VCS.*/
+ virtual VCSDialog *fetcher(QWidget *parent) = 0;
+ /**Reimplement to return a dialog to integrate the project into VCS.*/
+ virtual VCSDialog *integrator(QWidget *parent) = 0;
+};
+
+#endif
diff --git a/lib/interfaces/hashedstring.cpp b/lib/interfaces/hashedstring.cpp
new file mode 100644
index 00000000..38fdf4a9
--- /dev/null
+++ b/lib/interfaces/hashedstring.cpp
@@ -0,0 +1,362 @@
+/***************************************************************************
+ copyright : (C) 2006 by David Nolden
+ email : david.nolden.kdevelop@art-master.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "hashedstring.h"
+#include <kdatastream.h>
+#include <sstream>
+#include <algorithm>
+#include <iterator>
+#include<ext/hash_set>
+#include<set>
+#include<algorithm>
+
+//It needs to be measured whether this flag should be turned on or off. It seems just to move the complexity from one position to the other, without any variant being really better.
+#define USE_HASHMAP
+
+size_t fastHashString( const QString& str );
+
+size_t hashStringSafe( const QString& str ) {
+ size_t hash = 0;
+ int len = str.length();
+ for( int a = 0; a < len; a++ ) {
+ hash = str[a].unicode() + (hash * 17);
+ }
+ return hash;
+}
+
+size_t HashedString::hashString( const QString& str )
+{
+ return fastHashString( str );
+}
+
+size_t fastHashString( const QString& str ) {
+ size_t hash = 0;
+ if( !str.isEmpty() ) {
+ const QChar* curr = str.unicode();
+ const QChar* end = curr + str.length();
+ QChar c;
+ for(; curr < end ;) {
+ c = *curr;
+ hash = c.unicode() + ( hash * 17 );
+ ++curr;
+ }
+ }
+ return hash;
+}
+
+void HashedString::initHash() {
+ m_hash = hashString( m_str );
+}
+
+
+class HashedStringSetData : public KShared {
+ public:
+#ifdef USE_HASHMAP
+ typedef __gnu_cxx::hash_set<HashedString> StringSet;
+#else
+ typedef std::set<HashedString> StringSet; //must be a set, so the set-algorithms work
+#endif
+ StringSet m_files;
+ mutable bool m_hashValid;
+ mutable size_t m_hash;
+ HashedStringSetData() : m_hashValid( false ) {
+ }
+ inline void invalidateHash() {
+ m_hashValid = false;
+ }
+
+ void computeHash() const;
+};
+
+void HashedStringSetData::computeHash() const {
+ int num = 1;
+ m_hash = 0;
+ for( StringSet::const_iterator it = m_files.begin(); it != m_files.end(); ++it ) {
+ num *= 7;
+ m_hash += num * (*it).hash();
+ }
+ m_hashValid = true;
+}
+
+HashedStringSet::HashedStringSet() {}
+
+HashedStringSet::~HashedStringSet() {}
+
+HashedStringSet::HashedStringSet( const HashedString& file ) {
+ insert( file );
+}
+
+HashedStringSet::HashedStringSet( const HashedStringSet& rhs ) : m_data( rhs.m_data ) {}
+
+HashedStringSet operator + ( const HashedStringSet& lhs, const HashedStringSet& rhs ) {
+ HashedStringSet ret = lhs;
+ ret += rhs;
+
+ return ret;
+}
+
+int HashedStringSet::size() const {
+ if( !m_data ) return 0;
+ return m_data->m_files.size();
+}
+
+HashedStringSet& HashedStringSet::operator = ( const HashedStringSet& rhs ) {
+ m_data = rhs.m_data;
+ return *this;
+}
+
+HashedStringSet& HashedStringSet::operator +=( const HashedStringSet& rhs ) {
+ if ( !rhs.m_data )
+ return * this;
+
+#ifndef USE_HASHMAP
+ KSharedPtr<HashedStringSetData> oldData = m_data;
+ if( !oldData ) oldData = new HashedStringSetData();
+ m_data = new HashedStringSetData();
+ std::set_union( oldData->m_files.begin(), oldData->m_files.end(), rhs.m_data->m_files.begin(), rhs.m_data->m_files.end(), std::insert_iterator<HashedStringSetData::StringSet>( m_data->m_files, m_data->m_files.end() ) );
+#else
+ makeDataPrivate();
+ m_data->m_files.insert( rhs.m_data->m_files.begin(), rhs.m_data->m_files.end() );
+ /*HashedStringSetData::StringSet::const_iterator end = rhs.m_data->m_files.end();
+ HashedStringSetData::StringSet& mySet( m_data->m_files );
+ for( HashedStringSetData::StringSet::const_iterator it = rhs.m_data->m_files.begin(); it != end; ++it ) {
+ mySet.insert( *it );
+ }*/
+
+#endif
+ return *this;
+}
+
+HashedStringSet& HashedStringSet::operator -=( const HashedStringSet& rhs ) {
+ if( !m_data ) return *this;
+ if( !rhs.m_data ) return *this;
+#ifndef USE_HASHMAP
+ KSharedPtr<HashedStringSetData> oldData = m_data;
+ m_data = new HashedStringSetData();
+ std::set_difference( oldData->m_files.begin(), oldData->m_files.end(), rhs.m_data->m_files.begin(), rhs.m_data->m_files.end(), std::insert_iterator<HashedStringSetData::StringSet>( m_data->m_files, m_data->m_files.end() ) );
+#else
+ makeDataPrivate();
+ HashedStringSetData::StringSet::const_iterator end = rhs.m_data->m_files.end();
+ HashedStringSetData::StringSet::const_iterator myEnd = m_data->m_files.end();
+ HashedStringSetData::StringSet& mySet( m_data->m_files );
+ for( HashedStringSetData::StringSet::const_iterator it = rhs.m_data->m_files.begin(); it != end; ++it ) {
+ mySet.erase( *it );
+ }
+
+#endif
+ return *this;
+}
+
+
+void HashedStringSet::makeDataPrivate() {
+ if ( !m_data ) {
+ m_data = new HashedStringSetData();
+ return ;
+ }
+ if ( m_data->_KShared_count() != 1 )
+ m_data = new HashedStringSetData( *m_data );
+}
+
+bool HashedStringSet::operator[] ( const HashedString& rhs ) const {
+ //if ( rhs.str() == "*" )
+ //return true; /// * stands for "any file"
+ if ( !m_data )
+ return false;
+ return m_data->m_files.find( rhs ) != m_data->m_files.end();
+}
+
+void HashedStringSet::insert( const HashedString& str ) {
+ if( str.str().isEmpty() ) return;
+ makeDataPrivate();
+ m_data->m_files.insert( str );
+ m_data->invalidateHash();
+}
+
+bool HashedStringSet::operator <= ( const HashedStringSet& rhs ) const {
+ if ( !m_data )
+ return true;
+ if ( m_data->m_files.empty() )
+ return true;
+ if ( !rhs.m_data )
+ return false;
+#ifndef USE_HASHMAP
+ return std::includes( rhs.m_data->m_files.begin(), rhs.m_data->m_files.end(), m_data->m_files.begin(), m_data->m_files.end() );
+#else
+ const HashedStringSetData::StringSet& otherSet( rhs.m_data->m_files );
+ HashedStringSetData::StringSet::const_iterator end = rhs.m_data->m_files.end();
+ HashedStringSetData::StringSet::const_iterator myEnd = m_data->m_files.end();
+
+ for( HashedStringSetData::StringSet::const_iterator it = m_data->m_files.begin(); it != myEnd; ++it ) {
+ HashedStringSetData::StringSet::const_iterator i = otherSet.find( *it );
+ if( i == end ) return false;
+ }
+ return true;
+#endif
+}
+
+bool HashedStringSet::operator == ( const HashedStringSet& rhs ) const {
+ if( hash() != rhs.hash() ) return false;
+
+ bool empty1 = false;
+ if ( !m_data )
+ empty1 = true;
+ else if ( m_data->m_files.empty() )
+ empty1 = true;
+ bool empty2 = false;
+ if ( !rhs.m_data )
+ empty2 = true;
+ else if ( rhs.m_data->m_files.empty() )
+ empty2 = true;
+
+ if ( empty1 && empty2 )
+ return true;
+ if ( empty1 || empty2 )
+ return false;
+
+ return m_data->m_files == rhs.m_data->m_files;
+}
+
+size_t HashedStringSet::hash() const {
+ if( !m_data ) return 0;
+ if( !m_data->m_hashValid ) m_data->computeHash();
+ return m_data->m_hash;
+}
+
+void HashedStringSet::read( QDataStream& stream ) {
+ bool b;
+ stream >> b;
+ if( b ) {
+ m_data = new HashedStringSetData();
+ int cnt;
+ stream >> cnt;
+ HashedString s;
+ for( int a = 0; a < cnt; a++ ) {
+ stream >> s;
+ m_data->m_files.insert( s );
+ }
+ } else {
+ m_data = 0;
+ }
+}
+
+void HashedStringSet::write( QDataStream& stream ) const {
+ bool b = m_data;
+ stream << b;
+ if( b ) {
+ int cnt = m_data->m_files.size();
+ stream << cnt;
+ for( HashedStringSetData::StringSet::const_iterator it = m_data->m_files.begin(); it != m_data->m_files.end(); ++it ) {
+ stream << *it;
+ }
+ }
+}
+
+std::string HashedStringSet::print() const {
+ std::ostringstream s;
+ if( m_data ) {
+ for( HashedStringSetData::StringSet::const_iterator it = m_data->m_files.begin(); it != m_data->m_files.end(); ++it ) {
+ s << (*it).str().ascii() << "\n";
+ }
+ }
+ return s.str();
+}
+
+QDataStream& operator << ( QDataStream& stream, const HashedString& str ) {
+ stream << str.m_str;
+ stream << str.m_hash;
+ return stream;
+}
+
+QDataStream& operator >> ( QDataStream& stream, HashedString& str ) {
+ stream >> str.m_str;
+ stream >> str.m_hash;
+ return stream;
+}
+
+void HashedStringSetGroup::addSet( size_t id, const HashedStringSet& set ) {
+ if( set.m_data && !set.m_data->m_files.empty() ) {
+ m_sizeMap[ id ] = set.size();
+ for( HashedStringSetData::StringSet::const_iterator it = set.m_data->m_files.begin(); it != set.m_data->m_files.end(); ++it ) {
+ GroupMap::iterator itr = m_map.find( *it );
+ if( itr == m_map.end() ) {
+ itr = m_map.insert( std::make_pair( *it, ItemSet() ) ).first;
+ }
+ itr->second.insert( id );
+ }
+ } else {
+ m_global.insert( id );
+ }
+}
+
+void HashedStringSetGroup::disableSet( size_t id ) {
+ m_disabled.insert( id );
+}
+
+void HashedStringSetGroup::enableSet( size_t id ) {
+ m_disabled.erase( id );
+}
+
+bool HashedStringSetGroup::isDisabled( size_t id ) const {
+ return m_disabled.find( id ) != m_disabled.end();
+}
+
+void HashedStringSetGroup::removeSet( size_t id ) {
+ m_disabled.erase( id );
+ m_global.erase( id );
+ m_sizeMap.erase( id );
+ for( GroupMap::iterator it = m_map.begin(); it != m_map.end(); ++it ) {
+ it->second.erase( id );
+ }
+}
+
+void HashedStringSetGroup::findGroups( HashedStringSet strings, ItemSet& target ) const {
+ target.clear();
+ if( !strings.m_data ) {
+ std::set_difference( m_global.begin(), m_global.end(), m_disabled.begin(), m_disabled.end(), std::insert_iterator<ItemSet>( target, target.end() ) );
+ return;
+ }
+ //This might yet be optimized by sorting the sets according to their size, and starting the intersectioning with the smallest ones.
+ __gnu_cxx::hash_map<size_t, int> hitCounts;
+
+ for( HashedStringSetData::StringSet::const_iterator it = strings.m_data->m_files.begin(); it != strings.m_data->m_files.end(); ++it ) {
+ GroupMap::const_iterator itr = m_map.find( *it );
+ if( itr == m_map.end() ) {
+ //There are no string-sets that include the currently searched for string
+ continue;
+ }
+
+ for( ItemSet::const_iterator it2 = itr->second.begin(); it2 != itr->second.end(); ++it2 ) {
+ __gnu_cxx::hash_map<size_t, int>::iterator v = hitCounts.find( *it2 );
+ if( v != hitCounts.end() ) {
+ ++(*v).second;
+ } else {
+ hitCounts[*it2] = 1;
+ }
+ }
+ }
+
+ //Now count together all groups that are completely within the given string-set(their hitCount equals their size)
+ ItemSet found;
+ for( __gnu_cxx::hash_map<size_t, int>::const_iterator it = hitCounts.begin(); it != hitCounts.end(); ++it ) {
+ if( (*it).second == (*m_sizeMap.find( (*it).first )).second )
+ found.insert( (*it).first );
+ }
+
+
+ std::set_union( found.begin(), found.end(), m_global.begin(), m_global.end(), std::insert_iterator<ItemSet>( target, target.end() ) );
+
+ target.swap( found );
+ target.clear();
+ std::set_difference( found.begin(), found.end(), m_disabled.begin(), m_disabled.end(), std::insert_iterator<ItemSet>( target, target.end() ) );
+}
diff --git a/lib/interfaces/hashedstring.h b/lib/interfaces/hashedstring.h
new file mode 100644
index 00000000..e62ab2e3
--- /dev/null
+++ b/lib/interfaces/hashedstring.h
@@ -0,0 +1,155 @@
+/***************************************************************************
+ copyright : (C) 2006 by David Nolden
+ email : david.nolden.kdevelop@art-master.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef HASHED_STRING_H
+#define HASHED_STRING_H
+
+#include<qstring.h>
+#include<qdatastream.h>
+#include<ksharedptr.h>
+#include<set>
+#include <ext/hash_map>
+#include <string>
+
+///A simple class that stores a string together with it's appropriate hash-key
+class HashedString {
+ public:
+ HashedString() : m_hash( 0 ) {}
+
+ HashedString( const QString& str ) : m_str( str ) {
+ initHash();
+ }
+
+ HashedString( const char* str ) : m_str( str ) {
+ initHash();
+ }
+
+ inline size_t hash() const {
+ return m_hash;
+ }
+
+ QString str() const {
+ return m_str;
+ }
+
+ bool operator == ( const HashedString& rhs ) const {
+ if ( m_hash != rhs.m_hash )
+ return false;
+ return m_str == rhs.m_str;
+ }
+
+ ///Does not compare alphabetically, uses the hash-key for ordering.
+ bool operator < ( const HashedString& rhs ) const {
+ if ( m_hash < rhs.m_hash )
+ return true;
+ if ( m_hash == rhs.m_hash )
+ return m_str < rhs.m_str;
+ return false;
+ }
+
+ static size_t hashString( const QString& str );
+
+ private:
+ void initHash();
+
+ QString m_str;
+ size_t m_hash;
+
+ friend QDataStream& operator << ( QDataStream& stream, const HashedString& str );
+ friend QDataStream& operator >> ( QDataStream& stream, HashedString& str );
+};
+
+QDataStream& operator << ( QDataStream& stream, const HashedString& str );
+
+QDataStream& operator >> ( QDataStream& stream, HashedString& str );
+
+class HashedStringSetData;
+class HashedStringSetGroup;
+
+///This is a reference-counting string-set optimized for fast lookup of hashed strings
+class HashedStringSet {
+ public:
+ HashedStringSet();
+
+ ~HashedStringSet();
+
+ ///Constructs a string-set from one single file
+ HashedStringSet( const HashedString& file );
+
+ HashedStringSet( const HashedStringSet& rhs );
+
+ int size() const;
+
+ HashedStringSet& operator = ( const HashedStringSet& rhs );
+ ///@return whether the given file-name was included
+ bool operator[] ( const HashedString& rhs ) const;
+
+ void insert( const HashedString& str );
+
+ HashedStringSet& operator +=( const HashedStringSet& );
+
+ HashedStringSet& operator -=( const HashedStringSet& );
+
+ ///intersection-test
+ ///Returns true if all files that are part of this set are also part of the given set
+ bool operator <= ( const HashedStringSet& rhs ) const;
+
+ bool operator == ( const HashedStringSet& rhs ) const;
+
+ void read( QDataStream& stream );
+ void write( QDataStream& stream ) const;
+
+ std::string print() const;
+
+ size_t hash() const;
+ private:
+ friend class HashedStringSetGroup;
+ void makeDataPrivate();
+ KSharedPtr<HashedStringSetData> m_data; //this implies some additional cost because KShared's destructor is virtual. Maybe change that by copying KShared without the virtual destructor.
+ friend HashedStringSet operator + ( const HashedStringSet& lhs, const HashedStringSet& rhs );
+};
+
+HashedStringSet operator + ( const HashedStringSet& lhs, const HashedStringSet& rhs );
+
+namespace __gnu_cxx {
+template<>
+struct hash<HashedString> {
+ size_t operator () ( const HashedString& str ) const {
+ return str.hash();
+ }
+};
+}
+
+///Used to find all registered HashedStringSet's that contain all strings given to findGroups(..)
+class HashedStringSetGroup {
+ public:
+ typedef std::set<size_t> ItemSet;
+ void addSet( size_t id, const HashedStringSet& set );
+ void enableSet( size_t id );
+ bool isDisabled( size_t id ) const;
+ void disableSet( size_t id );
+ void removeSet( size_t id );
+
+ //Writes the ids of all registered and not disabled HashedStringSet's that are completely included in the given HashedStringSet efficiently)
+ void findGroups( HashedStringSet strings, ItemSet& target ) const;
+
+ private:
+ typedef __gnu_cxx::hash_map<HashedString, ItemSet> GroupMap;
+ typedef __gnu_cxx::hash_map<size_t, size_t> SizeMap;
+ GroupMap m_map;
+ SizeMap m_sizeMap;
+ ItemSet m_disabled;
+ ItemSet m_global;
+};
+#endif
diff --git a/lib/interfaces/katedocumentmanagerinterface.cpp b/lib/interfaces/katedocumentmanagerinterface.cpp
new file mode 100644
index 00000000..3ad76dd7
--- /dev/null
+++ b/lib/interfaces/katedocumentmanagerinterface.cpp
@@ -0,0 +1,104 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Ian Reinhart Geiser <geiser@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "katedocumentmanagerinterface.h"
+#include "kdevpartcontroller.h"
+#include <kurl.h>
+#include <dcopclient.h>
+#include <kapplication.h>
+#include <dcopref.h>
+#include <kate/document.h>
+#include <kurl.h>
+#include <kdebug.h>
+
+KateDocumentManagerInterface::KateDocumentManagerInterface( KDevPartController *pc)
+ : QObject(pc), DCOPObject("KateDocumentManager"), m_controller(pc)
+{
+
+}
+
+
+KateDocumentManagerInterface::~KateDocumentManagerInterface() {}
+
+
+
+DCOPRef KateDocumentManagerInterface::activeDocument( )
+{
+ return documentWithID(activeDocumentNumber());
+}
+
+DCOPRef KateDocumentManagerInterface::document( uint n )
+{
+ return documentWithID(n);
+}
+
+DCOPRef KateDocumentManagerInterface::documentWithID( uint id )
+{
+ QString dcopobj = "KateDocument#" + QString::number(id);
+ return DCOPRef(kapp->dcopClient()->appId(), dcopobj.latin1() );
+}
+
+DCOPRef KateDocumentManagerInterface::openURL( const KURL &url, const QString &encoding )
+{
+ m_controller->editDocument(url);
+ m_controller->setEncoding(encoding);
+ int idx = findDocument( url );
+ return documentWithID(idx);
+}
+
+bool KateDocumentManagerInterface::closeAllDocuments( )
+{
+ return m_controller->closeAllFiles();
+}
+
+bool KateDocumentManagerInterface::closeDocument( uint n )
+{
+ return false;
+}
+
+bool KateDocumentManagerInterface::isOpen( const KURL &url )
+{
+ return (m_controller->partForURL(url) != 0L);
+}
+
+int KateDocumentManagerInterface::findDocument( const KURL &url )
+{
+ KTextEditor::Document *doc = dynamic_cast<KTextEditor::Document*>(m_controller->partForURL(url));
+ if( doc )
+ return doc->documentNumber();
+ else
+ return 0L;
+}
+
+uint KateDocumentManagerInterface::activeDocumentNumber( )
+{
+ KTextEditor::Document *doc = dynamic_cast<KTextEditor::Document*>(m_controller->activePart());
+ if( doc )
+ {
+ return doc->documentNumber();
+ }
+ else
+ return 0;
+}
+
+uint KateDocumentManagerInterface::documents( )
+{
+ return m_controller->openURLs().count();
+}
+
+#include "katedocumentmanagerinterface.moc"
diff --git a/lib/interfaces/katedocumentmanagerinterface.h b/lib/interfaces/katedocumentmanagerinterface.h
new file mode 100644
index 00000000..f6adfd4f
--- /dev/null
+++ b/lib/interfaces/katedocumentmanagerinterface.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Ian Reinhart Geiser <geiser@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KATEDOCUMENTMANAGERINTERFACE_H
+#define KATEDOCUMENTMANAGERINTERFACE_H
+
+#include <qobject.h>
+#include <dcopobject.h>
+#include <dcopref.h>
+#include <kurl.h>
+class KDevPartController;
+
+/**
+This is an emulated interface to provide compatibility with Kate scripts.
+
+@author KDevelop Authors
+*/
+class KateDocumentManagerInterface : public QObject, public DCOPObject {
+
+ Q_OBJECT
+ K_DCOP
+public:
+ KateDocumentManagerInterface( KDevPartController *pc );
+
+ ~KateDocumentManagerInterface();
+
+k_dcop:
+ DCOPRef activeDocument();
+ DCOPRef document( uint n );
+ DCOPRef documentWithID( uint id );
+ DCOPRef openURL( const KURL &url, const QString &encoding );
+ bool closeAllDocuments();
+ bool closeDocument( uint n );
+ bool isOpen( const KURL &url );
+ int findDocument( const KURL &url );
+ uint activeDocumentNumber();
+ uint documents();
+private:
+
+ KDevPartController *m_controller;
+};
+
+#endif
diff --git a/lib/interfaces/kdevapi.cpp b/lib/interfaces/kdevapi.cpp
new file mode 100644
index 00000000..fb178683
--- /dev/null
+++ b/lib/interfaces/kdevapi.cpp
@@ -0,0 +1,93 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000-2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevapi.h"
+
+#include "kdevcoderepository.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// class KDevApi::Private
+///////////////////////////////////////////////////////////////////////////////
+
+class KDevApi::Private
+{
+public:
+ Private()
+ : m_projectDom(0), m_project(0), m_languageSupport(0),
+ m_codeRepository(0)
+ {}
+
+ QDomDocument *m_projectDom;
+ KDevProject *m_project;
+ KDevLanguageSupport *m_languageSupport;
+ KDevCodeRepository* m_codeRepository;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class KDevApi
+///////////////////////////////////////////////////////////////////////////////
+
+KDevApi::KDevApi()
+{
+ d = new KDevApi::Private;
+ d->m_codeRepository = new KDevCodeRepository();
+}
+
+KDevApi::~KDevApi()
+{
+ delete d->m_codeRepository;
+ delete d;
+}
+
+KDevProject *KDevApi::project() const
+{
+ return d->m_project;
+}
+
+void KDevApi::setProject(KDevProject *project)
+{
+ d->m_project = project;
+}
+
+KDevLanguageSupport *KDevApi::languageSupport() const
+{
+ return d->m_languageSupport;
+}
+
+void KDevApi::setLanguageSupport(KDevLanguageSupport *languageSupport)
+{
+ d->m_languageSupport = languageSupport;
+}
+
+QDomDocument *KDevApi::projectDom() const
+{
+ return d->m_projectDom;
+}
+
+void KDevApi::setProjectDom(QDomDocument *dom)
+{
+ d->m_projectDom = dom;
+}
+
+KDevCodeRepository *KDevApi::codeRepository() const
+{
+ return d->m_codeRepository;
+}
+
+#include "kdevapi.moc"
diff --git a/lib/interfaces/kdevapi.h b/lib/interfaces/kdevapi.h
new file mode 100644
index 00000000..1b6115b0
--- /dev/null
+++ b/lib/interfaces/kdevapi.h
@@ -0,0 +1,103 @@
+/* This file is part of the KDE project
+ Copyright (C) 2000-2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVAPI_H
+#define KDEVAPI_H
+
+#include <qobject.h>
+
+class QStringList;
+class QDomDocument;
+class KDevCore;
+class KDevProject;
+class KDevLanguageSupport;
+class CodeModel;
+class KDevPartController;
+class KDevMainWindow;
+class KDevCodeRepository;
+class KDevPlugin;
+class KDevPluginController;
+
+/**
+@file kdevapi.h
+KDevelop API interface.
+*/
+
+/**
+The interface to KDevelop's core components.
+Needs to be implemented in a shell. Developers do not need to use this
+class because @ref KDevPlugin already provides API convenience methods.
+*/
+class KDevApi: public QObject
+{
+ Q_OBJECT
+public:
+ /**Constructor.*/
+ KDevApi();
+
+ /**Destructor.*/
+ virtual ~KDevApi();
+
+ /**@return A reference to the toplevel widget.*/
+ virtual KDevMainWindow *mainWindow() const = 0;
+
+ /**@return A reference to the part controller which is used to manipulate loaded KParts.*/
+ virtual KDevPartController *partController() const = 0;
+
+ /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/
+ virtual KDevPluginController *pluginController() const = 0;
+
+ /**@return A reference to the application core - an object which provides
+ basic functionalities for inter-parts communications / cooperation.*/
+ virtual KDevCore *core() const = 0;
+
+ /**@return A reference to the memory symbol store.*/
+ virtual CodeModel *codeModel() const = 0;
+
+ /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/
+ QDomDocument *projectDom() const;
+
+ /**Sets the Document Object Model for the current project.
+ @param dom The project DOM.*/
+ void setProjectDom(QDomDocument *dom);
+
+ /**@return A reference to the current project component or 0 if no project is loaded.*/
+ KDevProject *project() const;
+
+ /**Sets the current project.
+ @param project The project plugin which becames the current project.*/
+ void setProject(KDevProject *project);
+
+ /**@return A reference to the language support component or 0 if no support available.*/
+ KDevLanguageSupport *languageSupport() const;
+
+ /**Sets the object charged of providing handling for the source files written in particular
+ language (languages support component).
+ @param languageSupport The language support plugin.*/
+ void setLanguageSupport(KDevLanguageSupport *languageSupport);
+
+ /**@return A reference to the code repository (accessor to persistent symbol stores).*/
+ KDevCodeRepository *codeRepository() const;
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif
diff --git a/lib/interfaces/kdevcoderepository.cpp b/lib/interfaces/kdevcoderepository.cpp
new file mode 100644
index 00000000..81480940
--- /dev/null
+++ b/lib/interfaces/kdevcoderepository.cpp
@@ -0,0 +1,71 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevcoderepository.h"
+
+struct KDevCodeRepositoryData
+{
+ Catalog* mainCatalog;
+ QValueList<Catalog*> catalogs;
+
+ KDevCodeRepositoryData(): mainCatalog( 0 ) {}
+};
+
+KDevCodeRepository::KDevCodeRepository( )
+ : d( new KDevCodeRepositoryData )
+{
+}
+
+KDevCodeRepository::~KDevCodeRepository( )
+{
+ delete( d );
+}
+
+Catalog* KDevCodeRepository::mainCatalog()
+{
+ return d->mainCatalog;
+}
+
+void KDevCodeRepository::setMainCatalog( Catalog * mainCatalog )
+{
+ d->mainCatalog = mainCatalog;
+}
+
+void KDevCodeRepository::registerCatalog( Catalog * catalog )
+{
+ d->catalogs.append( catalog );
+ emit catalogRegistered( catalog );
+}
+
+void KDevCodeRepository::unregisterCatalog( Catalog * catalog )
+{
+ d->catalogs.remove( catalog );
+ emit catalogUnregistered( catalog );
+}
+
+void KDevCodeRepository::touchCatalog( Catalog * catalog )
+{
+ emit catalogChanged( catalog );
+}
+
+QValueList< Catalog * > KDevCodeRepository::registeredCatalogs( )
+{
+ return d->catalogs;
+}
+
+#include "kdevcoderepository.moc"
diff --git a/lib/interfaces/kdevcoderepository.h b/lib/interfaces/kdevcoderepository.h
new file mode 100644
index 00000000..9012c428
--- /dev/null
+++ b/lib/interfaces/kdevcoderepository.h
@@ -0,0 +1,94 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVCODEREPOSITORY_H
+#define KDEVCODEREPOSITORY_H
+
+#include <qobject.h>
+#include <qvaluelist.h>
+
+/**
+@file kdevcoderepository.h
+Code repository - the persistent symbol store accessor.
+*/
+
+class KDevCodeRepositoryData;
+class Catalog;
+
+/**
+Code repository - the persistent symbol store accessor.
+Symbols from parsed files can be saved to the persistent symbol store.
+Persistence in this case means that symbol database is never loaded into memory
+and works like a usual database which executes queries.
+
+Code repository consists from @ref Catalog objects that represent separate symbol
+databases. Catalogs can be created/loaded/unloaded dynamically.
+To find a symbol in the repository each catalog should be queried.
+
+Persistent symbol store is useful to keep information about code that
+never or rarely changes. System libraries are perfect examples of such code.
+Symbols from code contained in project files are better stored in memory
+symbol store like @ref CodeModel.
+*/
+class KDevCodeRepository : public QObject
+{
+ Q_OBJECT
+public:
+ /**Constructor.*/
+ KDevCodeRepository();
+ /**Destructor.*/
+ virtual ~KDevCodeRepository();
+
+ /**@return The main catalog. Each catalog can be marked is main
+ to provide easy access to it.*/
+ Catalog* mainCatalog();
+ /**Sets the main catalog.
+ @param mainCatalog The catalog to be marked as main.*/
+ void setMainCatalog( Catalog* mainCatalog );
+
+ /**@return The list of registered catalogs.*/
+ QValueList<Catalog*> registeredCatalogs();
+
+ /**Registers catalog in the repository.
+ @param catalog The catalog to register.*/
+ void registerCatalog( Catalog* catalog );
+ /**Unregisters catalog from the repository.
+ @param catalog The catalog to unregister.*/
+ void unregisterCatalog( Catalog* catalog );
+ /**Marks catalog as changed and emits @ref catalogChanged signal.
+ @param catalog The catalog to touch.*/
+ void touchCatalog( Catalog* catalog );
+
+signals:
+ /**Emitted when a new catalog is registered.
+ @param catalog The new catalog.*/
+ void catalogRegistered( Catalog* catalog );
+
+ /**Emitted when a catalog in removed
+ @param catalog The catalog that was removed.*/
+ void catalogUnregistered( Catalog* catalog );
+
+ /**Emitted when the contens of catalog is changed.
+ @param catalog Changed catalog.*/
+ void catalogChanged( Catalog* catalog );
+
+private:
+ KDevCodeRepositoryData* d;
+};
+
+#endif
diff --git a/lib/interfaces/kdevcore.cpp b/lib/interfaces/kdevcore.cpp
new file mode 100644
index 00000000..c10f9626
--- /dev/null
+++ b/lib/interfaces/kdevcore.cpp
@@ -0,0 +1,298 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "KDevCoreIface.h"
+#include "kdevcore.h"
+
+#include "urlutil.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// class Context
+///////////////////////////////////////////////////////////////////////////////
+
+Context::Context()
+{
+}
+
+Context::~Context()
+{
+}
+
+bool Context::hasType( int aType ) const
+{
+ return aType == this->type();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class EditorContext
+///////////////////////////////////////////////////////////////////////////////
+
+class EditorContext::Private
+{
+public:
+ Private( const KURL &url, int line, int col, const QString &linestr,
+ const QString &wordstr )
+ : m_url(url), m_line(line), m_col(col),
+ m_linestr(linestr), m_wordstr(wordstr)
+ {
+ }
+
+ KURL m_url;
+ int m_line, m_col;
+ QString m_linestr, m_wordstr;
+};
+
+EditorContext::EditorContext( const KURL &url, int line, int col,
+ const QString &linestr, const QString &wordstr )
+ : Context(), d( new Private(url, line, col, linestr, wordstr) )
+{
+}
+
+EditorContext::~EditorContext()
+{
+ delete d;
+ d = 0;
+}
+
+int EditorContext::type() const
+{
+ return Context::EditorContext;
+}
+
+const KURL &EditorContext::url() const
+{
+ return d->m_url;
+}
+
+int EditorContext::line() const
+{
+ return d->m_line;
+}
+
+int EditorContext::col() const
+{
+ return d->m_col;
+}
+
+QString EditorContext::currentLine() const
+{
+ return d->m_linestr;
+}
+
+QString EditorContext::currentWord() const
+{
+ return d->m_wordstr;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileContext
+///////////////////////////////////////////////////////////////////////////////
+
+class FileContext::Private
+{
+public:
+ Private( const KURL::List &someURLs ) : m_urls(someURLs)
+ {
+ if (m_urls.count() == 0)
+ {
+ m_fileName = "INVALID-FILENAME";
+ m_isDirectory = false; // well, "true" should be ok too ...
+ }
+ else
+ {
+ m_fileName = m_urls[0].path();
+ m_isDirectory = URLUtil::isDirectory( m_urls[0] );
+ }
+ }
+ Private( const QString &fileName, bool isDirectory )
+ : m_fileName(fileName), m_isDirectory(isDirectory)
+ {
+ }
+
+ KURL::List m_urls;
+ /// \FIXME the following data members should be removed, but first other
+ // parts should be modified to comply with this change.
+ QString m_fileName;
+ bool m_isDirectory;
+};
+
+FileContext::FileContext( const KURL::List &someURLs )
+ : Context(), d( new Private(someURLs) )
+{
+}
+
+FileContext::~FileContext()
+{
+ delete d;
+ d = 0;
+}
+
+int FileContext::type() const
+{
+ return Context::FileContext;
+}
+
+const KURL::List &FileContext::urls() const
+{
+ return d->m_urls;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class DocumentationContext
+///////////////////////////////////////////////////////////////////////////////
+
+class DocumentationContext::Private
+{
+public:
+ Private( const QString &url, const QString &selection )
+ : m_url(url), m_selection(selection)
+ {
+ }
+
+ QString m_url;
+ QString m_selection;
+};
+
+DocumentationContext::DocumentationContext( const QString &url, const QString &selection )
+ : Context(), d( new Private(url, selection) )
+{
+}
+
+DocumentationContext::DocumentationContext( const DocumentationContext &aContext )
+ : Context(), d( 0 )
+{
+ *this = aContext;
+}
+
+DocumentationContext &DocumentationContext::operator=( const DocumentationContext &aContext)
+{
+ if (d) {
+ delete d; d = 0;
+ }
+ d = new Private( *aContext.d );
+ return *this;
+}
+
+DocumentationContext::~DocumentationContext()
+{
+ delete d;
+ d = 0;
+}
+
+int DocumentationContext::type() const
+{
+ return Context::DocumentationContext;
+}
+
+QString DocumentationContext::url() const
+{
+ return d->m_url;
+}
+
+QString DocumentationContext::selection() const
+{
+ return d->m_selection;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class CodeModelItemContext
+///////////////////////////////////////////////////////////////////////////////
+
+class CodeModelItemContext::Private
+{
+public:
+ Private( const CodeModelItem* item ) : m_item( item ) {}
+
+ const CodeModelItem* m_item;
+};
+
+CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item )
+ : Context(), d( new Private(item) )
+{
+}
+
+CodeModelItemContext::~CodeModelItemContext()
+{
+ delete d;
+ d = 0;
+}
+
+int CodeModelItemContext::type() const
+{
+ return Context::CodeModelItemContext;
+}
+
+const CodeModelItem* CodeModelItemContext::item() const
+{
+ return d->m_item;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class ProjectModelItemContext
+///////////////////////////////////////////////////////////////////////////////
+
+class ProjectModelItemContext::Private
+{
+public:
+ Private( const ProjectModelItem* item ) : m_item( item ) {}
+
+ const ProjectModelItem* m_item;
+};
+
+ProjectModelItemContext::ProjectModelItemContext( const ProjectModelItem* item )
+ : Context(), d( new Private(item) )
+{
+}
+
+ProjectModelItemContext::~ProjectModelItemContext()
+{
+ delete d;
+ d = 0;
+}
+
+int ProjectModelItemContext::type() const
+{
+ return Context::ProjectModelItemContext;
+}
+
+const ProjectModelItem* ProjectModelItemContext::item() const
+{
+ return d->m_item;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// class KDevCore
+///////////////////////////////////////////////////////////////////////////////
+
+KDevCore::KDevCore( QObject *parent, const char *name )
+ : QObject( parent, name )
+{
+ new KDevCoreIface(this);
+}
+
+KDevCore::~KDevCore()
+{
+}
+
+#include "kdevcore.moc"
diff --git a/lib/interfaces/kdevcore.h b/lib/interfaces/kdevcore.h
new file mode 100644
index 00000000..cdc5ca87
--- /dev/null
+++ b/lib/interfaces/kdevcore.h
@@ -0,0 +1,387 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2001 Sandy Meier <smeier@kdevelop.org>
+ Copyright (C) 2002 Daniel Engelschalt <daniel.engelschalt@gmx.net>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2003 Harald Fernengel <harry@kdevelop.org>
+ Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVCORE_H
+#define KDEVCORE_H
+
+/**
+@file kdevcore.h
+The interface to the application core and context menu classes.
+*/
+
+#include <qstringlist.h>
+#include <qdict.h>
+#include <qobject.h>
+
+#include <kurl.h>
+
+class KDialogBase;
+class KDevPlugin;
+class CodeModelItem;
+class ProjectModelItem;
+
+namespace KParts
+{
+ class Part;
+}
+
+class QStatusBar;
+class QPopupMenu;
+
+/**
+Base class for every context.
+Think of a Context-based class as "useful
+info associated to a context menu". Several context menu can be defined,
+each defining different information: because of these context menus being
+used in many modules, they are defined here.
+
+When context menu with a certain "context" associated appears, KDevelop core
+sends a notification signal and all plugins which receive this signal have
+the ability to add own items into the menu. For example, VCS plugin could
+add "commit" and "update" menu items to the context menu of a file.
+
+<b>How to use context from a plugin:</b>
+-# Create a popup menu in context menu event handler: @code KPopupMenu menu(this); @endcode
+-# Create a context: @code MyContext context(param). @endcode
+-# Fill a context menu: @code core()->fillContextMenu(&menu, &context); @endcode
+-# Show the popup menu: @code menu.exec(event->globalPos()); @endcode
+.
+In this example @em event is an object of QContextMenuEvent class which you have access
+to if you reimplement QWidget::contextMenuEvent method.
+
+<b>How to fill context menu from a plugin:</b>
+-# Create a @code contextMenu(QPopupMenu *, const Context *) @endcode slot in your plugin class.
+-# Connect KDevCore::contextMenu(QPopupMenu *, const Context *) signal to that slot in
+the constructor of your plugin:\n
+@code
+connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)));
+@endcode
+-# Fill the menu in the slot you created, for example:\n
+@code
+if (context->hasType(Context::EditorContext))
+{
+ const EditorContext *econtext = static_cast<const EditorContext*>(context);
+ int id = popup->insertItem(i18n("My Menu Item 1"), this, SLOT(myMenuAction1()));
+ popup->setWhatsThis(id, i18n("What's this for my menu item 1"));
+}
+else if context->hasType(MyContext))
+{
+ int id = popup->insertItem(...
+ ...
+}
+...
+@endcode
+*/
+class Context
+{
+public:
+ /**Pre-defined context types. More may be added so it is possible to add custom
+ contexts. <strong>We reserve enum values until 1000 (yeah, it is one thousand )
+ for kdevelop official context types.</strong>*/
+ enum Type
+ {
+ EditorContext, /**<Editor context menu.*/
+ DocumentationContext, /**<Documentation browser context menu.*/
+ FileContext, /**<File context menu.*/
+ ProjectModelItemContext, /**<Project tree context menu.*/
+ CodeModelItemContext /**<Class tree context menu.*/
+ };
+
+ /**Implement this in the context so we can provide rtti.*/
+ virtual int type() const = 0;
+
+ /**@return The type of this Context, so clients can discriminate
+ between different file contexts.*/
+ virtual bool hasType(int type) const;
+
+protected:
+ /**Constructor.*/
+ Context();
+
+ /**Destructor.*/
+ virtual ~Context();
+};
+
+/**A context for the popup menu in the editor.*/
+class EditorContext: public Context
+{
+public:
+ /**Builds a context for an editor part.
+ @param url The url of a file in the editor.
+ @param line The line number where the cursor is.
+ @param col The column number where the cursor is.
+ @param linestr The content of the line where the cursor is.
+ @param wordstr The current word under the cursor.*/
+ EditorContext(const KURL &url, int line, int col,
+ const QString &linestr, const QString &wordstr);
+
+ /**Destructor.*/
+ virtual ~EditorContext();
+
+ virtual int type() const;
+
+ /**@return The url for the file which this context was invoked for.*/
+ const KURL &url() const;
+
+ /**@return The line number for the cursor position.*/
+ int line() const;
+
+ /**@return The column number for the cursor position.*/
+ int col() const;
+
+ /**@return A QString with the content of the line which this context was
+ invoked for.*/
+ QString currentLine() const;
+
+ /**@return A QString containing the word near to the cursor when this
+ context object was created.*/
+ QString currentWord() const;
+
+private:
+ class Private;
+ Private *d;
+
+ EditorContext( const EditorContext &);
+ EditorContext &operator=( const EditorContext &);
+};
+
+
+/**
+A context for the popup menu in the documentation browser widget.
+*/
+class DocumentationContext: public Context
+{
+public:
+
+ /**Builds a DocumentationContext.
+ @param url The URL that the context will be for.
+ @param selection Selected text.*/
+ DocumentationContext(const QString &url, const QString &selection );
+
+ /**Copy constructor.*/
+ DocumentationContext(const DocumentationContext &);
+ DocumentationContext &operator=(const DocumentationContext &);
+
+ /**Destructor.*/
+ virtual ~DocumentationContext();
+
+ virtual int type() const;
+
+ /**@return The url of the document this context was invoked for.*/
+ QString url() const;
+
+ /**@return The selected text in the document.*/
+ QString selection() const;
+
+private:
+ class Private;
+ Private *d;
+};
+
+/**
+A context for the popup menu in file views and other parts that show files.
+Context allows multiple selections of files.
+*/
+class FileContext : public Context
+{
+public:
+ /**Builds the file context using a @ref KURL::List
+ @param someURLs The list of selected files URLs.*/
+ FileContext(const KURL::List &someURLs);
+
+ /**Destructor.*/
+ virtual ~FileContext();
+
+ virtual int type() const;
+
+ /**@return A reference to the selected of URLs.*/
+ const KURL::List &urls() const;
+
+private:
+ class Private;
+ Private *d;
+
+ FileContext( const FileContext &);
+ FileContext &operator=( const FileContext &);
+};
+
+/**
+A context for the popup menu in class views.
+*/
+class CodeModelItemContext: public Context
+{
+public:
+ /**Builds the context.
+ @param item Selected code model item representation. Usually a symbol from the code
+ like class, function, etc.*/
+ CodeModelItemContext(const CodeModelItem* item);
+
+ /**Destructor.*/
+ virtual ~CodeModelItemContext();
+
+ virtual int type() const;
+
+ /**@return The code model item for the selected item.*/
+ const CodeModelItem* item() const;
+
+private:
+ class Private;
+ Private *d;
+
+ CodeModelItemContext( const CodeModelItemContext &);
+ CodeModelItemContext &operator=( const CodeModelItemContext &);
+};
+
+/**
+A context for the popup menu in project views.
+*/
+class ProjectModelItemContext : public Context
+{
+public:
+ /**Builds the context.
+ @param item The item to build the context from.*/
+ ProjectModelItemContext(const ProjectModelItem* item);
+
+ /**Destructor.*/
+ virtual ~ProjectModelItemContext();
+
+ virtual int type() const;
+
+ /**@return The code model item for the selected item.*/
+ const ProjectModelItem* item() const;
+
+private:
+ class Private;
+ Private *d;
+
+ ProjectModelItemContext( const ProjectModelItemContext &);
+ ProjectModelItemContext &operator=( const ProjectModelItemContext &);
+};
+
+
+
+
+/**
+A KDevCore class defines an object which takes care about the cooperation
+between the various plug-in which compose KDevelop.
+It defines:
+- signals that can be captured for menu customization;
+- notifications about opening / closing projects;
+- methods to access functionality of KDevelop core;
+- requests to fill project and global settings widgets;
+- etc.
+.
+*/
+class KDevCore: public QObject
+{
+ Q_OBJECT
+public:
+ /**Constructor
+ @param parent The QObject that's the parent of this class.
+ @param name The name of the class.*/
+ KDevCore(QObject *parent=0, const char *name=0);
+
+ /**Destructor.*/
+ virtual ~KDevCore();
+
+ /**Fills the context menu.
+ This method should be called by a part that wants to show a
+ context menu. The parameter @p context should be filled with
+ information about the context in which this happens (see
+ EditorContext, DocumentationContext, ClassContext, ...).
+ Essentially, this method emits the signal contextMenu()
+ which other parts can use to hook in.
+ @sa Context for a detailed explanation of context menu initializations and usage.
+ @param popup The popup menu to fill.
+ @param context The pointer to a Context object of this popup menu.*/
+ virtual void fillContextMenu(QPopupMenu *popup, const Context *context) = 0;
+
+ /**Closes the current project and open the new one. You cannot use the @ref KDevPlugin::project()
+ * method right after opening a new project, as it will return a null pointer.
+ *You must wait for the eventloop to be reentered, so use a signleshot timer
+ *to do the job needed after the project is opened or connect a slot to the
+ *@ref projectOpened signal.
+ * @param projectFileName The file name of the project to open.*/
+ virtual void openProject(const QString& projectFileName) = 0;
+
+ /**Marks the component as running (or not running). As long as at least one
+ component is running, the stop button is enabled. When it is pressed,
+ component get a stopButtonClicked(). This is usable for plugins which
+ run certain commands and want KDevelop core to be notified of that.
+ If core is notified, it can allow the user to stop(interrupt) the command
+ manually by means of stop button.
+ @param which The plugin to mark.
+ @param runs true if plugin is running something, false if it is not.*/
+ virtual void running(KDevPlugin *which, bool runs) = 0;
+
+signals:
+ /**Emitted after the core has done all initializations and
+ the main window has been shown.*/
+ void coreInitialized();
+
+ /**A project has been opened.*/
+ void projectOpened();
+
+ /**The project is about to be closed.*/
+ void projectClosed();
+
+ /**The language support part has been changed.*/
+ void languageChanged();
+
+ /**The user has clicked the stop button.
+ If all actions should be cancelled, pass 0 to @p which
+ @param which The KDevPlugin object to stop.*/
+ void stopButtonClicked(KDevPlugin *which);
+
+ /**A context menu has been requested somewhere. Components
+ may hook some entries into it. More information on the
+ context can be obtained by looking for the type of
+ @p context and casting it accordingly.
+ @sa Context for a detailed explanation of context menu initializations and usage.
+ @param popupMenu The popup menu to fill.
+ @param context The Context of this popup menu.*/
+ void contextMenu(QPopupMenu *popupMenu, const Context *context);
+
+ /**Expects that a configuration page for use in the
+ KDevelop settings dialog is created by the component.
+ The configuration page is not demand-loading, it will be created before
+ global settings dialog is shown. Use @ref ConfigWidgetProxy in your plugin
+ to create demand-loading configuration pages.
+ @param dlg The dialog which the configuration widget should be added to.*/
+ void configWidget(KDialogBase *dlg);
+
+ /**Expects that a configuration page for use in the
+ Project settings dialog is created by the component.
+ The configuration page is not demand-loading, it will be created before
+ project settings dialog is shown. Use @ref ConfigWidgetProxy in your plugin
+ to create demand-loading configuration pages.
+ @param dlg The dialog which the configuration widget should be added to.*/
+ void projectConfigWidget(KDialogBase *dlg);
+};
+
+#endif
diff --git a/lib/interfaces/kdevdesignerintegration.cpp b/lib/interfaces/kdevdesignerintegration.cpp
new file mode 100644
index 00000000..60dbd61b
--- /dev/null
+++ b/lib/interfaces/kdevdesignerintegration.cpp
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevdesignerintegration.h"
+#include "kdevdesignerintegrationiface.h"
+
+class KDevDesignerIntegration::KDevDesignerIntegrationPrivate {
+public:
+ KDevDesignerIntegrationIface *m_iface;
+};
+
+KDevDesignerIntegration::KDevDesignerIntegration(QObject *parent, const char *name)
+ : QObject(parent, name)
+{
+ dptr = new KDevDesignerIntegrationPrivate();
+
+ dptr->m_iface = new KDevDesignerIntegrationIface(this);
+}
+
+KDevDesignerIntegration::~KDevDesignerIntegration()
+{
+ delete dptr;
+}
+
+#include "kdevdesignerintegration.moc"
diff --git a/lib/interfaces/kdevdesignerintegration.h b/lib/interfaces/kdevdesignerintegration.h
new file mode 100644
index 00000000..7e2c7fc5
--- /dev/null
+++ b/lib/interfaces/kdevdesignerintegration.h
@@ -0,0 +1,97 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVDESIGNERINTEGRATION_H
+#define KDEVDESIGNERINTEGRATION_H
+
+#include <designer.h>
+#include <qobject.h>
+#include <qdom.h>
+
+/**
+@file kdevdesignerintegration.h
+KDevelop designer integration interface.
+*/
+
+/**
+KDevelop designer integration interface.
+Designer integration object provides functionality which is used by integrated
+into KDevelop GUI designers:
+- adding/removing/editing functions (class methods);
+- opening form implementation files;
+- saving and loading designer integration settings.
+.
+
+Designer integration is a layer between visual form (GUI) designer of any type
+and the current language support. Usually designers create some kind of forms
+and allow developers to define actions which are executed upon some GUI events
+(for example, Qt Designer allows to define slots connected to GUI signals).
+The actual code with action implementations needs to be written by hand in source
+files. Designer integration captures such implementation requests and opens
+necessary files at desired line numbers and adds (edits, removes) code for implementations.
+
+For example, Qt Designer integration should be able to create an subclass for a form
+and reimplement slots defined in the form.
+*/
+class KDevDesignerIntegration : public QObject
+{
+Q_OBJECT
+public:
+ /**Constructor.
+ @param parent Parent object.
+ @param name Internal name.*/
+ KDevDesignerIntegration(QObject *parent = 0, const char *name = 0);
+ /**Destructor.*/
+ ~KDevDesignerIntegration();
+
+ /**Saves designer integration settings.*/
+ virtual void saveSettings(QDomDocument dom, QString path) = 0;
+ /**Loads designer integration settings.*/
+ virtual void loadSettings(QDomDocument dom, QString path) = 0;
+
+public slots:
+ /**Adds the implementation for a function.
+ @param formName The name of a GUI form.
+ @param function The function which needs to be implemented in the source.*/
+ virtual void addFunction(const QString &formName, KInterfaceDesigner::Function function) = 0;
+
+ /**Removes the implementation of a function.
+ @param formName The name of a GUI form.
+ @param function The function which needs to be removed from the source.*/
+ virtual void removeFunction(const QString &formName, KInterfaceDesigner::Function function) = 0;
+
+ /**Edites the implementation of a function.
+ @param formName The name of a GUI form.
+ @param oldFunction The function which needs to be edited from the source.
+ @param function The new function declaration.*/
+ virtual void editFunction(const QString &formName, KInterfaceDesigner::Function oldFunction, KInterfaceDesigner::Function function) = 0;
+
+ /**Opens the function and jumps to the line number of its definition (declaration).
+ @param formName The name of a GUI form.
+ @param functionName The name of a function to find in the source.*/
+ virtual void openFunction(const QString &formName, const QString &functionName) = 0;
+
+ /**Opens the form source.
+ @param formName The name of a GUI form.*/
+ virtual void openSource(const QString &formName) = 0;
+ private:
+ class KDevDesignerIntegrationPrivate;
+ KDevDesignerIntegrationPrivate *dptr;
+};
+
+#endif
diff --git a/lib/interfaces/kdevdesignerintegrationiface.cpp b/lib/interfaces/kdevdesignerintegrationiface.cpp
new file mode 100644
index 00000000..459e3ee9
--- /dev/null
+++ b/lib/interfaces/kdevdesignerintegrationiface.cpp
@@ -0,0 +1,63 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Ian Reinhart Geiser <geiseri@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevdesignerintegrationiface.h"
+#include <designer.h>
+#include "kdevdesignerintegration.h"
+
+KDevDesignerIntegrationIface::KDevDesignerIntegrationIface(KDevDesignerIntegration *p)
+ : DCOPObject("GUIDesigner"), m_designer(p)
+{
+ //FIXME figure out what number our interface is...
+}
+
+
+KDevDesignerIntegrationIface::~KDevDesignerIntegrationIface()
+{
+}
+
+void KDevDesignerIntegrationIface::addFunction( const QString & formName, QString returnType, QString function, QString specifier, QString access, uint type )
+{
+ KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type };
+ m_designer->addFunction(formName, f);
+}
+
+void KDevDesignerIntegrationIface::removeFunction( const QString & formName, QString returnType, QString function, QString specifier, QString access, uint type )
+{
+ KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type };
+ m_designer->addFunction(formName, f);
+}
+
+void KDevDesignerIntegrationIface::editFunction( const QString & formName, QString oldReturnType, QString oldFunction, QString oldSpecifier, QString oldAccess, uint oldType, QString returnType, QString function, QString specifier, QString access, uint type )
+{
+ KInterfaceDesigner::Function fold = {oldReturnType, oldFunction, oldSpecifier, oldAccess, (KInterfaceDesigner::FunctionType)oldType };
+ KInterfaceDesigner::Function fnew = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type };
+ m_designer->editFunction(formName,fold,fnew);
+}
+
+void KDevDesignerIntegrationIface::openFunction( const QString & formName, const QString & functionName )
+{
+ m_designer->openFunction(formName,functionName);
+}
+
+void KDevDesignerIntegrationIface::openSource( const QString & formName )
+{
+ m_designer->openSource(formName);
+}
+
+
diff --git a/lib/interfaces/kdevdesignerintegrationiface.h b/lib/interfaces/kdevdesignerintegrationiface.h
new file mode 100644
index 00000000..38993f8f
--- /dev/null
+++ b/lib/interfaces/kdevdesignerintegrationiface.h
@@ -0,0 +1,49 @@
+/* I am drunk.
+ Copyright (C) 2005 Ian Reinhart Geiser <geiseri@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVDESIGNERINTEGRATIONIFACE_H
+#define KDEVDESIGNERINTEGRATIONIFACE_H
+
+#include <dcopobject.h>
+class KDevDesignerIntegration;
+/**
+The dcop interface for GUI designers in KDevelop.
+
+@author KDevelop Authors
+*/
+class KDevDesignerIntegrationIface : public DCOPObject
+{
+ K_DCOP
+public:
+ KDevDesignerIntegrationIface(KDevDesignerIntegration *p);
+
+ ~KDevDesignerIntegrationIface();
+k_dcop:
+ void addFunction(const QString &formName, QString returnType, QString function,QString specifier,QString access,uint type);
+ void removeFunction(const QString &formName, QString returnType, QString function,QString specifier,QString access,uint type);
+ void editFunction(const QString &formName, QString oldReturnType, QString oldFunction,
+ QString oldSpecifier,QString oldAccess,uint oldType,
+ QString returnType, QString function,QString specifier,QString access,uint type);
+ void openFunction(const QString &formName, const QString &functionName);
+ void openSource(const QString &formName);
+
+ private:
+ KDevDesignerIntegration *m_designer;
+};
+
+#endif
diff --git a/lib/interfaces/kdeveloplanguagesupport.desktop b/lib/interfaces/kdeveloplanguagesupport.desktop
new file mode 100644
index 00000000..217bfc44
--- /dev/null
+++ b/lib/interfaces/kdeveloplanguagesupport.desktop
@@ -0,0 +1,41 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/LanguageSupport
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Language Support Interface
+Name[ca]=Interfície del suport de llenguatges per a KDevelop
+Name[da]=KDevelop grænseflade for sprogunderstøttelse
+Name[de]=Schnittstelle für Sprachunterstützung (KDevelop)
+Name[el]=Διασύνδεση υποστήριξης γλώσσας KDevelop
+Name[es]=Interfaz del soporte de lenguajes de KDevelop
+Name[et]=KDevelopi keeletoetuse liides
+Name[eu]=KDevelop-en lengoaien euskarrien interfazea
+Name[fa]=واسط پشتیبانی زبان KDevelop
+Name[fr]=Interface de prise en charge de langage de KDevelop
+Name[gl]=Interface de soporte de linguaxes de KDevelop
+Name[hi]=के-डेवलप भाषा समर्थन इंटरफ़ेस
+Name[hu]=KDevelop nyelvtámogatási felület
+Name[it]=Interfaccia KDevelop per il supporto di linguaggio
+Name[ja]=KDevelop 言語サポート インターフェース
+Name[nds]=KDevelop-Koppelsteed för Spraakünnerstütten
+Name[ne]=केडीई विकास भाषा समर्थन इन्टरफेस
+Name[nl]=KDevelop Interface voor taalondersteuning
+Name[pl]=Interfejs KDevelopa do obsługi języków
+Name[pt]=Interface de Suporte a Linguagens do KDevelop
+Name[pt_BR]=Interface de Suporte à Linguagem do KDevelop
+Name[ru]=Интерфейс языковой поддержки
+Name[sk]=KDevelop rozhranie pre podporu jazykov
+Name[sl]=Vmesnik jezikovne podpore za KDevelop
+Name[sr]=KDevelop-ов интерфејс за језичку подршку
+Name[sr@Latn]=KDevelop-ov interfejs za jezičku podršku
+Name[sv]=KDevelop gränssnitt för språkstöd
+Name[ta]=KDevelop மொழி ஆதரவான இடைவிளிம்பு
+Name[tg]=Интерфейс ёрӣ расони забонӣ
+Name[tr]=KDevelop Dil Desteği Arayüzü
+Name[zh_CN]=KDevelop 语言支持接口
+Name[zh_TW]=KDevelop 語言支援介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
diff --git a/lib/interfaces/kdevelopplugin.desktop b/lib/interfaces/kdevelopplugin.desktop
new file mode 100644
index 00000000..c1a9998c
--- /dev/null
+++ b/lib/interfaces/kdevelopplugin.desktop
@@ -0,0 +1,75 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/Plugin
+Name=KDevelop Plugin
+Name[br]=Lugent KDevelop
+Name[ca]=Connector per a KDevelop
+Name[da]=KDevelop plugin
+Name[de]=KDevelop-Modul
+Name[el]=Πρόσθετο KDevelop
+Name[es]=Complemento para KDevelop
+Name[et]=KDevelopi plugin
+Name[eu]=KDevelop plugin-a
+Name[fa]=وصلۀ KDevelop
+Name[fr]=Module externe de KDevelop
+Name[ga]=Breiseán KDevelop
+Name[gl]=Extensión para KDevelop
+Name[hi]=के-डेवलप प्लगइन
+Name[hu]=KDevelop-bővítőmodul
+Name[it]=Plugin di KDevelop
+Name[ja]=KDevelop プラグイン
+Name[nds]=KDevelop-Moduul
+Name[ne]=केडीई विकास प्लगइन
+Name[pl]=Wtyczka do KDevelopa
+Name[pt]='Plugin' do KDevelop
+Name[pt_BR]=Plug-in do KDevelop
+Name[ru]=Модуль KDevelop
+Name[sk]=KDevelop modul
+Name[sl]=Vstavek za KDevelop
+Name[sr]=Прикључак за KDevelop
+Name[sr@Latn]=Priključak za KDevelop
+Name[sv]=KDevelop insticksmodul
+Name[ta]=KDevelop சொருகு
+Name[tg]=Модули KDevelop
+Name[tr]=KDevelop Eklentisi
+Name[zh_CN]=KDevelop 插件
+Name[zh_TW]=KDevelop 外掛程式
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
+
+[PropertyDef::X-KDevelop-Scope]
+Type=QString
+
+[PropertyDef::X-KDevelop-Mode]
+Type=QString
+
+[PropertyDef::X-KDevelop-Plugin-Version]
+Type=QString
+
+[PropertyDef::X-KDevelop-Plugin-Homepage]
+Type=QString
+
+[PropertyDef::X-KDevelop-Plugin-License]
+Type=QString
+
+[PropertyDef::X-KDevelop-Plugin-BugsEmailAddress]
+Type=QString
+
+[PropertyDef::X-KDevelop-Plugin-Copyright]
+Type=QString
+
+# defines a list of properties which the plugin has
+# a profile will query all plugins for properties and will load only
+# those that have queried properties
+[PropertyDef::X-KDevelop-Properties]
+Type=QStringList
+
+# only important for project plugins, you can add a list of programming languages which are supported
+# the plugin will be loaded by default, if the project use this language
+[PropertyDef::X-KDevelop-ProgrammingLanguages]
+Type=QStringList
+
+[PropertyDef::X-KDevelop-Args]
+Type=QString
diff --git a/lib/interfaces/kdevelopproject.desktop b/lib/interfaces/kdevelopproject.desktop
new file mode 100644
index 00000000..e8cad380
--- /dev/null
+++ b/lib/interfaces/kdevelopproject.desktop
@@ -0,0 +1,40 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/Project
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Project Interface
+Name[ca]=Interfície de projecte per a KDevelop
+Name[da]=KDevelop projektgrænseflade
+Name[de]=Projekt-Schnittstelle (KDevelop)
+Name[el]=Διασύνδεση έργου KDevelop
+Name[es]=Interfaz de proyecto de KDevelop
+Name[et]=KDevelopi projektiliides
+Name[eu]=KDevelop-en proiektu interfazea
+Name[fa]=واسط پروژۀ KDevelop
+Name[fr]=Interface de projet de KDevelop
+Name[gl]=Interface de proxecto KDevelop
+Name[hi]=के-डेवलप परियोजना इंटरफ़ेस
+Name[hu]=KDevelop projektkezelő felület
+Name[it]=Interfaccia KDevelop di progetto
+Name[ja]=KDevelop プロジェクト インターフェース
+Name[nds]=KDevelop-Projektkoppelsteed
+Name[ne]=केडीई विकास परियोजना इन्टरफेस
+Name[nl]=KDevelop Projectinterface
+Name[pl]=Interfejs KDevelopa do projektu
+Name[pt]=Interface de Projecto do KDevelop
+Name[pt_BR]=Interface de Projeto do KDevelop
+Name[ru]=Интерфейс проекта
+Name[sk]=KDevelop rozhranie pre projekt
+Name[sl]=Projektni vmesnik v KDevelopu
+Name[sr]=KDevelop-ов интерфејс пројекта
+Name[sr@Latn]=KDevelop-ov interfejs projekta
+Name[sv]=KDevelop projektgränssnitt
+Name[ta]=KDevelop திட்ட இடைஇணைப்பு
+Name[tg]=Лоиҳаи интерфейс
+Name[tr]=KDevelop Proje Arayüzü
+Name[zh_CN]=KDevelop 工程接口
+Name[zh_TW]=KDevelop 專案介面
+
+# versioning - prevent DLL hell
+[PropertyDef::X-KDevelop-Version]
+Type=int
diff --git a/lib/interfaces/kdevgenericfactory.h b/lib/interfaces/kdevgenericfactory.h
new file mode 100644
index 00000000..581aa36a
--- /dev/null
+++ b/lib/interfaces/kdevgenericfactory.h
@@ -0,0 +1,91 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2003 Harald Fernengel <harry@kdevelop.org>
+ * Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+
+/**
+@file kdevgenericfactory.h
+KDevelop generic plugin factory.
+*/
+
+/**
+This class provides a generic implementation of a KLibFactory for
+use with KDevelop plugins.
+Usually it is convenient to use K_EXPORT_COMPONENT_FACTORY macro
+to create factories for KDevelop plugins. For example, for DummyPlugin
+the factory can be created (in dummyplugin.cpp file) as:
+@code
+typedef KDevGenericFactory<DummyPlugin> DummyPluginFactory;
+K_EXPORT_COMPONENT_FACTORY(libkdevdummyplugin, DummyPluginFactory( data ) )
+@endcode
+Data should be a const static object. This way it complies with the requirements
+for data objecs of KDevGenericFactory constructor.
+
+<b>Important:</b><br>
+There is no need to create @ref KAboutData objects. It is more useful to create
+a static const @ref KDevPluginInfo object which can be used also in the constructor
+of a plugin.
+
+For example, dummyplugin.cpp file could contain:
+@code
+#include <kdevplugininfo.h>
+
+static const KDevPluginInfo data("KDevDummyPlugin");
+typedef KDevGenericFactory<DummyPlugin> DummyPluginFactory;
+K_EXPORT_COMPONENT_FACTORY(libkdevdummyplugin, DummyPluginFactory( data ) )
+
+DummyPlugin::DummyPlugin(QObject *parent, const char *name, const QStringList & )
+ :KDevPlugin(&data, parent, name)
+{
+}
+@endcode
+
+In the example above the duplication of information is avoided as same @ref KDevPluginInfo
+objects are used for plugin and for plugin factory. This is possible because @ref KDevPluginInfo
+class has an operator to cast @ref KDevPluginInfo to @ref KAboutData.
+*/
+template <class T, class ParentType = QObject>
+class KDevGenericFactory: public KGenericFactory<T, ParentType>
+{
+public:
+ /**Constructor.
+ @param data A reference to KAboutData with an information about the plugin.
+ Data should have:
+ - plugin name as an application name;
+ - untranslated plugin generic name as a product name;
+ - license type number.
+ .
+ data object should live as long as factory lives.*/
+ KDevGenericFactory(KAboutData *data)
+ :KGenericFactory<T, ParentType>(data->appName()), aboutData(data)
+ {
+ }
+
+ /**Creates an instance.*/
+ KInstance *createInstance()
+ {
+ return new KInstance(aboutData);
+ }
+
+private:
+ KAboutData *aboutData;
+
+};
+
diff --git a/lib/interfaces/kdevlanguagesupport.cpp b/lib/interfaces/kdevlanguagesupport.cpp
new file mode 100644
index 00000000..3a0b7c9e
--- /dev/null
+++ b/lib/interfaces/kdevlanguagesupport.cpp
@@ -0,0 +1,166 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Alexander Dymo <adymo@kdevelop.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "codemodel.h"
+
+#include <kdebug.h>
+
+#include "kdevdesignerintegration.h"
+#include "kdevlanguagesupport.h"
+
+KDevLanguageSupport::KDevLanguageSupport(const KDevPluginInfo *info, QObject *parent, const char *name)
+ : KDevPlugin(info, parent, name ? name : "KDevLanguageSupport" )
+{
+}
+
+KDevLanguageSupport::~KDevLanguageSupport()
+{
+}
+
+KDevLanguageSupport::Features KDevLanguageSupport::features()
+{
+ return Features(0);
+}
+
+KMimeType::List KDevLanguageSupport::mimeTypes()
+{
+ return KMimeType::List();
+}
+
+QString KDevLanguageSupport::formatTag( const Tag& /*tag*/ )
+{
+ return QString::null;
+}
+
+QString KDevLanguageSupport::formatClassName(const QString &name)
+{
+ return name;
+}
+
+QString KDevLanguageSupport::unformatClassName(const QString &name)
+{
+ return name;
+}
+
+bool KDevLanguageSupport::shouldSplitDocument(const KURL &url)
+{
+ return false;
+}
+
+Qt::Orientation KDevLanguageSupport::splitOrientation() const
+{
+ return Qt::Vertical;
+}
+
+void KDevLanguageSupport::addClass()
+{
+}
+
+void KDevLanguageSupport::addMethod( ClassDom /*klass*/ )
+{
+}
+
+void KDevLanguageSupport::implementVirtualMethods( ClassDom /*klass*/ )
+{
+}
+
+void KDevLanguageSupport::addAttribute( ClassDom /*klass*/ )
+{
+}
+
+QStringList KDevLanguageSupport::subclassWidget(const QString& /*formName*/)
+{
+ return QStringList();
+}
+
+QStringList KDevLanguageSupport::updateWidget(const QString& /*formName*/, const QString& /*fileName*/)
+{
+ return QStringList();
+}
+
+QString KDevLanguageSupport::formatModelItem( const CodeModelItem *item, bool /*shortDescription*/ )
+{
+ return item->name();
+}
+
+void KDevLanguageSupport::addFunction( DesignerType type, const QString & formName, Function function )
+{
+// kdDebug() << "KDevLanguageSupport::addFunction: 1" << endl;
+ KDevDesignerIntegration *designerIntegration = designer(type);
+// kdDebug() << "KDevLanguageSupport::addFunction: 2" << endl;
+ if (!designerIntegration)
+ {
+// kdDebug() << "KDevLanguageSupport::addFunction: x" << endl;
+ return;
+ }
+// kdDebug() << "KDevLanguageSupport::addFunction: 3" << endl;
+ designerIntegration->addFunction(formName, function);
+// kdDebug() << "KDevLanguageSupport::addFunction: 4" << endl;
+}
+
+void KDevLanguageSupport::editFunction( DesignerType type, const QString & formName, Function oldFunction, Function function )
+{
+ KDevDesignerIntegration *designerIntegration = designer(type);
+ if (!designerIntegration)
+ return;
+ designerIntegration->editFunction(formName, oldFunction, function);
+}
+
+void KDevLanguageSupport::removeFunction( DesignerType type, const QString & formName, Function function )
+{
+ KDevDesignerIntegration *designerIntegration = designer(type);
+ if (!designerIntegration)
+ return;
+ designerIntegration->removeFunction(formName, function);
+}
+
+KDevDesignerIntegration * KDevLanguageSupport::designer( DesignerType // type
+ )
+{
+ return 0;
+}
+
+void KDevLanguageSupport::openFunction( DesignerType type, const QString & formName, const QString & functionName )
+{
+ KDevDesignerIntegration *designerIntegration = designer(type);
+ if (!designerIntegration)
+ return;
+ designerIntegration->openFunction(formName, functionName);
+}
+
+void KDevLanguageSupport::createAccessMethods( ClassDom // theClass
+ , VariableDom // theVariable
+ )
+{
+}
+
+void KDevLanguageSupport::openSource( DesignerType type, const QString & formName)
+{
+ KDevDesignerIntegration *designerIntegration = designer(type);
+ if (!designerIntegration)
+ return;
+ designerIntegration->openSource(formName);
+}
+
+#include "kdevlanguagesupport.moc"
diff --git a/lib/interfaces/kdevlanguagesupport.h b/lib/interfaces/kdevlanguagesupport.h
new file mode 100644
index 00000000..06be2f26
--- /dev/null
+++ b/lib/interfaces/kdevlanguagesupport.h
@@ -0,0 +1,260 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVLANGUAGESUPPORT_H
+#define KDEVLANGUAGESUPPORT_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <kmimetype.h>
+#include "kdevplugin.h"
+#include "codemodel.h"
+#include <designer.h>
+
+/**
+@file kdevlanguagesupport.h
+Interface to programming language specific features.
+*/
+
+class Tag;
+class KDevDesignerIntegration;
+
+using namespace KInterfaceDesigner;
+
+/**
+KDevelop language support interface - the base class for all programming language support plugins.
+Language support is used to load facilities specific to certain programming language.
+Language supports are usually loaded among with a project. In this case project file defines
+which language support to load.
+
+Language support plugin is a good place for:
+- a language parser which fills memory and persistent symbol store
+(see @ref CodeModel and @ref KDevCodeRepository);
+- code wizards specific to a programming language (like new class wizard);
+- GUI designer integration (see @ref KDevLanguageSupport::designer method
+documentation and @ref KDevDesignerIntegration class documentation;
+- symbol (class, function, etc.) name formatting to a human-readable convention (pretty
+formatted name).
+.
+*/
+class KDevLanguageSupport: public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ /**Features supported by this language support.*/
+ enum Features {
+ /*features of the language itself*/
+ Classes=1 /**<Language has classes (or class-like packages).*/,
+ Structs=2 /**<Language has structures or records.*/,
+ Functions=4 /**<Language has functions.*/,
+ Variables=8 /**<Language has variables.*/,
+
+ Namespaces=16 /**<Language has namespaces.*/,
+ Signals=32 /**<Language has signals (or qt library bindings are available).*/,
+ Slots=64 /**<Language has slots (or qt library bindings are available).*/,
+ Declarations=128 /**<Language has function declarations (like c, c++ and pascal).*/,
+
+ /*features of the language support part*/
+ NewClass=512 /**<Language support can create classes.*/,
+ AddMethod=1024 /**<Language support can create methods.*/,
+ AddAttribute=2048 /**<Language support can create class attributes.*/,
+ CreateAccessMethods=4096 /**<Language support can create get/set methods for attributes.*/
+ };
+
+ /**Constructs a language support plugin.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevLanguageSupport(const KDevPluginInfo *info, QObject *parent, const char *name);
+ /**Destructor.*/
+ ~KDevLanguageSupport();
+
+ /**@return The feature set of the language. This is e.g. used
+ by the class view to decide which organizer items to display and which not.*/
+ virtual Features features();
+
+ /**@return A typical mimetype list for the support language, this list
+ should be configurable in the languagesupport dialog.*/
+ virtual KMimeType::List mimeTypes();
+
+ /**Formats a Tag as used by the persistent symbol store to the human-readable convention.
+ @param tag Tag to format.*/
+ virtual QString formatTag(const Tag& tag);
+
+ /**Formats a CodeModelItem as used by the CodeModel to the human-readable convention.
+ @param item Symbol to format.
+ @param shortDescription Show short description of a symbol. For example, when
+ formatting functions short description could be a function signature without
+ the return type and argument default values.*/
+ virtual QString formatModelItem(const CodeModelItem *item, bool shortDescription=false);
+
+ /**Formats a canonicalized class path as used by the symbol store to the
+ human-readable convention. For example, the C++ support part formats the
+ string "KParts.Part" into "KParts::Part".
+ @param name Class name.*/
+ virtual QString formatClassName(const QString &name);
+
+ /**The opposite of @ref formatClassName. Reverts formatting.
+ @param name Class name.*/
+ virtual QString unformatClassName(const QString &name);
+
+ /**Determines whether the document should be opened in a split view. The
+ language part can determine this internally and then set the active document
+ and if so, set the active document so that the newly opened one will be split
+ with it.
+ @param name URL of the document in question.*/
+ virtual bool shouldSplitDocument( const KURL &url );
+
+ /**Returns the language parts Split View orientation.
+ By default Qt::Vertical.*/
+ virtual Qt::Orientation splitOrientation() const;
+
+ /**Opens a "New class" dialog and adds the configured class to the sources.
+ Define NewClass feature if you reimplement this method.*/
+ virtual void addClass();
+
+ /**Opens an "Add method" dialog and adds the configured method to the sources.
+ Define AddMethod feature if you reimplement this method.
+ @param klass The class DOM to add a method to.*/
+ virtual void addMethod(ClassDom klass);
+
+ /**Opens an "Implement Virtual Methods" dialog and adds the configured methods
+ to the sources. Define AddMethod feature if you reimplement this method.
+ @param klass The class DOM to add a virtual method to.*/
+ virtual void implementVirtualMethods(ClassDom klass);
+
+ /**Opens an "Add attribute" dialog and adds the configured attribute to the sources.
+ Define AddAttribute feature if you reimplement this method.
+ @param klass The class DOM to add an attribute to.*/
+ virtual void addAttribute(ClassDom klass);
+
+ /**
+ * Opens an "create get/set methods" dialog and adds the configured methods to the sources.
+ * Define CreateAccessMethods feature if you reimplement this method.
+ * @param theClass The class the methods should be added to.
+ * @param theVariable The attribute the access methods should be generated for.
+ */
+ virtual void createAccessMethods(ClassDom theClass, VariableDom theVariable);
+
+ /**Opens an "Subclass Widget" dialog for given Qt .ui file (formName)
+ and propmts to implement it's slots.
+ @param formName The name of a form to subclass.
+ @return A list of newly created files.*/
+ virtual QStringList subclassWidget(const QString& formName);
+
+ /**Opens an "Update Widget" dialog for given Qt .ui file (formName)
+ and prompts to add missing slot implementations
+ in the subclass located in fileName.
+ @param formName The name of a form which is being subclassed.
+ @param fileName The name of a file with a subclass.
+ @return A list of updated files. Can be empty because usually no additional
+ actions are required on updated files.*/
+ virtual QStringList updateWidget(const QString& formName, const QString& fileName);
+
+ /**Reimplement this method if you want to use integrated GUI designer for the language.
+ Implementation could look like (in pseudo code):
+ @code
+ KDevDesignerIntegration *des = 0;
+ switch (type)
+ {
+ case KInterfaceDesigner::QtDesigner:
+ des = getDesignerFromCache(type);
+ if (des == 0)
+ {
+ MyLanguageImplementationWidget *impl = new MyLanguageImplementationWidget(this);
+ des = new QtDesignerMyLanguageIntegration(this, impl);
+ des->loadSettings(*project()->projectDom(), "kdevmylangsupport/designerintegration");
+ saveDesignerToCache(type, des);
+ }
+ break;
+ }
+ return des;
+ @endcode
+ @ref ImplementationWidget and @ref QtDesignerIntegration classes are available
+ from designerintegration support library.
+ @param type The type of the designer to integrate.
+ @return The pointer to designer integration of given type or 0.*/
+ virtual KDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type);
+
+public slots:
+ /**Adds a function requested by a GUI designer. No need to reimplement this slot
+ unless you want to use specific implementation of KDevDesignerIntegration interface.
+ @param type The type of integrated designer.
+ @param formName The name of a GUI form.
+ @param function The function to implement (add).*/
+ void addFunction(DesignerType type, const QString &formName, Function function);
+
+ /**Removes a function requested by a GUI designer. No need to reimplement this slot
+ unless you want to use specific implementation of KDevDesignerIntegration interface.
+ @param type The type of integrated designer.
+ @param formName The name of a GUI form.
+ @param function The function to remove.*/
+ void removeFunction(DesignerType type, const QString &formName, Function function);
+
+ /**Edits a function requested by a GUI designer. No need to reimplement this slot
+ unless you want to use specific implementation of KDevDesignerIntegration interface.
+ @param type The type of integrated designer.
+ @param formName The name of a GUI form.
+ @param oldFunction The old function signature before editing.
+ @param function The new function signature after editing.*/
+ void editFunction(DesignerType type, const QString &formName, Function oldFunction, Function function);
+
+ /**Opens a function requested by a GUI designer. No need to reimplement this slot
+ unless you want to use specific implementation of KDevDesignerIntegration interface.
+ @param type The type of integrated designer.
+ @param formName The name of a GUI form.
+ @param functionName The name of a function to seek in the code for.*/
+ void openFunction(DesignerType type, const QString &formName, const QString &functionName);
+
+ /**Opens a form source requested by a GUI designer. No need to reimplement this slot
+ unless you want to use specific implementation of KDevDesignerIntegration interface.
+ @param type The type of integrated designer.
+ @param formName The name of a GUI form.*/
+ void openSource(DesignerType type, const QString &formName);
+
+signals:
+ /**Emitted when the content of the memory symbol store has been modified.*/
+ void updatedSourceInfo();
+
+ /**Emitted before removing the file from the memory symbol store.*/
+ void aboutToRemoveSourceInfo(const QString& fileName);
+
+ /**Emitted when a file has been removed from the memory symbol store.*/
+ void removedSourceInfo(const QString& fileName);
+
+ /**Emitted when a file has been added to the memory symbol store.*/
+ void addedSourceInfo( const QString& fileName );
+
+ /**Emitted when the language part changes the Split View orientation.*/
+ void splitOrientationChanged( Qt::Orientation orientation );
+};
+
+#endif
diff --git a/lib/interfaces/kdevmainwindow.cpp b/lib/interfaces/kdevmainwindow.cpp
new file mode 100644
index 00000000..e54b616e
--- /dev/null
+++ b/lib/interfaces/kdevmainwindow.cpp
@@ -0,0 +1,28 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 John Firebaugh <jfirebaugh@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevmainwindow.h"
+
+#include <kmainwindow.h>
+#include <kstatusbar.h>
+
+KStatusBar *KDevMainWindow::statusBar()
+{
+ return main()->statusBar();
+}
diff --git a/lib/interfaces/kdevmainwindow.h b/lib/interfaces/kdevmainwindow.h
new file mode 100644
index 00000000..3e2553b3
--- /dev/null
+++ b/lib/interfaces/kdevmainwindow.h
@@ -0,0 +1,101 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 John Firebaugh <jfirebaugh@kde.org>
+ Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEV_MAINWINDOW_H
+#define KDEV_MAINWINDOW_H
+
+#include <qstring.h>
+
+class QWidget;
+class KStatusBar;
+class KMainWindow;
+
+/**
+@file kdevmainwindow.h
+KDevelop main window interface.
+*/
+
+/**
+KDevelop main window interface.
+Provides methods to control the main window of an application.
+*/
+class KDevMainWindow
+{
+public:
+ /**Destroys the main window*/
+ virtual ~KDevMainWindow() {} // must be virtual!
+
+ /**Embeds a view of a part into the main window.
+ @param view The view to embed. Must be a KPart.
+ @param title The title of a view.
+ @param toolTip The tooltip of a view.*/
+ virtual void embedPartView(QWidget *view, const QString &title, const QString& toolTip = QString::null) = 0;
+
+ /**Embeds a toolview at the left of the main window.
+ @param view The view to embed. Must be a KPart.
+ @param title The title of a view.
+ @param toolTip The tooltip of a view.*/
+ virtual void embedSelectView(QWidget *view, const QString &title, const QString &toolTip) = 0;
+
+ /**Embeds a toolview at the bottom of the main window.
+ @param view The view to embed. Must be a KPart.
+ @param title The title of a view.
+ @param toolTip The tooltip of a view.*/
+ virtual void embedOutputView(QWidget *view, const QString &title, const QString &toolTip) = 0;
+
+ /**Embeds a toolview at the right of the main window.
+ @param view The view to embed. Must be a KPart.
+ @param title The title of a view.
+ @param toolTip The tooltip of a view.*/
+ virtual void embedSelectViewRight(QWidget* view, const QString& title, const QString &toolTip) = 0;
+
+ /**Removes a view from the main window.
+ @param view The view to remove.*/
+ virtual void removeView(QWidget *view) = 0;
+
+ /**Shows or hides a view.
+ @param pView The view to show or hide.
+ @param bEnabled true if view should be shown, false it it is not.*/
+ virtual void setViewAvailable(QWidget *pView, bool bEnabled) = 0;
+
+ /**Raises a view (shows it if it was minimized).
+ @param view The view to be raised.*/
+ virtual void raiseView(QWidget *view) = 0;
+
+ /**Minimize a view.
+ @param view The view to be lowered.*/
+ virtual void lowerView(QWidget *view) = 0;
+
+ /**Loads main window settings.*/
+ virtual void loadSettings() = 0;
+
+ /**Sets the current document's caption, if applicable.
+ @param caption the caption to set.*/
+ virtual void setCurrentDocumentCaption( const QString &caption ) = 0;
+
+ /**@return KMainWindow object which actually represents the main window.*/
+ virtual KMainWindow *main() = 0;
+
+ /**@return KStatusBar object which actually represents the status bar in the main window.*/
+ KStatusBar *statusBar();
+};
+
+#endif
diff --git a/lib/interfaces/kdevpartcontroller.cpp b/lib/interfaces/kdevpartcontroller.cpp
new file mode 100644
index 00000000..66afa81f
--- /dev/null
+++ b/lib/interfaces/kdevpartcontroller.cpp
@@ -0,0 +1,30 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "KDevPartControllerIface.h"
+#include "kdevpartcontroller.h"
+#include "katedocumentmanagerinterface.h"
+
+KDevPartController::KDevPartController(QWidget *parent)
+ : KParts::PartManager(parent)
+{
+ new KDevPartControllerIface(this);
+ new KateDocumentManagerInterface(this);
+}
+
+#include "kdevpartcontroller.moc"
diff --git a/lib/interfaces/kdevpartcontroller.h b/lib/interfaces/kdevpartcontroller.h
new file mode 100644
index 00000000..dced10ac
--- /dev/null
+++ b/lib/interfaces/kdevpartcontroller.h
@@ -0,0 +1,175 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
+ Copyright (C) 2003 Harald Fernengel <harry@kdevelop.org>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEV_PARTCONTROLLER_H
+#define KDEV_PARTCONTROLLER_H
+
+#include <kurl.h>
+#include <kparts/partmanager.h>
+#include <ktrader.h>
+
+/**
+@file kdevpartcontroller.h
+KDevelop part controller interface.
+*/
+
+namespace KParts
+{
+ class ReadOnlyPart;
+}
+
+/**Document state enum.*/
+enum DocumentState
+{
+ Clean, /**<Document is not touched.*/
+ Modified, /**<Document is modified inside a shell.*/
+ Dirty, /**<Document is modified by an external process.*/
+ DirtyAndModified /**<Document is modified inside a shell and at the same time by an external process.*/
+};
+
+/**
+Interface to control loaded parts and other documents.
+Part controller works with embedded into the shell parts. Such parts are usually editors,
+GUI designers, etc.
+*/
+class KDevPartController: public KParts::PartManager
+{
+ Q_OBJECT
+
+public:
+ /**Constructor.
+ @param parent The parent object.*/
+ KDevPartController(QWidget *parent);
+
+ /**Call this before a call to @ref editDocument to set the encoding of the
+ document to be opened.
+ @param encoding The encoding to open as.*/
+ virtual void setEncoding(const QString &encoding) = 0;
+
+ /**Opens a new or existing document.
+ @param url The URL of the document to open.
+ @param lineNum The line number to place the cursor at, if applicable.
+ @param col The column number to place the cursor at, if applicable.*/
+ virtual void editDocument(const KURL &url, int lineNum=-1, int col=-1) = 0;
+
+ /**Opens a new or existing document by splitting the view with the current,
+ if applicable. Offers split views of source code and header files for instance.
+ @param url The URL of the document to open.
+ @param lineNum The line number to place the cursor at, if applicable.
+ @param col The column number to place the cursor at, if applicable.*/
+ virtual void splitCurrentDocument(const KURL &url, int lineNum=-1, int col=-1) = 0;
+
+ /**Scrolls the viewport of the already opened document to the specified line
+ and column if applicable, but does not give focus to the document.
+ @param url The URL of the already opened document.
+ @param lineNum The line number to place the cursor at, if applicable.
+ @param col The column number to place the cursor at, if applicable.*/
+ virtual void scrollToLineColumn(const KURL &url, int lineNum=-1, int col=-1, bool storeHistory = false ) = 0;
+
+ /**Shows a HTML document in the documentation viewer.
+ @param url The URL of the document to view.
+ @param newWin If true, the new window will be created instead of using current.*/
+ virtual void showDocument(const KURL &url, bool newWin = false) = 0;
+
+ /**Embeds a part into the main area of the mainwindow.
+ @param part The part to embed.
+ @param name The name of the part.
+ @param shortDescription Currently not used.*/
+ virtual void showPart(KParts::Part* part, const QString& name, const QString& shortDescription ) = 0;
+
+ /**Finds the embedded part corresponding to a given URL.
+ @param url The URL of the document.
+ @return The corresponding part, 0 if not found.*/
+ virtual KParts::ReadOnlyPart *partForURL(const KURL & url) = 0;
+
+ /**Finds the embedded part corresponding to a given main widget
+ @param widget The parts main widget.
+ @return The corresponding part, 0 if not found.*/
+ virtual KParts::Part *partForWidget(const QWidget *widget) = 0;
+
+ /**@return The list of open documents*/
+ virtual KURL::List openURLs() = 0;
+
+ /**Saves all open files.
+ @return false if it was cancelled by the user, true otherwise */
+ virtual bool saveAllFiles() = 0;
+
+ /**Saves a list of files.
+ @param list The list of URLs to save.
+ @return false if it was cancelled by the user, true otherwise */
+ virtual bool saveFiles(const KURL::List &list) = 0;
+
+ /**Reloads all open files.*/
+ virtual void revertAllFiles() = 0;
+
+ /**Reloads a list of files.
+ * @param list The list of URLs to reload.*/
+ virtual void revertFiles(const KURL::List &list) = 0;
+
+ /**Closes all open files.*/
+ virtual bool closeAllFiles() = 0;
+
+ /**Closes a list of files.
+ @param list The list of URLs for the files to close.*/
+ virtual bool closeFiles(const KURL::List &list) = 0;
+
+ /**Closes this part (closes the window/tab for this part).
+ @param part The part to close.
+ @return true if the part was sucessfuly closed.*/
+ virtual bool closePart(KParts::Part *part) = 0;
+
+ /**Activate this part.
+ @param part The part to activate.*/
+ virtual void activatePart( KParts::Part * part ) = 0;
+
+ /**Checks the state of a document.
+ @param url The URL to check.
+ @return The DocumentState enum corresponding to the document state.*/
+ virtual DocumentState documentState( KURL const & url ) = 0;
+
+signals:
+
+ /**Emitted when a document has been saved.*/
+ void savedFile(const KURL &);
+
+ /**Emitted when a document has been loaded.*/
+ void loadedFile(const KURL &);
+
+ /**Emitted when a document has been closed.*/
+ void closedFile(const KURL &);
+
+ /**Emitted when a file has been modified outside of KDevelop.*/
+ void fileDirty(const KURL &);
+
+ /**This is typically emitted when an editorpart does "save as"
+ which will change the part's URL.*/
+ void partURLChanged(KParts::ReadOnlyPart *);
+
+ /**This is emitted when the document changes,
+ either internally or on disc.*/
+ void documentChangedState(const KURL &, DocumentState);
+
+};
+
+#endif
diff --git a/lib/interfaces/kdevplugin.cpp b/lib/interfaces/kdevplugin.cpp
new file mode 100644
index 00000000..fa289ab8
--- /dev/null
+++ b/lib/interfaces/kdevplugin.cpp
@@ -0,0 +1,139 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002 Harald Fernengel <harry@kdevelop.org>
+ Copyright (C) 2002 F@lk Brettschneider <falkbr@kdevelop.org>
+ Copyright (C) 2003 Julian Rockey <linux@jrockey.com>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevplugin.h"
+
+#include "kdevapi.h"
+#include "kdevcore.h"
+#include "kdevplugininfo.h"
+#include "kdevpartcontroller.h"
+#include "kdevplugincontroller.h"
+
+#include <kaction.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include <qdom.h>
+#include <qmap.h>
+
+#include <assert.h>
+
+///////////////////////////////////////////////////////////////////////////////
+// struct KDevPlugin::Private
+///////////////////////////////////////////////////////////////////////////////
+
+struct KDevPlugin::Private
+{
+ const KDevPluginInfo *info;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class KDevPlugin
+///////////////////////////////////////////////////////////////////////////////
+
+KDevPlugin::KDevPlugin(const KDevPluginInfo *info, QObject *parent, const char *name)
+ :QObject(parent, name), d(new Private)
+{
+ assert(parent->inherits( "KDevApi" ));
+ m_api = static_cast<KDevApi *>( parent );
+
+ actionCollection()->setHighlightingEnabled( true );
+
+ d->info = info;
+ KGlobal::iconLoader()->addAppDir("kdevelop");
+}
+
+KDevPlugin::~KDevPlugin()
+{
+ delete( d );
+}
+
+KDevMainWindow *KDevPlugin::mainWindow()
+{
+ return m_api->mainWindow();
+}
+
+KDevCore *KDevPlugin::core() const
+{
+ return m_api->core();
+}
+
+KDevProject *KDevPlugin::project() const
+{
+ return m_api->project();
+}
+
+CodeModel *KDevPlugin::codeModel() const
+{
+ return m_api->codeModel();
+}
+
+QDomDocument *KDevPlugin::projectDom() const
+{
+ return m_api->projectDom();
+}
+
+KDevLanguageSupport *KDevPlugin::languageSupport() const
+{
+ return m_api->languageSupport();
+}
+
+KDevPartController *KDevPlugin::partController() const
+{
+ return m_api->partController();
+}
+
+KDevPluginController *KDevPlugin::pluginController() const
+{
+ return m_api->pluginController();
+}
+
+void KDevPlugin::restorePartialProjectSession(const QDomElement* /*el*/)
+{
+ // there's still nothing to do in the base class
+}
+
+void KDevPlugin::savePartialProjectSession(QDomElement* /*el*/)
+{
+ // there's still nothing to do in the base class
+}
+
+KDevCodeRepository * KDevPlugin::codeRepository() const
+{
+ return m_api->codeRepository();
+}
+
+KDevPlugin * KDevPlugin::extension_internal(const QString &serviceType, const QString &constraint)
+{
+ return m_api->pluginController()->extension(serviceType, constraint);
+}
+
+const KDevPluginInfo *KDevPlugin::info()
+{
+ return d->info;
+}
+
+#include "kdevplugin.moc"
diff --git a/lib/interfaces/kdevplugin.h b/lib/interfaces/kdevplugin.h
new file mode 100644
index 00000000..b65b411f
--- /dev/null
+++ b/lib/interfaces/kdevplugin.h
@@ -0,0 +1,200 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999-2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVPLUGIN_H
+#define KDEVPLUGIN_H
+
+#include <qobject.h>
+#include <kxmlguiclient.h>
+#include "kdevapi.h"
+
+class KDevCore;
+class KDevProject;
+class KDevVersionControl;
+class KDevLanguageSupport;
+class KDevPartController;
+class KDevMainWindow;
+class KDevCodeRepository;
+class CodeModel;
+class KDevPluginInfo;
+class QDomElement;
+
+/**
+@file kdevplugin.h
+KDevelop plugin interface.
+*/
+
+/**Current KDevelop plugin interface version. Interfaces declare plugin version to make sure
+old source (or binary) incompatible plugins are not loaded. Increase this if
+it is necessary that old plugins stop working.*/
+#define KDEVELOP_PLUGIN_VERSION 5
+
+/**
+The base class for all KDevelop plugins.
+Plugin is a component which is loaded into KDevelop shell at startup or by request.
+Each plugin should have corresponding .desktop file with a description.
+.desktop file template looks like:
+@code
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Name=
+GenericName=
+Comment=
+Icon=
+X-KDevelop-Plugin-Version=
+X-KDevelop-Plugin-Homepage=
+X-KDevelop-Plugin-BugsEmailAddress=
+X-KDevelop-Plugin-Copyright=
+X-KDE-Library=
+X-KDevelop-Version=
+X-KDevelop-Scope=
+X-KDevelop-Properties=
+X-KDevelop-Args=
+@endcode
+<b>Description of parameters in .desktop file:</b>
+- <i>Name</i> is a non-translatable name of a plugin, it is used in KTrader queries
+to search for a plugin (required);
+- <i>GenericName</i> is a translatable name of a plugin, it is used to show
+plugin names in GUI (required);
+- <i>Comment</i> is a short description about the plugin (optional);
+- <i>Icon</i> is a plugin icon (preferred);
+- <i>X-KDevelop-Plugin-Version</i> is a version of a plugin (optional);
+- <i>X-KDevelop-Plugin-Homepage</i> is a home page of a plugin (optional);
+- <i>X-KDevelop-Plugin-License</i> is a license (optional). can be: GPL, LGPL, BSD, Artistic,
+QPL or Custom. If this property is not set, license is considered as unknown;
+- <i>X-KDevelop-Plugin-BugsEmailAddress</i> is an email address for bug reports (optional);
+- <i>X-KDevelop-Plugin-Copyright</i> is a copyright statement (optional);
+- <i>X-KDE-Library</i> is a name of library which contains the plugin (required);
+- <i>X-KDevelop-Version</i> is a version of KDevelop interfaces which is supported by the plugin (required);
+- <i>X-KDevelop-Scope</i> is a scope of a plugin (see below for explanation) (required);
+- <i>X-KDevelop-Args</i> is a list of additional arguments passed to plugins constructor (optional);
+- <i>X-KDevelop-Properties</i> is a list of properties which this plugin supports, see @ref Profile class documentation for explanation (required to work with shells that support profiles).
+.
+Plugin scope can be either:
+- Core
+- Global
+- Project
+.
+Global plugins are plugins which require only shell to be loaded and do not operate on @ref KDevProject interface and/or do not use project wide information.\n
+Core plugins are global plugins which offer some important "core" functionality and thus
+are not selectable by user in plugin configuration pages.\n
+Project plugins require a project to be loaded and are usually loaded/unloaded among with the project.
+If your plugin use @ref KDevProject interface and/or operate on project-related information then this is the project plugin.
+
+@sa KDevGenericFactory class documentation for an information about plugin instantiation
+and writing factories for plugins.
+
+@sa KDevCore class documentation for an information about features which are available to plugins
+from shell applications.
+*/
+class KDevPlugin: public QObject, public KXMLGUIClient
+{
+ Q_OBJECT
+
+public:
+ /**Constructs a plugin.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevPlugin(const KDevPluginInfo *info, QObject *parent, const char *name = 0);
+
+ /**Destructs a plugin.*/
+ virtual ~KDevPlugin();
+
+ /**Provides an information about the plugin.
+ @return KAboutData object which was initialized in the constructor.*/
+ const KDevPluginInfo* info();
+
+ /**@return A reference to the toplevel widget.*/
+ KDevMainWindow *mainWindow();
+
+ /**@return A reference to the application core - an object which provides
+ basic functionalities for inter-parts communications / cooperation.*/
+ KDevCore *core() const;
+
+ /**@return A reference to the current project component or 0 if no project is loaded.*/
+ KDevProject *project() const;
+
+ /**@return A reference to the language support component or 0 if no support available.*/
+ KDevLanguageSupport *languageSupport() const;
+
+ /**@return A reference to the memory symbol store.*/
+ CodeModel *codeModel() const;
+
+ /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/
+ QDomDocument *projectDom() const;
+
+ /**@return A reference to the part controller which is used to manipulate loaded KParts.*/
+ KDevPartController *partController() const;
+
+ /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/
+ virtual KDevPluginController *pluginController() const;
+
+ /**@return A reference to the code repository (accessor to persistent symbol stores).*/
+ KDevCodeRepository* codeRepository() const;
+
+ /**Queries for the plugin which supports given service type (such plugins are called extensions in KDevelop).
+ All already loaded plugins will be queried and the <b>first loaded one</b> to support
+ the service type will be returned. Any plugin can be an extension, only "ServiceTypes=..."
+ entry is required in .desktop file for that plugin.
+
+ Template argument is used as a type to cast the result to. This is done because extension
+ is usually derived from a certain base class and not directly from KDevPlugin.
+ @param serviceType The service type of an extension (like "KDevelop/SourceFormatter").
+ @param constraint The constraint which is applied when quering for the service. This
+ constraint is a usual KTrader constraint statement (like "[X-KDevelop-Foo]=='MyFoo'").
+ @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/
+ template <class Extension>
+ Extension *extension(const QString &serviceType, const QString &constraint = "")
+ {
+ return static_cast<Extension*>(extension_internal(serviceType, constraint));
+ }
+
+ /**Override this base class method to restore any settings which differs from project to project.
+ Data can be read from a certain subtree of the project session file.
+ During project loading, respectively project session (.kdevses) loading,
+ this method will be called to give a chance to adapt the plugin to
+ the newly loaded project. For instance, the debugger plugin might restore the
+ list of breakpoints from the previous debug session for the certain project.
+ @note Take attention to the difference to common not-project-related session stuff.
+ They belong to the application rc file (kdeveloprc)
+ @note Project session file is useful for settings which cannot be shared between
+ developers. If a setting should be shared, modify projectDom instead.
+ @param el The parent DOM element for plugins session settings.*/
+ virtual void restorePartialProjectSession(const QDomElement* el);
+
+ /**Saves session settings.
+ @sa restorePartialProjectSession - this is the other way round, the same just for saving.*/
+ virtual void savePartialProjectSession(QDomElement* el);
+
+private:
+ KDevPlugin *extension_internal(const QString &serviceType, const QString &constraint = "");
+
+ KDevApi *m_api;
+ class Private;
+ Private *d;
+};
+
+#endif
diff --git a/lib/interfaces/kdevplugincontroller.cpp b/lib/interfaces/kdevplugincontroller.cpp
new file mode 100644
index 00000000..ca2321de
--- /dev/null
+++ b/lib/interfaces/kdevplugincontroller.cpp
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevplugincontroller.h"
+
+#include "kdevplugin.h"
+
+KDevPluginController::KDevPluginController()
+{
+}
+
+KTrader::OfferList KDevPluginController::query(const QString &serviceType,
+ const QString &constraint)
+{
+ return KTrader::self()->query(serviceType,
+ QString("%1 and [X-KDevelop-Version] == %2").arg(constraint).arg(KDEVELOP_PLUGIN_VERSION));
+}
+
+KTrader::OfferList KDevPluginController::queryPlugins(const QString &constraint)
+{
+ return query("KDevelop/Plugin", constraint);
+}
+
+KURL::List KDevPluginController::profileResources(const QString &/*nameFilter*/)
+{
+ return KURL::List();
+}
+
+KURL::List KDevPluginController::profileResourcesRecursive(const QString &/*nameFilter*/)
+{
+ return KURL::List();
+}
+
+#include "kdevplugincontroller.moc"
diff --git a/lib/interfaces/kdevplugincontroller.h b/lib/interfaces/kdevplugincontroller.h
new file mode 100644
index 00000000..8bb70bd0
--- /dev/null
+++ b/lib/interfaces/kdevplugincontroller.h
@@ -0,0 +1,118 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVPLUGINCONTROLLER_H
+#define KDEVPLUGINCONTROLLER_H
+
+#include <qobject.h>
+
+#include <kurl.h>
+#include <ktrader.h>
+
+/**
+@file kdevplugincontroller.h
+KDevelop plugin controller interface.
+*/
+
+class KDevPlugin;
+class ProfileEngine;
+
+/**
+The base class for KDevelop plugin controller.
+Plugin controller is responsible for quering, loading and unloading available plugins.
+*/
+class KDevPluginController: public QObject
+{
+ Q_OBJECT
+public:
+
+ /**
+ * Returns a uniquely specified plugin. If it isn't already loaded, it will be.
+ * Use with caution! See extension for parameter details.
+ */
+ virtual KDevPlugin * loadPlugin( const QString & serviceType, const QString & constraint ) = 0;
+
+ /**
+ * Unloads the plugin specified by @p plugin
+ * @param plugin The plugin desktopEntryName of the plugin to unload
+ */
+ virtual void unloadPlugin( const QString & plugin ) = 0;
+
+ /**Unloads plugins specified by @p list.
+ @param list The list of plugin names to unload. plugin name corresponds
+ to the "Name" property in plugin .desktop file.*/
+ virtual void unloadPlugins(QStringList const &list) = 0;
+
+ /**@return The list of currently loaded plugins.*/
+ virtual const QValueList<KDevPlugin*> loadedPlugins() = 0;
+
+ /**Queries for the plugin which supports given service type.
+ All already loaded plugins will be queried and the first one to support the service type
+ will be returned. Any plugin can be an extension, only "ServiceTypes=..." entry is
+ required in .desktop file for that plugin.
+ @param serviceType The service type of an extension (like "KDevelop/SourceFormatter")
+ @param constraint The constraint which is applied when quering for the service. This
+ constraint is a usual KTrader constraint statement (like "[X-KDevelop-Foo]=='MyFoo'").
+ @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/
+ virtual KDevPlugin *extension(const QString &serviceType, const QString &constraint = "") = 0;
+
+ /**Queries KDevelop services. Version is checked automatically
+ by adding proper X-KDevelop-Version=N statement into the query.
+ @param serviceType The service type to query, for example "KDevelop/Plugin" or
+ "KDevelop/SourceFormatter."
+ @param constraint A constraint for the service. Do not include plugin version number - it
+ is done automatically.
+ @return The list of plugin offers.*/
+ static KTrader::OfferList query(const QString &serviceType, const QString &constraint);
+
+ /**Queries KDevelop plugins. Works like
+ KDevPluginController::query with serviceType set to "KDevelop/Plugin".
+ @param constraint A constraint for the service. Do not include plugin version number - it
+ is done automatically.
+ @return The list of plugin offers.*/
+ static KTrader::OfferList queryPlugins(const QString &constraint);
+
+ /**Reimplement this function only if your shell supports plugin profiles.
+ @return The list of URLs to the profile resources (files) with given @p extension.
+ @param nameFilter Name filter for files. @see QDir::setNameFilter documentation
+ for name filters syntax.*/
+ virtual KURL::List profileResources(const QString &nameFilter);
+
+ /**Reimplement this function only if your shell supports plugin profiles.
+ @return The list of URLs to the resources (files) with given @p extension.
+ This list is obtained by a recursive search that process given profile
+ and all it's subprofiles.
+ @param nameFilter Name filter for files. @see QDir::setNameFilter documentation
+ for name filters syntax.*/
+ virtual KURL::List profileResourcesRecursive(const QString &nameFilter);
+
+ /** @return The current Profile Engine */
+ virtual ProfileEngine &engine() = 0;
+
+signals:
+ /**Emitted when a plugin profile was changed (reloaded, other profile opened, etc.).
+ Should work only on shells with plugin profiles support.*/
+ void profileChanged();
+
+protected:
+ /**Constructor.*/
+ KDevPluginController();
+
+};
+
+#endif
diff --git a/lib/interfaces/kdevplugininfo.cpp b/lib/interfaces/kdevplugininfo.cpp
new file mode 100644
index 00000000..98f8d03d
--- /dev/null
+++ b/lib/interfaces/kdevplugininfo.cpp
@@ -0,0 +1,181 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevplugininfo.h"
+
+#include <qvariant.h>
+
+#include <kservice.h>
+#include <kdebug.h>
+
+#include "kdevplugincontroller.h"
+
+struct KDevPluginInfo::Private {
+ QString m_pluginName;
+ QString m_rawGenericName;
+
+ QString m_genericName;
+ QString m_description;
+ QString m_icon;
+
+ QString m_version;
+ int m_licenseType;
+ QString m_copyrightStatement;
+ QString m_homePageAddress;
+ QString m_bugsEmailAddress;
+
+ QValueList<KAboutPerson> m_authors;
+ QValueList<KAboutPerson> m_credits;
+
+ KAboutData *m_data;
+};
+
+
+KDevPluginInfo::KDevPluginInfo(const QString &pluginName)
+ :d(new Private())
+{
+ d->m_pluginName = pluginName;
+
+ KService::Ptr offer = KService::serviceByDesktopName(pluginName);
+ if (offer != 0)
+ {
+ d->m_genericName = offer->genericName();
+ d->m_icon = offer->icon();
+ d->m_description = offer->comment();
+
+ d->m_rawGenericName = offer->untranslatedGenericName();
+
+ d->m_version = offer->property("X-KDevelop-Plugin-Version").toString();
+ d->m_homePageAddress = offer->property("X-KDevelop-Plugin-Homepage").toString();
+ d->m_bugsEmailAddress = offer->property("X-KDevelop-Plugin-BugsEmailAddress").toString();
+ d->m_copyrightStatement = offer->property("X-KDevelop-Plugin-Copyright").toString();
+
+ QString lic = offer->property("X-KDevelop-Plugin-License").toString();
+ if (lic == "GPL")
+ d->m_licenseType = KAboutData::License_GPL;
+ else if (lic == "LGPL")
+ d->m_licenseType = KAboutData::License_LGPL;
+ else if (lic == "BSD")
+ d->m_licenseType = KAboutData::License_BSD;
+ else if (lic == "QPL")
+ d->m_licenseType = KAboutData::License_QPL;
+ else if (lic == "Artistic")
+ d->m_licenseType = KAboutData::License_Artistic;
+ else if (lic == "Custom")
+ d->m_licenseType = KAboutData::License_Custom;
+ else
+ d->m_licenseType = KAboutData::License_Unknown;
+
+ d->m_data = new KAboutData(d->m_pluginName.ascii(), d->m_rawGenericName.ascii(), "1", 0, d->m_licenseType);
+ }
+ else
+ kdDebug() << "Unable to load information for plugin: " << pluginName
+ << ". Check if " << pluginName << ".desktop exists." << endl;
+}
+
+
+KDevPluginInfo::operator KAboutData *() const
+{
+ return d->m_data;
+}
+
+QString KDevPluginInfo::pluginName() const
+{
+ return d->m_pluginName;
+}
+
+QString KDevPluginInfo::genericName() const
+{
+ return d->m_genericName;
+}
+
+QString KDevPluginInfo::icon() const
+{
+ return d->m_icon;
+}
+
+QString KDevPluginInfo::description() const
+{
+ return d->m_description;
+}
+
+QString KDevPluginInfo::version() const
+{
+ return d->m_version;
+}
+
+int KDevPluginInfo::licenseType() const
+{
+ return d->m_licenseType;
+}
+
+QString KDevPluginInfo::license() const
+{
+ KDevPluginInfo &info = *const_cast<KDevPluginInfo*>(this);
+// return KAboutData(info).license();
+ KAboutData *data = info;
+ return data->license();
+}
+
+QString KDevPluginInfo::copyrightStatement() const
+{
+ return d->m_copyrightStatement;
+}
+
+QString KDevPluginInfo::homePageAddress() const
+{
+ return d->m_homePageAddress;
+}
+
+QString KDevPluginInfo::bugsEmailAddress() const
+{
+ return d->m_bugsEmailAddress;
+}
+
+QVariant KDevPluginInfo::property(const QString &name) const
+{
+ KTrader::OfferList offers = KDevPluginController::queryPlugins(QString("Name='%1'").arg(d->m_pluginName));
+ if (offers.count() == 1)
+ return offers.first()->property(name);
+ return QVariant();
+}
+
+QVariant KDevPluginInfo::operator [](const QString &name) const
+{
+ return property(name);
+}
+
+QStringList KDevPluginInfo::propertyNames( ) const
+{
+ KTrader::OfferList offers = KDevPluginController::queryPlugins(QString("Name='%1'").arg(d->m_pluginName));
+ if (offers.count() == 1)
+ return offers.first()->propertyNames();
+ return QStringList();
+}
+
+void KDevPluginInfo::addAuthor(const char *name, const char *task,
+ const char *emailAddress, const char *webAddress)
+{
+ d->m_authors.append(KAboutPerson(name, task, emailAddress, webAddress));
+}
+
+void KDevPluginInfo::addCredit(const char *name, const char *task,
+ const char *emailAddress, const char *webAddress)
+{
+ d->m_credits.append(KAboutPerson(name, task, emailAddress, webAddress));
+}
diff --git a/lib/interfaces/kdevplugininfo.h b/lib/interfaces/kdevplugininfo.h
new file mode 100644
index 00000000..b8a2b954
--- /dev/null
+++ b/lib/interfaces/kdevplugininfo.h
@@ -0,0 +1,111 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVPLUGININFO_H
+#define KDEVPLUGININFO_H
+
+#include <qvariant.h>
+
+#include <kaboutdata.h>
+
+/**
+@file kdevplugininfo.h
+KDevelop plugin information container class.
+*/
+
+/**
+Information about KDevelop plugin.
+It uses plugin name to query plugin .desktop files and
+retrieve most information. Names of authors and credits to other people
+must be added manually using KDevPluginInfo::addAuthor and KDevPluginInfo::addCredit
+methods.
+@sa KDevPlugin class documentation for more information about .desktop files.
+*/
+class KDevPluginInfo
+{
+public:
+ /**Constructor.
+ @param pluginName A name of a plugin. Must be the same as the name of a .desktop file
+ and the same as the location of plugin resource files.*/
+ KDevPluginInfo(const QString &pluginName);
+
+ /**Casts KDevPluginInfo to KAboutData. Uses KDevPluginInfo::pluginName as KAboutData::appName,
+ KDevPluginInfo::rawGenericName as KAboutData::programName KDevPluginInfo::licenseType as KAboutData::licenseType. Other parameters are ignored.*/
+ operator KAboutData*() const;
+
+ /**@return A name of a plugin (always untranslated).*/
+ QString pluginName() const;
+ /**@return A generic name of a plugin (translated). Use this in GUI. Information is taken from .desktop file.*/
+ QString genericName() const;
+ /**@return An icon name of a plugin. Information is taken from .desktop file.*/
+ QString icon() const;
+ /**@return A description of a plugin. Information is taken from .desktop file.*/
+ QString description() const;
+ /**@return A version of a plugin. Information is taken from .desktop file.*/
+ QString version() const;
+ /**@return A license type of a plugin. Information is taken from .desktop file.*/
+ int licenseType() const;
+ /**@return A license text for known license types (GPL, LGPL, BSD, Artistic, QPL).*/
+ QString license() const;
+ /**@return A copyright statement of a plugin. Information is taken from .desktop file.*/
+ QString copyrightStatement() const;
+ /**@return A home page of a plugin. Information is taken from .desktop file.*/
+ QString homePageAddress() const;
+ /**@return A email address for bugs of a plugin. Information is taken from .desktop file.*/
+ QString bugsEmailAddress() const;
+
+ /**@param name The name of a property.
+ @return Any property value which exists in .desktop file.*/
+ QVariant property(const QString &name) const;
+ /**@param name The name of a property.
+ @return Any property value which exists in .desktop file.*/
+ QVariant operator [] (const QString &name) const;
+ /**@return A list of property names set in .desktop file.*/
+ QStringList propertyNames() const;
+
+ /**@return A list of plugin authors.*/
+ const QValueList<KAboutPerson> authors() const;
+ /**@return A list of other plugin contributors.*/
+ const QValueList<KAboutPerson> credits() const;
+
+ /**Adds an author to the list of authors.
+ You can call this function as many times you need. Each entry is appended to a list.
+ @param name The developer's name in UTF-8 encoding.
+ @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0.
+ @param emailAddress An Email address where the person can be reached. Can be 0.
+ @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/
+ void addAuthor(const char *name, const char *task,
+ const char *emailAddress = 0, const char *webAddress = 0);
+ /**Adds a contributor to the list of contributors.
+ You can call this function as many times you need. Each entry is appended to a list.
+ @param name The developer's name in UTF-8 encoding.
+ @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0.
+ @param emailAddress An Email address where the person can be reached. Can be 0.
+ @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/
+ void addCredit(const char *name, const char *task = 0,
+ const char *emailAddress = 0, const char *webAddress = 0);
+
+private:
+ /**Returns the untranslated generic name of a plugin as set in .desktop file.*/
+ const char *rawGenericName() const;
+
+ class Private;
+ Private *d;
+};
+
+#endif
diff --git a/lib/interfaces/kdevproject.cpp b/lib/interfaces/kdevproject.cpp
new file mode 100644
index 00000000..e4e3281d
--- /dev/null
+++ b/lib/interfaces/kdevproject.cpp
@@ -0,0 +1,164 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <kdebug.h>
+
+#include "kdevproject.h"
+#include <urlutil.h>
+#include <qfileinfo.h>
+#include <qtimer.h>
+#include "kdevprojectiface.h"
+
+struct KDevProject::Private {
+ QMap<QString, QString> m_absToRel;
+ QStringList m_symlinkList;
+ QTimer *m_timer;
+ KDevProjectIface *m_iface;
+};
+
+KDevProject::KDevProject(const KDevPluginInfo *info, QObject *parent, const char *name)
+ : KDevPlugin(info, parent, name), d(new KDevProject::Private())
+{
+ connect( this, SIGNAL(addedFilesToProject(const QStringList& )), this, SLOT(buildFileMap()) );
+ connect( this, SIGNAL(removedFilesFromProject(const QStringList& )), this, SLOT(buildFileMap()) );
+
+ connect( this, SIGNAL(addedFilesToProject(const QStringList& )), this, SLOT(slotAddFilesToFileMap(const QStringList& )) );
+ connect( this, SIGNAL(removedFilesFromProject(const QStringList& )), this, SLOT(slotRemoveFilesFromFileMap(const QStringList& )) );
+
+ d->m_timer = new QTimer(this);
+ connect(d->m_timer, SIGNAL(timeout()), this, SLOT(slotBuildFileMap()));
+ d->m_iface = new KDevProjectIface(this);
+}
+
+KDevProject::~KDevProject()
+{
+ d->m_timer->stop();
+ delete d->m_iface;
+ delete d->m_timer;
+ delete d;
+}
+
+void KDevProject::changedFile( const QString & fileName )
+{
+ QStringList fileList;
+ fileList.append ( fileName );
+
+ emit changedFilesInProject( fileList );
+
+}
+
+void KDevProject::changedFiles( const QStringList & fileList )
+{
+ emit changedFilesInProject( fileList );
+}
+
+KDevProject::Options KDevProject::options() const
+{
+ return (KDevProject::Options)0;
+}
+
+bool KDevProject::isProjectFile( const QString & absFileName )
+{
+ return d->m_absToRel.contains( absFileName );
+}
+
+QString KDevProject::relativeProjectFile( const QString & absFileName )
+{
+ if( isProjectFile(absFileName) )
+ return d->m_absToRel[ absFileName ];
+ return QString::null;
+}
+
+void KDevProject::buildFileMap()
+{
+ d->m_timer->stop();
+ d->m_timer->start(0, true);
+}
+
+void KDevProject::slotBuildFileMap()
+{
+ kdDebug(9000) << k_funcinfo << endl;
+
+ d->m_absToRel.clear();
+ d->m_symlinkList.clear();
+ const QStringList fileList = allFiles();
+ for( QStringList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it )
+ {
+ QFileInfo fileInfo( projectDirectory() + "/" + *it );
+ d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it;
+
+ if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() )
+ {
+ d->m_symlinkList << *it;
+ }
+ }
+}
+
+void KDevProject::openProject( const QString & /*dirName*/, const QString & /*projectName*/ )
+{
+ buildFileMap();
+}
+
+QStringList KDevProject::symlinkProjectFiles( )
+{
+ return d->m_symlinkList;
+}
+
+QString KDevProject::defaultRunDirectory(const QString& projectPluginName) const
+{
+ return DomUtil::readEntry(*projectDom(), "/" + projectPluginName + "/run/globalcwd");
+}
+
+void KDevProject::slotAddFilesToFileMap( const QStringList & fileList )
+{
+ QStringList::ConstIterator it = fileList.begin();
+ while( it != fileList.end() )
+ {
+ QFileInfo fileInfo( projectDirectory() + "/" + *it );
+ d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it;
+
+ if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() )
+ {
+ d->m_symlinkList << *it;
+ }
+
+ ++it;
+ }
+}
+
+void KDevProject::slotRemoveFilesFromFileMap( const QStringList & fileList )
+{
+ QStringList::ConstIterator it = fileList.begin();
+ while( it != fileList.end() )
+ {
+ QFileInfo fileInfo( projectDirectory() + "/" + *it );
+ d->m_absToRel.remove( URLUtil::canonicalPath(fileInfo.absFilePath()) );
+
+ d->m_symlinkList.remove( *it );
+
+ ++it;
+ }
+}
+
+#include "kdevproject.moc"
diff --git a/lib/interfaces/kdevproject.h b/lib/interfaces/kdevproject.h
new file mode 100644
index 00000000..64c8ed80
--- /dev/null
+++ b/lib/interfaces/kdevproject.h
@@ -0,0 +1,218 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
+ Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
+ Copyright (C) 2003-2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVPROJECT_H
+#define KDEVPROJECT_H
+
+#include "kdevplugin.h"
+#include "domutil.h"
+
+#include <qstringlist.h>
+#include <qmap.h>
+
+/**
+@file kdevproject.h
+KDevelop project interface.
+*/
+
+class QTimer;
+
+/**
+KDevelop project interface.
+Plugins implementing the KDevProject interfaces are used to manage projects.
+
+Project can be considered as a way of grouping files (in text editors) or
+as a way of providing support for a build system (like it is done in KDevelop IDE buildtools).
+*/
+class KDevProject: public KDevPlugin
+{
+ Q_OBJECT
+public:
+ /**Constructs a project plugin.
+ @param info Important information about the plugin - plugin internal and generic
+ (GUI) name, description, a list of authors, etc. That information is used to show
+ plugin information in various places like "about application" dialog, plugin selector
+ dialog, etc. Plugin does not take ownership on info object, also its lifetime should
+ be equal to the lifetime of the plugin.
+ @param parent The parent object for the plugin. Parent object must implement @ref KDevApi
+ interface. Otherwise the plugin will not be constructed.
+ @param name The internal name which identifies the plugin.*/
+ KDevProject(const KDevPluginInfo *info, QObject *parent=0, const char *name=0);
+ /**Destructor.*/
+ virtual ~KDevProject();
+
+ /**Options of the project plugin.*/
+ enum Options {
+ UsesOtherBuildSystem = 0 /**<Project uses unknown or unspecified build system or build system is not used at all.*/,
+ UsesAutotoolsBuildSystem = 1 /**<Project uses autotools for building.*/,
+ UsesQMakeBuildSystem =2 /**<Project uses qmake for building.*/
+ };
+
+ /**This method is invoked when the project is opened
+ (i.e. actually just after this class has been
+ instantiated).
+ @param dirName The project directory, which should afterwards be returned by
+ the projectDirectory() method.
+ @param projectName The project name, which is equivalent
+ to the project file name without the suffix.*/
+ virtual void openProject(const QString &dirName, const QString &projectName);
+
+ /**This method is invoked when the project is about to be closed.*/
+ virtual void closeProject() = 0;
+
+ /**Reimplement this method to set project plugin options. Default implementation
+ returns KDevProject::UsesOtherBuildSystem.*/
+ virtual Options options() const;
+
+ /**@return The canonical absolute directory of the project. Canonical means that
+ a path does not contain symbolic links or redundant "." or ".." elements.*/
+ virtual QString projectDirectory() const = 0;
+
+ /**Returns the name of the project.*/
+ virtual QString projectName() const = 0;
+
+ /**@return The environment variables that sould be set before running mainProgram().*/
+ virtual DomUtil::PairList runEnvironmentVars() const = 0;
+
+ /**@return The path to main binary program of the project.
+ @param relative if true then the path returned is relative to the project directory.*/
+ virtual QString mainProgram() const = 0;
+
+ /**Absolute path (directory) from where the mainProgram() should be run.*/
+ virtual QString runDirectory() const = 0;
+
+ /**The command line arguments that the mainProgram() should be run with.*/
+ virtual QString runArguments() const = 0;
+
+ /**The command line arguments that the mainProgram() should be debugged with.*/
+ virtual QString debugArguments() const = 0;
+
+ /**Returns the path (relative to the project directory)
+ of the active directory. All newly automatically generated
+ classes and files are usually added here.*/
+ virtual QString activeDirectory() const = 0;
+
+ /**@return The canonical build directory of the project.
+ If the separate build directory is not supported, this should
+ return the same as projectDiretory(). Canonical means that
+ a path does not contain symbolic links or redundant "." or ".." elements.*/
+ virtual QString buildDirectory() const = 0;
+
+ /**@return The list of all files in the project. The names are relative to
+ the project directory.*/
+ virtual QStringList allFiles() const = 0;
+
+ /**@return The list of files that are part of the distribution but not under
+ project control. Used mainly to package and publish extra files among with the project.*/
+ virtual QStringList distFiles() const = 0;
+
+ /**Adds a list of files to the project. Provided for convenience when adding many files.
+ @param fileList The list of file names relative to the project directory.*/
+ virtual void addFiles(const QStringList &fileList) = 0;
+
+ /**Adds a file to the project.
+ @param fileName The file name relative to the project directory.*/
+ virtual void addFile(const QString &fileName)= 0;
+
+ /**Removes a list of files from the project. Provided for convenience when removing many files.
+ @param fileList The list of file names relative to the project directory.*/
+ virtual void removeFiles(const QStringList& fileList)= 0;
+
+ /**Removes a file from the project.
+ @param fileName The file name relative to the project directory.*/
+ virtual void removeFile(const QString &fileName) = 0;
+
+ /**Notifies the project about changes to the files. Provided for
+ convenience when changing many files.
+ @param fileList The list of file names relative to the project directory..*/
+ virtual void changedFiles(const QStringList &fileList);
+
+ /**Notifies the project of a change to one of the files.
+ @param fileName The file name relative to the project directory.*/
+ virtual void changedFile(const QString &fileName);
+
+ /**@return true if the file @p absFileName is a part of the project.
+ @param absFileName Absolute name of a file to check.*/
+ virtual bool isProjectFile(const QString &absFileName);
+
+ /**@return The path (relative to the project directory) of the file @p absFileName.
+ @param absFileName Absolute name of a file.*/
+ virtual QString relativeProjectFile(const QString &absFileName);
+
+ /**@return The list of files known to the project through symlinks.*/
+ virtual QStringList symlinkProjectFiles();
+
+protected:
+
+ /** Default implementation of runDirectory method.
+ * Uses 'projectPluginName' to obtain configuration from
+ * project DOM and returns:
+ *
+ * if /<projectPluginName>/run/directoryradio == executable
+ * The directory where the executable is.
+ * if /<projectPluginName>/run/directoryradio == build
+ * The build directory.
+ * if /kdevautoproject/run/directoryradio == custom
+ * The custom directory absolute path.
+ * Derived classes are supposed to explicitly call this implementation
+ */
+ QString defaultRunDirectory(const QString& projectPluginName) const;
+
+private slots:
+ void buildFileMap();
+ void slotBuildFileMap();
+ void slotAddFilesToFileMap(const QStringList & fileList );
+ void slotRemoveFilesFromFileMap(const QStringList & fileList );
+
+signals:
+ /**Emitted when a new list of files has been added to the
+ project. Provided for convenience when many files were added.
+ @param fileList The file names relative to the project directory.*/
+ void addedFilesToProject(const QStringList& fileList);
+
+ /**Emitted when a list of files has been removed from the project.
+ Provided for convenience when many files were removed.
+ @param fileList The file names relative to the project directory.*/
+ void removedFilesFromProject(const QStringList& fileList);
+
+ /**Emitted when a list of files has changed in the project.
+ @param fileList The file names relative to the project directory.*/
+ void changedFilesInProject(const QStringList& fileList);
+
+ /**Emitted when one compile related command (make, make install, make ...) ends sucessfuly.
+ Used to reparse the files after a sucessful compilation.*/
+ void projectCompiled();
+
+ /**Emitted when the active directory of the project changes
+ * @param olddir The old active directory
+ * @param newdir The new active directory
+ */
+ void activeDirectoryChanged( const QString& olddir, const QString& newdir );
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif
diff --git a/lib/interfaces/kdevprojectiface.cpp b/lib/interfaces/kdevprojectiface.cpp
new file mode 100644
index 00000000..07cc78b1
--- /dev/null
+++ b/lib/interfaces/kdevprojectiface.cpp
@@ -0,0 +1,186 @@
+
+
+/* This file is part of the KDE project
+ Copyright (C) 2005 Ian Reinhart Geiser <geiseri@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "kdevprojectiface.h"
+#include "kdevproject.h"
+#include "domutil.h"
+
+KDevProjectIface::KDevProjectIface(KDevProject *prj)
+ : QObject(prj), DCOPObject("KDevProject"), m_prj(prj)
+{
+}
+
+
+KDevProjectIface::~KDevProjectIface()
+{
+}
+
+void KDevProjectIface::openProject( const QString & dirName, const QString & projectName )
+{
+ m_prj->openProject(dirName,projectName);
+}
+
+void KDevProjectIface::closeProject( )
+{
+ m_prj->closeProject();
+}
+
+uint KDevProjectIface::options( ) const
+{
+ return (uint)m_prj->options();
+}
+
+QString KDevProjectIface::projectDirectory( ) const
+{
+ return m_prj->projectDirectory();
+}
+
+QString KDevProjectIface::projectName( ) const
+{
+ return m_prj->projectName();
+}
+
+QString KDevProjectIface::mainProgram() const
+{
+ return m_prj->mainProgram();
+}
+
+QString KDevProjectIface::runDirectory( ) const
+{
+ return m_prj->runDirectory();
+}
+
+QString KDevProjectIface::activeDirectory( ) const
+{
+ return m_prj->activeDirectory();
+}
+
+QString KDevProjectIface::buildDirectory( ) const
+{
+ return m_prj->buildDirectory();
+}
+
+QStringList KDevProjectIface::allFiles( ) const
+{
+ return m_prj->allFiles();
+}
+
+QStringList KDevProjectIface::distFiles( ) const
+{
+ return m_prj->distFiles();
+}
+
+void KDevProjectIface::addFiles( const QStringList & fileList )
+{
+ m_prj->addFiles(fileList);
+}
+
+void KDevProjectIface::addFile( const QString & fileName )
+{
+ m_prj->addFile(fileName);
+}
+
+void KDevProjectIface::removeFiles( const QStringList & fileList )
+{
+ m_prj->removeFiles(fileList);
+}
+
+void KDevProjectIface::removeFile( const QString & fileName )
+{
+ m_prj->removeFile(fileName);
+}
+
+void KDevProjectIface::changedFiles( const QStringList & fileList )
+{
+ m_prj->changedFiles(fileList);
+}
+
+void KDevProjectIface::changedFile( const QString & fileName )
+{
+ m_prj->changedFile(fileName);
+}
+
+bool KDevProjectIface::isProjectFile( const QString & absFileName )
+{
+ return m_prj->isProjectFile(absFileName);
+}
+
+QString KDevProjectIface::relativeProjectFile( const QString & absFileName )
+{
+ return m_prj->relativeProjectFile(absFileName);
+}
+
+QStringList KDevProjectIface::symlinkProjectFiles( )
+{
+ return m_prj->symlinkProjectFiles();
+}
+
+QString KDevProjectIface::readEntry( const QString & path, const QString & defaultEntry )
+{
+ return DomUtil::readEntry( *m_prj->projectDom(), path, defaultEntry);
+}
+
+int KDevProjectIface::readIntEntry( const QString & path, int defaultEntry )
+{
+ return DomUtil::readIntEntry(*m_prj->projectDom(), path,defaultEntry);
+}
+
+bool KDevProjectIface::readBoolEntry( const QString & path, bool defaultEntry )
+{
+ return DomUtil::readBoolEntry(*m_prj->projectDom(), path, defaultEntry);
+}
+
+QStringList KDevProjectIface::readListEntry( const QString & path, const QString & tag )
+{
+ return DomUtil::readListEntry(*m_prj->projectDom(), path, tag);
+}
+
+QMap< QString, QString > KDevProjectIface::readMapEntry( const QString & path )
+{
+ return DomUtil::readMapEntry(*m_prj->projectDom(), path);
+}
+
+void KDevProjectIface::writeEntry( const QString & path, const QString & value )
+{
+ DomUtil::writeEntry(*m_prj->projectDom(), path, value);
+}
+
+void KDevProjectIface::writeIntEntry( const QString & path, int value )
+{
+ DomUtil::writeIntEntry(*m_prj->projectDom(), path, value);
+}
+
+void KDevProjectIface::writeBoolEntry( const QString & path, bool value )
+{
+ DomUtil::writeBoolEntry(*m_prj->projectDom(), path, value);
+}
+
+void KDevProjectIface::writeListEntry( const QString & path, const QString & tag, const QStringList & value )
+{
+ DomUtil::writeListEntry(*m_prj->projectDom(), path, tag, value);
+}
+
+void KDevProjectIface::writeMapEntry( const QString & path, const QMap< QString, QString > & map )
+{
+ DomUtil::writeMapEntry(*m_prj->projectDom(), path, map);
+}
+
+#include "kdevprojectiface.moc"
diff --git a/lib/interfaces/kdevprojectiface.h b/lib/interfaces/kdevprojectiface.h
new file mode 100644
index 00000000..ba299dfc
--- /dev/null
+++ b/lib/interfaces/kdevprojectiface.h
@@ -0,0 +1,81 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Ian Reinhart Geiser <geiseri@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef KDEVPROJECTIFACE_H
+#define KDEVPROJECTIFACE_H
+
+#include <dcopobject.h>
+#include <qstringlist.h>
+#include <qmap.h>
+
+class KDevProject;
+
+/**
+DCOP Interface for the @ref KDevProject object.
+
+@author KDevelop Authors
+*/
+class KDevProjectIface : public QObject, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+public:
+ KDevProjectIface(KDevProject *prj);
+
+ ~KDevProjectIface();
+k_dcop:
+ void openProject(const QString &dirName, const QString &projectName);
+ void closeProject();
+ uint options() const;
+ QString projectDirectory() const;
+ QString projectName() const;
+ QString mainProgram() const;
+ QString runDirectory() const;
+ QString activeDirectory() const;
+ QString buildDirectory() const;
+ QStringList allFiles() const;
+ QStringList distFiles() const;
+ void addFiles(const QStringList &fileList);
+ void addFile(const QString &fileName);
+ void removeFiles(const QStringList& fileList);
+ void removeFile(const QString &fileName);
+ void changedFiles(const QStringList &fileList);
+ void changedFile(const QString &fileName);
+ bool isProjectFile(const QString &absFileName);
+ QString relativeProjectFile(const QString &absFileName);
+ QStringList symlinkProjectFiles();
+
+ // Project DOM access
+ QString readEntry(const QString &path, const QString &defaultEntry = QString::null);
+ int readIntEntry(const QString &path, int defaultEntry = 0);
+ bool readBoolEntry(const QString &path, bool defaultEntry = false);
+ QStringList readListEntry(const QString &path, const QString &tag);
+ QMap<QString, QString> readMapEntry(const QString &path);
+
+ void writeEntry(const QString &path, const QString &value);
+ void writeIntEntry(const QString &path, int value);
+ void writeBoolEntry( const QString &path, bool value);
+ void writeListEntry(const QString &path, const QString &tag, const QStringList &value);
+ void writeMapEntry(const QString& path, const QMap<QString,QString> &map);
+
+ private:
+ KDevProject *m_prj;
+};
+
+#endif