• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • TDevelop Interfaces Library
 

TDevelop Interfaces Library

  • lib
  • interfaces
kdevcore.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
3 Copyright (C) 2002-2003 Roberto Raggi <roberto@kdevelop.org>
4 Copyright (C) 2003 Mario Scalas <mario.scalas@libero.it>
5 Copyright (C) 2003 Amilcar do Carmo Lucas <amilcar@ida.ing.tu-bs.de>
6 Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
7 Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23*/
24#include "KDevCoreIface.h"
25#include "kdevcore.h"
26
27#include "urlutil.h"
28
30// class Context
32
33Context::Context()
34{
35}
36
37Context::~Context()
38{
39}
40
41bool Context::hasType( int aType ) const
42{
43 return aType == this->type();
44}
45
47// class EditorContext
49
50class EditorContext::Private
51{
52public:
53 Private( const KURL &url, int line, int col, const TQString &linestr,
54 const TQString &wordstr )
55 : m_url(url), m_line(line), m_col(col),
56 m_linestr(linestr), m_wordstr(wordstr)
57 {
58 }
59
60 KURL m_url;
61 int m_line, m_col;
62 TQString m_linestr, m_wordstr;
63};
64
65EditorContext::EditorContext( const KURL &url, int line, int col,
66 const TQString &linestr, const TQString &wordstr )
67 : Context(), d( new Private(url, line, col, linestr, wordstr) )
68{
69}
70
71EditorContext::~EditorContext()
72{
73 delete d;
74 d = 0;
75}
76
77int EditorContext::type() const
78{
79 return Context::EditorContext;
80}
81
82const KURL &EditorContext::url() const
83{
84 return d->m_url;
85}
86
87int EditorContext::line() const
88{
89 return d->m_line;
90}
91
92int EditorContext::col() const
93{
94 return d->m_col;
95}
96
97TQString EditorContext::currentLine() const
98{
99 return d->m_linestr;
100}
101
102TQString EditorContext::currentWord() const
103{
104 return d->m_wordstr;
105}
106
108// class FileContext
110
111class FileContext::Private
112{
113public:
114 Private( const KURL::List &someURLs ) : m_urls(someURLs)
115 {
116 if (m_urls.count() == 0)
117 {
118 m_fileName = "INVALID-FILENAME";
119 m_isDirectory = false; // well, "true" should be ok too ...
120 }
121 else
122 {
123 m_fileName = m_urls[0].path();
124 m_isDirectory = URLUtil::isDirectory( m_urls[0] );
125 }
126 }
127 Private( const TQString &fileName, bool isDirectory )
128 : m_fileName(fileName), m_isDirectory(isDirectory)
129 {
130 }
131
132 KURL::List m_urls;
134 // parts should be modified to comply with this change.
135 TQString m_fileName;
136 bool m_isDirectory;
137};
138
139FileContext::FileContext( const KURL::List &someURLs )
140 : Context(), d( new Private(someURLs) )
141{
142}
143
144FileContext::~FileContext()
145{
146 delete d;
147 d = 0;
148}
149
150int FileContext::type() const
151{
152 return Context::FileContext;
153}
154
155const KURL::List &FileContext::urls() const
156{
157 return d->m_urls;
158}
159
161// class DocumentationContext
163
164class DocumentationContext::Private
165{
166public:
167 Private( const TQString &url, const TQString &selection )
168 : m_url(url), m_selection(selection)
169 {
170 }
171
172 TQString m_url;
173 TQString m_selection;
174};
175
176DocumentationContext::DocumentationContext( const TQString &url, const TQString &selection )
177 : Context(), d( new Private(url, selection) )
178{
179}
180
181DocumentationContext::DocumentationContext( const DocumentationContext &aContext )
182 : Context(), d( 0 )
183{
184 *this = aContext;
185}
186
187DocumentationContext &DocumentationContext::operator=( const DocumentationContext &aContext)
188{
189 if (d) {
190 delete d; d = 0;
191 }
192 d = new Private( *aContext.d );
193 return *this;
194}
195
196DocumentationContext::~DocumentationContext()
197{
198 delete d;
199 d = 0;
200}
201
202int DocumentationContext::type() const
203{
204 return Context::DocumentationContext;
205}
206
207TQString DocumentationContext::url() const
208{
209 return d->m_url;
210}
211
212TQString DocumentationContext::selection() const
213{
214 return d->m_selection;
215}
216
218// class CodeModelItemContext
220
221class CodeModelItemContext::Private
222{
223public:
224 Private( const CodeModelItem* item ) : m_item( item ) {}
225
226 const CodeModelItem* m_item;
227};
228
229CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item )
230 : Context(), d( new Private(item) )
231{
232}
233
234CodeModelItemContext::~CodeModelItemContext()
235{
236 delete d;
237 d = 0;
238}
239
240int CodeModelItemContext::type() const
241{
242 return Context::CodeModelItemContext;
243}
244
245const CodeModelItem* CodeModelItemContext::item() const
246{
247 return d->m_item;
248}
249
251// class ProjectModelItemContext
253
254class ProjectModelItemContext::Private
255{
256public:
257 Private( const ProjectModelItem* item ) : m_item( item ) {}
258
259 const ProjectModelItem* m_item;
260};
261
262ProjectModelItemContext::ProjectModelItemContext( const ProjectModelItem* item )
263 : Context(), d( new Private(item) )
264{
265}
266
267ProjectModelItemContext::~ProjectModelItemContext()
268{
269 delete d;
270 d = 0;
271}
272
273int ProjectModelItemContext::type() const
274{
275 return Context::ProjectModelItemContext;
276}
277
278const ProjectModelItem* ProjectModelItemContext::item() const
279{
280 return d->m_item;
281}
282
283
285// class KDevCore
287
288KDevCore::KDevCore( TQObject *parent, const char *name )
289 : TQObject( parent, name )
290{
291 new KDevCoreIface(this);
292}
293
294KDevCore::~KDevCore()
295{
296}
297
298#include "kdevcore.moc"
CodeModelItemContext::item
const CodeModelItem * item() const
Definition kdevcore.cpp:245
CodeModelItemContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition kdevcore.cpp:240
CodeModelItemContext::~CodeModelItemContext
virtual ~CodeModelItemContext()
Destructor.
Definition kdevcore.cpp:234
CodeModelItem
Item in code model (symbol store).
Definition codemodel.h:462
Context::hasType
virtual bool hasType(int type) const
Definition kdevcore.cpp:41
Context::~Context
virtual ~Context()
Destructor.
Definition kdevcore.cpp:37
Context::Context
Context()
Constructor.
Definition kdevcore.cpp:33
Context::type
virtual int type() const =0
Implement this in the context so we can provide rtti.
Context::EditorContext
@ EditorContext
Editor context menu.
Definition kdevcore.h:108
Context::FileContext
@ FileContext
File context menu.
Definition kdevcore.h:110
Context::DocumentationContext
@ DocumentationContext
Documentation browser context menu.
Definition kdevcore.h:109
Context::ProjectModelItemContext
@ ProjectModelItemContext
Project tree context menu.
Definition kdevcore.h:111
Context::CodeModelItemContext
@ CodeModelItemContext
Class tree context menu.
Definition kdevcore.h:112
DocumentationContext
A context for the popup menu in the documentation browser widget.
Definition kdevcore.h:178
DocumentationContext::DocumentationContext
DocumentationContext(const TQString &url, const TQString &selection)
Builds a DocumentationContext.
Definition kdevcore.cpp:176
DocumentationContext::selection
TQString selection() const
Definition kdevcore.cpp:212
DocumentationContext::~DocumentationContext
virtual ~DocumentationContext()
Destructor.
Definition kdevcore.cpp:196
DocumentationContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition kdevcore.cpp:202
DocumentationContext::url
TQString url() const
Definition kdevcore.cpp:207
EditorContext::url
const KURL & url() const
Definition kdevcore.cpp:82
EditorContext::col
int col() const
Definition kdevcore.cpp:92
EditorContext::line
int line() const
Definition kdevcore.cpp:87
EditorContext::currentWord
TQString currentWord() const
Definition kdevcore.cpp:102
EditorContext::~EditorContext
virtual ~EditorContext()
Destructor.
Definition kdevcore.cpp:71
EditorContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition kdevcore.cpp:77
EditorContext::currentLine
TQString currentLine() const
Definition kdevcore.cpp:97
FileContext::urls
const KURL::List & urls() const
Definition kdevcore.cpp:155
FileContext::~FileContext
virtual ~FileContext()
Destructor.
Definition kdevcore.cpp:144
FileContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition kdevcore.cpp:150
KDevCore::KDevCore
KDevCore(TQObject *parent=0, const char *name=0)
Constructor.
Definition kdevcore.cpp:288
KDevCore::~KDevCore
virtual ~KDevCore()
Destructor.
Definition kdevcore.cpp:294
ProjectModelItemContext::~ProjectModelItemContext
virtual ~ProjectModelItemContext()
Destructor.
Definition kdevcore.cpp:267
ProjectModelItemContext::item
const ProjectModelItem * item() const
Definition kdevcore.cpp:278
ProjectModelItemContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition kdevcore.cpp:273
kdevcore.h
The interface to the application core and context menu classes.

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for TDevelop Interfaces Library by doxygen 1.15.0
This website is maintained by Timothy Pearson.