You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
299 lines
6.8 KiB
299 lines
6.8 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
|
||
11 years ago
|
Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
|
||
15 years ago
|
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>
|
||
11 years ago
|
Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
|
||
15 years ago
|
|
||
|
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
|
||
15 years ago
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
15 years ago
|
*/
|
||
11 years ago
|
#include "TDevCoreIface.h"
|
||
|
#include "tdevcore.h"
|
||
15 years ago
|
|
||
|
#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:
|
||
15 years ago
|
Private( const KURL &url, int line, int col, const TQString &linestr,
|
||
|
const TQString &wordstr )
|
||
15 years ago
|
: m_url(url), m_line(line), m_col(col),
|
||
|
m_linestr(linestr), m_wordstr(wordstr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
KURL m_url;
|
||
|
int m_line, m_col;
|
||
15 years ago
|
TQString m_linestr, m_wordstr;
|
||
15 years ago
|
};
|
||
|
|
||
|
EditorContext::EditorContext( const KURL &url, int line, int col,
|
||
15 years ago
|
const TQString &linestr, const TQString &wordstr )
|
||
15 years ago
|
: 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;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString EditorContext::currentLine() const
|
||
15 years ago
|
{
|
||
|
return d->m_linestr;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString EditorContext::currentWord() const
|
||
15 years ago
|
{
|
||
|
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] );
|
||
|
}
|
||
|
}
|
||
15 years ago
|
Private( const TQString &fileName, bool isDirectory )
|
||
15 years ago
|
: 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.
|
||
15 years ago
|
TQString m_fileName;
|
||
15 years ago
|
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:
|
||
15 years ago
|
Private( const TQString &url, const TQString &selection )
|
||
15 years ago
|
: m_url(url), m_selection(selection)
|
||
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString m_url;
|
||
|
TQString m_selection;
|
||
15 years ago
|
};
|
||
|
|
||
15 years ago
|
DocumentationContext::DocumentationContext( const TQString &url, const TQString &selection )
|
||
15 years ago
|
: 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;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString DocumentationContext::url() const
|
||
15 years ago
|
{
|
||
|
return d->m_url;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString DocumentationContext::selection() const
|
||
15 years ago
|
{
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
|
||
|
///////////////////////////////////////////////////////////////////////////////
|
||
11 years ago
|
// class TDevCore
|
||
15 years ago
|
///////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
11 years ago
|
TDevCore::TDevCore( TQObject *parent, const char *name )
|
||
14 years ago
|
: TQObject( parent, name )
|
||
15 years ago
|
{
|
||
11 years ago
|
new TDevCoreIface(this);
|
||
15 years ago
|
}
|
||
|
|
||
11 years ago
|
TDevCore::~TDevCore()
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
11 years ago
|
#include "tdevcore.moc"
|