KDevelop API Documentation

kdevapi.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000-2001 Bernd Gehrmann <bernd@kdevelop.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #include <kdebug.h>
00021 
00022 #include "kdevapi.h"
00023 #include "kdevversioncontrol.h"
00024 #include "kdevcoderepository.h"
00025 
00026 
00028 // Private types
00030 
00031 typedef QMap<QString,KDevVersionControl*> VersionControlMap;
00032 
00034 // class KDevApiPrivate
00036 
00037 class KDevApiPrivate
00038 {
00039 public:
00040 
00041   KDevApiPrivate()
00042     : m_projectDom(0), m_project(0), m_makeFrontend(0),
00043       m_appFrontend(0), m_languageSupport(0), m_versionControl(0),
00044       m_diffFrontend(0), m_createFile(0), m_sourceFormatter(0), m_codeRepository(0)
00045   {}
00046 
00047   QDomDocument *m_projectDom;
00048   KDevProject  *m_project;
00049   KDevMakeFrontend *m_makeFrontend;
00050   KDevAppFrontend *m_appFrontend;
00051   KDevLanguageSupport *m_languageSupport;
00052   KDevVersionControl *m_versionControl;
00053   KDevDiffFrontend *m_diffFrontend;
00054   KDevCreateFile *m_createFile;
00055   KDevSourceFormatter *m_sourceFormatter;
00056   VersionControlMap m_registeredVcs;
00057   KDevCodeRepository* m_codeRepository;
00058 };
00059 
00061 // class KDevApi
00063 
00064 KDevApi::KDevApi()
00065 {
00066   d = new KDevApiPrivate;
00067   d->m_codeRepository = new KDevCodeRepository();
00068 }
00069 
00071 
00072 KDevApi::~KDevApi()
00073 {
00074   delete d->m_codeRepository;
00075   delete d;
00076 }
00077 
00079 
00080 KDevProject *KDevApi::project() const
00081 {
00082   return d->m_project;
00083 }
00084 
00086 
00087 void KDevApi::setProject(KDevProject *project)
00088 {
00089   d->m_project = project;
00090 }
00091 
00093 
00094 KDevMakeFrontend *KDevApi::makeFrontend() const
00095 {
00096   return d->m_makeFrontend;
00097 }
00098 
00100 
00101 void KDevApi::setMakeFrontend(KDevMakeFrontend *makeFrontend)
00102 {
00103   d->m_makeFrontend = makeFrontend;
00104 }
00105 
00107 
00108 KDevAppFrontend *KDevApi::appFrontend() const
00109 {
00110   return d->m_appFrontend;
00111 }
00112 
00114 
00115 void KDevApi::setAppFrontend(KDevAppFrontend *appFrontend)
00116 {
00117   d->m_appFrontend = appFrontend;
00118 }
00119 
00121 
00122 KDevLanguageSupport *KDevApi::languageSupport() const
00123 {
00124   return d->m_languageSupport;
00125 }
00126 
00128 
00129 void KDevApi::setLanguageSupport(KDevLanguageSupport *languageSupport)
00130 {
00131   d->m_languageSupport = languageSupport;
00132 }
00133 
00135 
00136 KDevVersionControl *KDevApi::versionControl() const
00137 {
00138     return d->m_versionControl;
00139 }
00140 
00142 
00143 void KDevApi::setVersionControl( KDevVersionControl *vcs )
00144 {
00145     d->m_versionControl = vcs;
00146 }
00147 
00149 
00150 void KDevApi::registerVersionControl( KDevVersionControl *vcs )
00151 {
00152     d->m_registeredVcs.insert( vcs->uid(), vcs );
00153 }
00154 
00156 
00157 void KDevApi::unregisterVersionControl( KDevVersionControl *vcs )
00158 {
00159     if( vcs == d->m_versionControl )
00160         setVersionControl( 0 );
00161     d->m_registeredVcs.remove( vcs->uid() );
00162 }
00163 
00165 
00166 QStringList KDevApi::registeredVersionControls() const
00167 {
00168     QStringList foundVersionControls;
00169 
00170         // We query for all vcs plugins for KDevelop
00171     const VersionControlMap &availableVcs = d->m_registeredVcs;
00172 
00173     kdDebug( 9000 ) << "  ** Starting examining services ..." << endl;
00174 
00175     for(VersionControlMap::const_iterator it( availableVcs.begin() ); it != availableVcs.end(); ++it)
00176     {
00177         KDevVersionControl *vcs = (*it);
00178         foundVersionControls.append( vcs->uid() );
00179         kdDebug( 9000 ) << "  =====> Found VCS: " << vcs->uid() << endl;
00180     }
00181 
00182     return foundVersionControls;
00183 }
00184 
00186 
00187 KDevVersionControl *KDevApi::versionControlByName( const QString &uid ) const
00188 {
00189     return d->m_registeredVcs[ uid ];
00190 }
00191 
00193 
00194 KDevDiffFrontend *KDevApi::diffFrontend() const
00195 {
00196   return d->m_diffFrontend;
00197 }
00198 
00200 
00201 void KDevApi::setDiffFrontend(KDevDiffFrontend *diffFrontend)
00202 {
00203   d->m_diffFrontend = diffFrontend;
00204 }
00205 
00207 
00208 QDomDocument *KDevApi::projectDom() const
00209 {
00210   return d->m_projectDom;
00211 }
00212 
00214 
00215 void KDevApi::setProjectDom(QDomDocument *dom)
00216 {
00217   d->m_projectDom = dom;
00218 }
00219 
00221 
00222 void KDevApi::setCreateFile(KDevCreateFile *createFile)
00223 {
00224   d->m_createFile = createFile;
00225 }
00226 
00228 
00229 KDevCreateFile *KDevApi::createFile() const
00230 {
00231   return d->m_createFile;
00232 }
00233 
00235 
00236 KDevSourceFormatter *KDevApi::sourceFormatter() const
00237 {
00238   return d->m_sourceFormatter;
00239 }
00240 
00242 
00243 void KDevApi::setSourceFormatter(KDevSourceFormatter *sourceFormatter)
00244 {
00245   d->m_sourceFormatter = sourceFormatter;
00246 }
00247 
00249 
00250 KDevCodeRepository * KDevApi::codeRepository( ) const
00251 {
00252   return d->m_codeRepository;
00253 }
00254 
00255 #include "kdevapi.moc"
00256 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:52 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003