1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
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., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, 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 TQString &linestr,
const TQString &wordstr )
: m_url(url), m_line(line), m_col(col),
m_linestr(linestr), m_wordstr(wordstr)
{
}
KURL m_url;
int m_line, m_col;
TQString m_linestr, m_wordstr;
};
EditorContext::EditorContext( const KURL &url, int line, int col,
const TQString &linestr, const TQString &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;
}
TQString EditorContext::currentLine() const
{
return d->m_linestr;
}
TQString 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 TQString &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.
TQString 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 TQString &url, const TQString &selection )
: m_url(url), m_selection(selection)
{
}
TQString m_url;
TQString m_selection;
};
DocumentationContext::DocumentationContext( const TQString &url, const TQString &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;
}
TQString DocumentationContext::url() const
{
return d->m_url;
}
TQString 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( TQObject *parent, const char *name )
: TQObject( parent, name )
{
new KDevCoreIface(this);
}
KDevCore::~KDevCore()
{
}
#include "kdevcore.moc"
|