• 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 
33 Context::Context()
34 {
35 }
36 
37 Context::~Context()
38 {
39 }
40 
41 bool Context::hasType( int aType ) const
42 {
43  return aType == this->type();
44 }
45 
47 // class EditorContext
49 
50 class EditorContext::Private
51 {
52 public:
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 
65 EditorContext::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 
71 EditorContext::~EditorContext()
72 {
73  delete d;
74  d = 0;
75 }
76 
77 int EditorContext::type() const
78 {
79  return Context::EditorContext;
80 }
81 
82 const KURL &EditorContext::url() const
83 {
84  return d->m_url;
85 }
86 
87 int EditorContext::line() const
88 {
89  return d->m_line;
90 }
91 
92 int EditorContext::col() const
93 {
94  return d->m_col;
95 }
96 
97 TQString EditorContext::currentLine() const
98 {
99  return d->m_linestr;
100 }
101 
102 TQString EditorContext::currentWord() const
103 {
104  return d->m_wordstr;
105 }
106 
108 // class FileContext
110 
111 class FileContext::Private
112 {
113 public:
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 
139 FileContext::FileContext( const KURL::List &someURLs )
140  : Context(), d( new Private(someURLs) )
141 {
142 }
143 
144 FileContext::~FileContext()
145 {
146  delete d;
147  d = 0;
148 }
149 
150 int FileContext::type() const
151 {
152  return Context::FileContext;
153 }
154 
155 const KURL::List &FileContext::urls() const
156 {
157  return d->m_urls;
158 }
159 
161 // class DocumentationContext
163 
164 class DocumentationContext::Private
165 {
166 public:
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 
176 DocumentationContext::DocumentationContext( const TQString &url, const TQString &selection )
177  : Context(), d( new Private(url, selection) )
178 {
179 }
180 
181 DocumentationContext::DocumentationContext( const DocumentationContext &aContext )
182  : Context(), d( 0 )
183 {
184  *this = aContext;
185 }
186 
187 DocumentationContext &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 
196 DocumentationContext::~DocumentationContext()
197 {
198  delete d;
199  d = 0;
200 }
201 
202 int DocumentationContext::type() const
203 {
204  return Context::DocumentationContext;
205 }
206 
207 TQString DocumentationContext::url() const
208 {
209  return d->m_url;
210 }
211 
212 TQString DocumentationContext::selection() const
213 {
214  return d->m_selection;
215 }
216 
218 // class CodeModelItemContext
220 
221 class CodeModelItemContext::Private
222 {
223 public:
224  Private( const CodeModelItem* item ) : m_item( item ) {}
225 
226  const CodeModelItem* m_item;
227 };
228 
229 CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item )
230  : Context(), d( new Private(item) )
231 {
232 }
233 
234 CodeModelItemContext::~CodeModelItemContext()
235 {
236  delete d;
237  d = 0;
238 }
239 
240 int CodeModelItemContext::type() const
241 {
242  return Context::CodeModelItemContext;
243 }
244 
245 const CodeModelItem* CodeModelItemContext::item() const
246 {
247  return d->m_item;
248 }
249 
251 // class ProjectModelItemContext
253 
254 class ProjectModelItemContext::Private
255 {
256 public:
257  Private( const ProjectModelItem* item ) : m_item( item ) {}
258 
259  const ProjectModelItem* m_item;
260 };
261 
262 ProjectModelItemContext::ProjectModelItemContext( const ProjectModelItem* item )
263  : Context(), d( new Private(item) )
264 {
265 }
266 
267 ProjectModelItemContext::~ProjectModelItemContext()
268 {
269  delete d;
270  d = 0;
271 }
272 
273 int ProjectModelItemContext::type() const
274 {
275  return Context::ProjectModelItemContext;
276 }
277 
278 const ProjectModelItem* ProjectModelItemContext::item() const
279 {
280  return d->m_item;
281 }
282 
283 
285 // class KDevCore
287 
288 KDevCore::KDevCore( TQObject *parent, const char *name )
289  : TQObject( parent, name )
290 {
291  new KDevCoreIface(this);
292 }
293 
294 KDevCore::~KDevCore()
295 {
296 }
297 
298 #include "kdevcore.moc"
ProjectModelItemContext::item
const ProjectModelItem * item() const
Definition: kdevcore.cpp:278
Context::type
virtual int type() const =0
Implement this in the context so we can provide rtti.
EditorContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition: kdevcore.cpp:77
EditorContext::~EditorContext
virtual ~EditorContext()
Destructor.
Definition: kdevcore.cpp:71
DocumentationContext::DocumentationContext
DocumentationContext(const TQString &url, const TQString &selection)
Builds a DocumentationContext.
Definition: kdevcore.cpp:176
ProjectModelItemContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition: kdevcore.cpp:273
Context
Base class for every context.
Definition: kdevcore.h:100
DocumentationContext
A context for the popup menu in the documentation browser widget.
Definition: kdevcore.h:177
CodeModelItemContext::~CodeModelItemContext
virtual ~CodeModelItemContext()
Destructor.
Definition: kdevcore.cpp:234
EditorContext::url
const KURL & url() const
Definition: kdevcore.cpp:82
CodeModelItemContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition: kdevcore.cpp:240
Context::DocumentationContext
Documentation browser context menu.
Definition: kdevcore.h:109
FileContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition: kdevcore.cpp:150
KDevCore::~KDevCore
virtual ~KDevCore()
Destructor.
Definition: kdevcore.cpp:294
Context::~Context
virtual ~Context()
Destructor.
Definition: kdevcore.cpp:37
kdevcore.h
The interface to the application core and context menu classes.
ProjectModelItemContext::ProjectModelItemContext
ProjectModelItemContext(const ProjectModelItem *item)
Builds the context.
Definition: kdevcore.cpp:262
EditorContext::currentWord
TQString currentWord() const
Definition: kdevcore.cpp:102
EditorContext::EditorContext
EditorContext(const KURL &url, int line, int col, const TQString &linestr, const TQString &wordstr)
Builds a context for an editor part.
Definition: kdevcore.cpp:65
FileContext::~FileContext
virtual ~FileContext()
Destructor.
Definition: kdevcore.cpp:144
Context::hasType
virtual bool hasType(int type) const
Definition: kdevcore.cpp:41
CodeModelItemContext::CodeModelItemContext
CodeModelItemContext(const CodeModelItem *item)
Builds the context.
Definition: kdevcore.cpp:229
CodeModelItemContext::item
const CodeModelItem * item() const
Definition: kdevcore.cpp:245
Context::CodeModelItemContext
Class tree context menu.
Definition: kdevcore.h:112
EditorContext::currentLine
TQString currentLine() const
Definition: kdevcore.cpp:97
KDevCore::KDevCore
KDevCore(TQObject *parent=0, const char *name=0)
Constructor.
Definition: kdevcore.cpp:288
FileContext::urls
const KURL::List & urls() const
Definition: kdevcore.cpp:155
EditorContext::col
int col() const
Definition: kdevcore.cpp:92
CodeModelItem
Item in code model (symbol store).
Definition: codemodel.h:461
Context::FileContext
File context menu.
Definition: kdevcore.h:110
Context::Context
Context()
Constructor.
Definition: kdevcore.cpp:33
ProjectModelItemContext::~ProjectModelItemContext
virtual ~ProjectModelItemContext()
Destructor.
Definition: kdevcore.cpp:267
Context::ProjectModelItemContext
Project tree context menu.
Definition: kdevcore.h:111
Context::EditorContext
Editor context menu.
Definition: kdevcore.h:108
FileContext::FileContext
FileContext(const KURL::List &someURLs)
Builds the file context using a KURL::List.
Definition: kdevcore.cpp:139
DocumentationContext::type
virtual int type() const
Implement this in the context so we can provide rtti.
Definition: kdevcore.cpp:202
DocumentationContext::~DocumentationContext
virtual ~DocumentationContext()
Destructor.
Definition: kdevcore.cpp:196
EditorContext::line
int line() const
Definition: kdevcore.cpp:87
DocumentationContext::selection
TQString selection() const
Definition: kdevcore.cpp:212
DocumentationContext::url
TQString url() const
Definition: kdevcore.cpp:207

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.8.13
This website is maintained by Timothy Pearson.