KDevelop API Documentation

kdevcore.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
00003    Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
00004    Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
00005    Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
00006    Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
00007 
00008    This library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public
00010    License as published by the Free Software Foundation; either
00011    version 2 of the License, or (at your option) any later version.
00012 
00013    This library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public License
00019    along with this library; see the file COPYING.LIB.  If not, write to
00020    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.
00022 */
00023 
00024 #include <kdebug.h>
00025 
00026 #include "KDevCoreIface.h"
00027 #include "kdevcore.h"
00028 
00029 #include "urlutil.h"
00030 
00032 // class Context
00034 
00036 
00037 Context::Context()
00038 {
00039 }
00040 
00042 
00043 Context::~Context()
00044 {
00045     kdDebug() << "Context::~Context()" << endl;
00046 }
00047 
00049 
00050 bool Context::hasType( int aType ) const
00051 {
00052 //    kdDebug(9000) << "Context::hasType(" << aType << "). this->type() == " << this->type() << endl;
00053 
00054     return aType == this->type();
00055 }
00056 
00058 // class EditorContext
00060 
00061 class EditorContext::Private
00062 {
00063 public:
00064     Private( const KURL &url, int line, int col, const QString &linestr,
00065         const QString &wordstr )
00066         : m_url(url), m_line(line), m_col(col),
00067           m_linestr(linestr), m_wordstr(wordstr)
00068     {
00069     }
00070 
00071     KURL m_url;
00072     int m_line, m_col;
00073     QString m_linestr, m_wordstr;
00074 };
00075 
00077 
00078 EditorContext::EditorContext( const KURL &url, int line, int col,
00079     const QString &linestr, const QString &wordstr )
00080     : Context(), d( new Private(url, line, col, linestr, wordstr) )
00081 {
00082 }
00083 
00085 
00086 EditorContext::~EditorContext()
00087 {
00088     kdDebug() << "EditorContext::~EditorContext()" << endl;
00089     delete d;
00090     d = 0;
00091 }
00092 
00094 
00095 int EditorContext::type() const
00096 {
00097     return Context::EditorContext;
00098 }
00099 
00101 
00102 const KURL &EditorContext::url() const
00103 {
00104     return d->m_url;
00105 }
00106 
00108 
00109 int EditorContext::line() const
00110 {
00111     return d->m_line;
00112 }
00113 
00115 
00116 int EditorContext::col() const
00117 {
00118     return d->m_col;
00119 }
00120 
00122 
00123 QString EditorContext::currentLine() const
00124 {
00125     return d->m_linestr;
00126 }
00127 
00129 
00130 QString EditorContext::currentWord() const
00131 {
00132     return d->m_wordstr;
00133 }
00134 
00136 // class FileContext
00138 
00139 class FileContext::Private
00140 {
00141 public:
00142     Private( const KURL::List &someURLs ) : m_urls(someURLs)
00143     {
00144         if (m_urls.count() == 0)
00145         {
00146             m_fileName = "INVALID-FILENAME";
00147             m_isDirectory = false;  // well, "true" should be ok too ...
00148         }
00149         else
00150         {
00151             m_fileName = m_urls[0].path();
00152             m_isDirectory = URLUtil::isDirectory( m_urls[0] );
00153         }
00154     }
00155     Private( const QString &fileName, bool isDirectory )
00156         : m_fileName(fileName), m_isDirectory(isDirectory)
00157     {
00158     }
00159 
00160     KURL::List m_urls;
00162     // parts should be modified to comply with this change.
00163     QString m_fileName;
00164     bool m_isDirectory;
00165 };
00166 
00168 
00169 FileContext::FileContext( const KURL::List &someURLs )
00170     : Context(), d( new Private(someURLs) )
00171 {
00172 }
00173 
00175 
00176 FileContext::FileContext( const QString &fileName, bool isDirectory )
00177     : Context(), d( new Private(fileName, isDirectory))
00178 {
00179 }
00180 
00182 
00183 FileContext::~FileContext()
00184 {
00185     kdDebug() << "FileContext::~FileContext()" << endl;
00186     delete d;
00187     d = 0;
00188 }
00189 
00191 
00192 int FileContext::type() const
00193 {
00194     return Context::FileContext;
00195 }
00196 
00198 
00199 QString FileContext::fileName() const
00200 {
00201     return d->m_fileName;
00202 }
00203 
00205 
00206 bool FileContext::isDirectory() const
00207 {
00208     return d->m_isDirectory;
00209 }
00210 
00212 
00213 const KURL::List &FileContext::urls() const
00214 {
00215     return d->m_urls;
00216 }
00217 
00219 // class DocumentationContext
00221 
00222 class DocumentationContext::Private
00223 {
00224 public:
00225     Private( const QString &url, const QString &selection )
00226         : m_url(url), m_selection(selection)
00227     {
00228     }
00229 
00230     QString m_url;
00231     QString m_selection;
00232 };
00233 
00235 
00236 DocumentationContext::DocumentationContext( const QString &url, const QString &selection )
00237     : Context(), d( new Private(url, selection) )
00238 {
00239 }
00240 
00242 
00243 DocumentationContext::DocumentationContext( const DocumentationContext &aContext )
00244     : Context(), d( 0 )
00245 {
00246     *this = aContext;
00247 }
00248 
00250 
00251 DocumentationContext &DocumentationContext::operator=( const DocumentationContext &aContext)
00252 {
00253     if (d) {
00254         delete d; d = 0;
00255     }
00256     d = new Private( *aContext.d );
00257     return *this;
00258 }
00259 
00261 
00262 DocumentationContext::~DocumentationContext()
00263 {
00264     kdDebug() << "DocumentationContext::~DocumentationContext()" << endl;
00265     delete d;
00266     d = 0;
00267 }
00268 
00270 
00271 int DocumentationContext::type() const
00272 {
00273     return Context::DocumentationContext;
00274 }
00275 
00277 
00278 QString DocumentationContext::url() const
00279 {
00280     return d->m_url;
00281 }
00282 
00284 
00285 QString DocumentationContext::selection() const
00286 {
00287     return d->m_selection;
00288 }
00289 
00291 // class CodeModelItemContext
00293 
00294 class CodeModelItemContext::Private
00295 {
00296 public:
00297     Private( const CodeModelItem* item ) : m_item( item ) {}
00298 
00299     const CodeModelItem* m_item;
00300 };
00301 
00303 
00304 CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item )
00305     : Context(), d( new Private(item) )
00306 {
00307 }
00308 
00310 
00311 CodeModelItemContext::~CodeModelItemContext()
00312 {
00313     kdDebug() << "CodeModelItemContext::~CodeModelItemContext()" << endl;
00314     delete d;
00315     d = 0;
00316 }
00317 
00319 
00320 int CodeModelItemContext::type() const
00321 {
00322     return Context::CodeModelItemContext;
00323 }
00324 
00326 
00327 const CodeModelItem* CodeModelItemContext::item() const
00328 {
00329     return d->m_item;
00330 }
00331 
00333 // class KDevCore
00335 
00336 KDevCore::KDevCore( QObject *parent, const char *name )
00337     : QObject( parent, name )
00338 {
00339     new KDevCoreIface(this);
00340 }
00341 
00343 
00344 KDevCore::~KDevCore()
00345 {
00346 }
00347 
00348 
00349 #include "kdevcore.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:36 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003