1
|
1 /****************************************************************************
|
|
2 **
|
|
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved.
|
|
4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
|
|
5 **
|
|
6 ** This file is part of Qt Jambi.
|
|
7 **
|
|
8 ** * Commercial Usage
|
|
9 * Licensees holding valid Qt Commercial licenses may use this file in
|
|
10 * accordance with the Qt Commercial License Agreement provided with the
|
|
11 * Software or, alternatively, in accordance with the terms contained in
|
|
12 * a written agreement between you and Nokia.
|
|
13 *
|
|
14 *
|
|
15 * GNU General Public License Usage
|
|
16 * Alternatively, this file may be used under the terms of the GNU
|
|
17 * General Public License versions 2.0 or 3.0 as published by the Free
|
|
18 * Software Foundation and appearing in the file LICENSE.GPL included in
|
|
19 * the packaging of this file. Please review the following information
|
|
20 * to ensure GNU General Public Licensing requirements will be met:
|
|
21 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
22 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
|
23 * exception, Nokia gives you certain additional rights. These rights
|
|
24 * are described in the Nokia Qt GPL Exception version 1.2, included in
|
|
25 * the file GPL_EXCEPTION.txt in this package.
|
|
26 *
|
|
27 * Qt for Windows(R) Licensees
|
|
28 * As a special exception, Nokia, as the sole copyright holder for Qt
|
|
29 * Designer, grants users of the Qt/Eclipse Integration plug-in the
|
|
30 * right for the Qt/Eclipse Integration to link to functionality
|
|
31 * provided by Qt Designer and its related libraries.
|
|
32 *
|
|
33 *
|
|
34 * If you are unsure which license is appropriate for your use, please
|
|
35 * contact the sales department at qt-sales@nokia.com.
|
|
36
|
|
37 **
|
|
38 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
39 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
40 **
|
|
41 ****************************************************************************/
|
|
42
|
|
43
|
|
44 #include "codemodel.h"
|
|
45
|
|
46 // ---------------------------------------------------------------------------
|
|
47 CodeModel::CodeModel()
|
|
48 : _M_creation_id(0)
|
|
49 {
|
|
50 _M_globalNamespace = create<NamespaceModelItem>();
|
|
51 }
|
|
52
|
|
53 CodeModel::~CodeModel()
|
|
54 {
|
|
55 }
|
|
56
|
|
57 void CodeModel::wipeout()
|
|
58 {
|
|
59 _M_globalNamespace = create<NamespaceModelItem>();
|
|
60 _M_files.clear();
|
|
61 }
|
|
62
|
|
63 FileList CodeModel::files() const
|
|
64 {
|
|
65 return _M_files.values();
|
|
66 }
|
|
67
|
|
68 NamespaceModelItem CodeModel::globalNamespace() const
|
|
69 {
|
|
70 return _M_globalNamespace;
|
|
71 }
|
|
72
|
|
73 void CodeModel::addFile(FileModelItem item)
|
|
74 {
|
|
75 _M_creation_id = 0; // reset the creation id
|
|
76 _M_files.insert(item->name(), item);
|
|
77 }
|
|
78
|
|
79 void CodeModel::removeFile(FileModelItem item)
|
|
80 {
|
|
81 QHash<QString, FileModelItem>::Iterator it = _M_files.find(item->name());
|
|
82
|
|
83 if (it != _M_files.end() && it.value() == item)
|
|
84 _M_files.erase(it);
|
|
85 }
|
|
86
|
|
87 FileModelItem CodeModel::findFile(const QString &name) const
|
|
88 {
|
|
89 return _M_files.value(name);
|
|
90 }
|
|
91
|
|
92 QHash<QString, FileModelItem> CodeModel::fileMap() const
|
|
93 {
|
|
94 return _M_files;
|
|
95 }
|
|
96
|
|
97 CodeModelItem CodeModel::findItem(const QStringList &qualifiedName, CodeModelItem scope) const
|
|
98 {
|
|
99 for (int i=0; i<qualifiedName.size(); ++i) {
|
|
100 // ### Extend to look for members etc too.
|
|
101 const QString &name = qualifiedName.at(i);
|
|
102
|
|
103 if (NamespaceModelItem ns = model_dynamic_cast<NamespaceModelItem>(scope))
|
|
104 {
|
|
105 if (NamespaceModelItem tmp_ns = ns->findNamespace(name)) {
|
|
106 scope = tmp_ns;
|
|
107 continue;
|
|
108 }
|
|
109 }
|
|
110
|
|
111 if (ScopeModelItem ss = model_dynamic_cast<ScopeModelItem>(scope))
|
|
112 {
|
|
113 if (ClassModelItem cs = ss->findClass(name))
|
|
114 {
|
|
115 scope = cs;
|
|
116 }
|
|
117 else if (EnumModelItem es = ss->findEnum(name))
|
|
118 {
|
|
119 if (i == qualifiedName.size () - 1)
|
|
120 return es->toItem();
|
|
121 }
|
|
122 else if (TypeAliasModelItem tp = ss->findTypeAlias(name))
|
|
123 {
|
|
124 if (i == qualifiedName.size () - 1)
|
|
125 return tp->toItem ();
|
|
126 }
|
|
127 else
|
|
128 {
|
|
129 // If we don't find the name in the scope chain we
|
|
130 // need to return an empty item to indicate failure...
|
|
131 return CodeModelItem();
|
|
132 }
|
|
133 }
|
|
134 }
|
|
135
|
|
136 return scope;
|
|
137 }
|
|
138
|
|
139
|
|
140 // ---------------------------------------------------------------------------
|
|
141 TypeInfo TypeInfo::combine (const TypeInfo &__lhs, const TypeInfo &__rhs)
|
|
142 {
|
|
143 TypeInfo __result = __lhs;
|
|
144
|
|
145 __result.setConstant (__result.isConstant () || __rhs.isConstant ());
|
|
146 __result.setVolatile (__result.isVolatile () || __rhs.isVolatile ());
|
|
147 __result.setReference (__result.isReference () || __rhs.isReference ());
|
|
148 __result.setIndirections (__result.indirections () + __rhs.indirections ());
|
|
149 __result.setArrayElements (__result.arrayElements () + __rhs.arrayElements ());
|
|
150
|
|
151 return __result;
|
|
152 }
|
|
153
|
|
154 TypeInfo TypeInfo::resolveType (TypeInfo const &__type, CodeModelItem __scope)
|
|
155 {
|
|
156 CodeModel *__model = __scope->model ();
|
|
157 Q_ASSERT (__model != 0);
|
|
158
|
|
159 CodeModelItem __item = __model->findItem (__type.qualifiedName (), __scope);
|
|
160
|
|
161 // Copy the type and replace with the proper qualified name. This
|
|
162 // only makes sence to do if we're actually getting a resolved
|
|
163 // type with a namespace. We only get this if the returned type
|
|
164 // has more than 2 entries in the qualified name... This test
|
|
165 // could be improved by returning if the type was found or not.
|
|
166 TypeInfo otherType(__type);
|
|
167 if (__item && __item->qualifiedName().size() > 1) {
|
|
168 otherType.setQualifiedName(__item->qualifiedName());
|
|
169 }
|
|
170
|
|
171 if (TypeAliasModelItem __alias = model_dynamic_cast<TypeAliasModelItem> (__item))
|
|
172 return resolveType (TypeInfo::combine (__alias->type (), otherType), __scope);
|
|
173
|
|
174 return otherType;
|
|
175 }
|
|
176
|
|
177 QString TypeInfo::toString() const
|
|
178 {
|
|
179 QString tmp;
|
|
180
|
|
181 tmp += m_qualifiedName.join("::");
|
|
182 if (isConstant())
|
|
183 tmp += QLatin1String(" const");
|
|
184
|
|
185 if (isVolatile())
|
|
186 tmp += QLatin1String(" volatile");
|
|
187
|
|
188 if (indirections())
|
|
189 tmp += QString(indirections(), QLatin1Char('*'));
|
|
190
|
|
191 if (isReference())
|
|
192 tmp += QLatin1Char('&');
|
|
193
|
|
194 if (isFunctionPointer())
|
|
195 {
|
|
196 tmp += QLatin1String(" (*)(");
|
|
197 for (int i=0; i<m_arguments.count(); ++i)
|
|
198 {
|
|
199 if (i != 0)
|
|
200 tmp += QLatin1String(", ");
|
|
201
|
|
202 tmp += m_arguments.at(i).toString();
|
|
203 }
|
|
204 tmp += QLatin1String(")");
|
|
205 }
|
|
206
|
|
207 foreach (QString elt, arrayElements ())
|
|
208 {
|
|
209 tmp += QLatin1String ("[");
|
|
210 tmp += elt;
|
|
211 tmp += QLatin1String ("]");
|
|
212 }
|
|
213
|
|
214 return tmp;
|
|
215 }
|
|
216
|
|
217 bool TypeInfo::operator==(const TypeInfo &other)
|
|
218 {
|
|
219 if (arrayElements().count() != other.arguments().count())
|
|
220 return false;
|
|
221
|
|
222 #if defined (RXX_CHECK_ARRAY_ELEMENTS) // ### it'll break
|
|
223 for (int i=0; i<arrayElements().count(); ++i)
|
|
224 {
|
|
225 QString elt1 = arrayElements ().at (i).trimmed ();
|
|
226 QString elt2 = other.arrayElements ().at (i).trimmed ();
|
|
227
|
|
228 if (elt1 != elt2)
|
|
229 return false;
|
|
230 }
|
|
231 #endif
|
|
232
|
|
233 return flags == other.flags
|
|
234 && m_qualifiedName == other.m_qualifiedName
|
|
235 && (!m_functionPointer || m_arguments == other.m_arguments);
|
|
236 }
|
|
237
|
|
238 // ---------------------------------------------------------------------------
|
|
239 _CodeModelItem::_CodeModelItem(CodeModel *model, int kind)
|
|
240 : _M_model(model),
|
|
241 _M_kind(kind),
|
|
242 _M_startLine(0),
|
|
243 _M_startColumn(0),
|
|
244 _M_endLine(0),
|
|
245 _M_endColumn(0),
|
|
246 _M_creation_id(0)
|
|
247 {
|
|
248 }
|
|
249
|
|
250 _CodeModelItem::~_CodeModelItem()
|
|
251 {
|
|
252 }
|
|
253
|
|
254 CodeModelItem _CodeModelItem::toItem() const
|
|
255 {
|
|
256 return CodeModelItem(const_cast<_CodeModelItem*>(this));
|
|
257 }
|
|
258
|
|
259 int _CodeModelItem::kind() const
|
|
260 {
|
|
261 return _M_kind;
|
|
262 }
|
|
263
|
|
264 void _CodeModelItem::setKind(int kind)
|
|
265 {
|
|
266 _M_kind = kind;
|
|
267 }
|
|
268
|
|
269 QStringList _CodeModelItem::qualifiedName() const
|
|
270 {
|
|
271 QStringList q = scope();
|
|
272
|
|
273 if (!name().isEmpty())
|
|
274 q += name();
|
|
275
|
|
276 return q;
|
|
277 }
|
|
278
|
|
279 QString _CodeModelItem::name() const
|
|
280 {
|
|
281 return _M_name;
|
|
282 }
|
|
283
|
|
284 void _CodeModelItem::setName(const QString &name)
|
|
285 {
|
|
286 _M_name = name;
|
|
287 }
|
|
288
|
|
289 QStringList _CodeModelItem::scope() const
|
|
290 {
|
|
291 return _M_scope;
|
|
292 }
|
|
293
|
|
294 void _CodeModelItem::setScope(const QStringList &scope)
|
|
295 {
|
|
296 _M_scope = scope;
|
|
297 }
|
|
298
|
|
299 QString _CodeModelItem::fileName() const
|
|
300 {
|
|
301 return _M_fileName;
|
|
302 }
|
|
303
|
|
304 void _CodeModelItem::setFileName(const QString &fileName)
|
|
305 {
|
|
306 _M_fileName = fileName;
|
|
307 }
|
|
308
|
|
309 FileModelItem _CodeModelItem::file() const
|
|
310 {
|
|
311 return model()->findFile(fileName());
|
|
312 }
|
|
313
|
|
314 void _CodeModelItem::getStartPosition(int *line, int *column)
|
|
315 {
|
|
316 *line = _M_startLine;
|
|
317 *column = _M_startColumn;
|
|
318 }
|
|
319
|
|
320 void _CodeModelItem::setStartPosition(int line, int column)
|
|
321 {
|
|
322 _M_startLine = line;
|
|
323 _M_startColumn = column;
|
|
324 }
|
|
325
|
|
326 void _CodeModelItem::getEndPosition(int *line, int *column)
|
|
327 {
|
|
328 *line = _M_endLine;
|
|
329 *column = _M_endColumn;
|
|
330 }
|
|
331
|
|
332 void _CodeModelItem::setEndPosition(int line, int column)
|
|
333 {
|
|
334 _M_endLine = line;
|
|
335 _M_endColumn = column;
|
|
336 }
|
|
337
|
|
338 // ---------------------------------------------------------------------------
|
|
339 QStringList _ClassModelItem::baseClasses() const
|
|
340 {
|
|
341 return _M_baseClasses;
|
|
342 }
|
|
343
|
|
344 void _ClassModelItem::setBaseClasses(const QStringList &baseClasses)
|
|
345 {
|
|
346 _M_baseClasses = baseClasses;
|
|
347 }
|
|
348
|
|
349 TemplateParameterList _ClassModelItem::templateParameters() const
|
|
350 {
|
|
351 return _M_templateParameters;
|
|
352 }
|
|
353
|
|
354 void _ClassModelItem::setTemplateParameters(const TemplateParameterList &templateParameters)
|
|
355 {
|
|
356 _M_templateParameters = templateParameters;
|
|
357 }
|
|
358
|
|
359 void _ClassModelItem::addBaseClass(const QString &baseClass)
|
|
360 {
|
|
361 _M_baseClasses.append(baseClass);
|
|
362 }
|
|
363
|
|
364 void _ClassModelItem::removeBaseClass(const QString &baseClass)
|
|
365 {
|
|
366 _M_baseClasses.removeAt(_M_baseClasses.indexOf(baseClass));
|
|
367 }
|
|
368
|
|
369 bool _ClassModelItem::extendsClass(const QString &name) const
|
|
370 {
|
|
371 return _M_baseClasses.contains(name);
|
|
372 }
|
|
373
|
|
374 void _ClassModelItem::setClassType(CodeModel::ClassType type)
|
|
375 {
|
|
376 _M_classType = type;
|
|
377 }
|
|
378
|
|
379 CodeModel::ClassType _ClassModelItem::classType() const
|
|
380 {
|
|
381 return _M_classType;
|
|
382 }
|
|
383
|
|
384 void _ClassModelItem::addPropertyDeclaration(const QString &propertyDeclaration)
|
|
385 {
|
|
386 _M_propertyDeclarations << propertyDeclaration;
|
|
387 }
|
|
388
|
|
389
|
|
390 // ---------------------------------------------------------------------------
|
|
391 FunctionModelItem _ScopeModelItem::declaredFunction(FunctionModelItem item)
|
|
392 {
|
|
393 FunctionList function_list = findFunctions(item->name());
|
|
394
|
|
395 foreach (FunctionModelItem fun, function_list)
|
|
396 {
|
|
397 if (fun->isSimilar(item))
|
|
398 return fun;
|
|
399 }
|
|
400
|
|
401 return FunctionModelItem();
|
|
402 }
|
|
403
|
|
404 ClassList _ScopeModelItem::classes() const
|
|
405 {
|
|
406 return _M_classes.values();
|
|
407 }
|
|
408
|
|
409 TypeAliasList _ScopeModelItem::typeAliases() const
|
|
410 {
|
|
411 return _M_typeAliases.values();
|
|
412 }
|
|
413
|
|
414 VariableList _ScopeModelItem::variables() const
|
|
415 {
|
|
416 return _M_variables.values();
|
|
417 }
|
|
418
|
|
419 FunctionList _ScopeModelItem::functions() const
|
|
420 {
|
|
421 return _M_functions.values();
|
|
422 }
|
|
423
|
|
424 void _ScopeModelItem::addEnumsDeclaration(const QString &enumsDeclaration)
|
|
425 {
|
|
426 _M_enumsDeclarations << enumsDeclaration;
|
|
427 }
|
|
428
|
|
429 FunctionDefinitionList _ScopeModelItem::functionDefinitions() const
|
|
430 {
|
|
431 return _M_functionDefinitions.values();
|
|
432 }
|
|
433
|
|
434 EnumList _ScopeModelItem::enums() const
|
|
435 {
|
|
436 return _M_enums.values();
|
|
437 }
|
|
438
|
|
439 void _ScopeModelItem::addClass(ClassModelItem item)
|
|
440 {
|
|
441 QString name = item->name();
|
|
442 int idx = name.indexOf("<");
|
|
443 if (idx > 0)
|
|
444 _M_classes.insert(name.left(idx), item);
|
|
445 _M_classes.insert(name, item);
|
|
446 }
|
|
447
|
|
448 void _ScopeModelItem::addFunction(FunctionModelItem item)
|
|
449 {
|
|
450 _M_functions.insert(item->name(), item);
|
|
451 }
|
|
452
|
|
453 void _ScopeModelItem::addFunctionDefinition(FunctionDefinitionModelItem item)
|
|
454 {
|
|
455 _M_functionDefinitions.insert(item->name(), item);
|
|
456 }
|
|
457
|
|
458 void _ScopeModelItem::addVariable(VariableModelItem item)
|
|
459 {
|
|
460 _M_variables.insert(item->name(), item);
|
|
461 }
|
|
462
|
|
463 void _ScopeModelItem::addTypeAlias(TypeAliasModelItem item)
|
|
464 {
|
|
465 _M_typeAliases.insert(item->name(), item);
|
|
466 }
|
|
467
|
|
468 void _ScopeModelItem::addEnum(EnumModelItem item)
|
|
469 {
|
|
470 _M_enums.insert(item->name(), item);
|
|
471 }
|
|
472
|
|
473 void _ScopeModelItem::removeClass(ClassModelItem item)
|
|
474 {
|
|
475 QHash<QString, ClassModelItem>::Iterator it = _M_classes.find(item->name());
|
|
476
|
|
477 if (it != _M_classes.end() && it.value() == item)
|
|
478 _M_classes.erase(it);
|
|
479 }
|
|
480
|
|
481 void _ScopeModelItem::removeFunction(FunctionModelItem item)
|
|
482 {
|
|
483 QMultiHash<QString, FunctionModelItem>::Iterator it = _M_functions.find(item->name());
|
|
484
|
|
485 while (it != _M_functions.end() && it.key() == item->name()
|
|
486 && it.value() != item)
|
|
487 {
|
|
488 ++it;
|
|
489 }
|
|
490
|
|
491 if (it != _M_functions.end() && it.value() == item)
|
|
492 {
|
|
493 _M_functions.erase(it);
|
|
494 }
|
|
495 }
|
|
496
|
|
497 void _ScopeModelItem::removeFunctionDefinition(FunctionDefinitionModelItem item)
|
|
498 {
|
|
499 QMultiHash<QString, FunctionDefinitionModelItem>::Iterator it = _M_functionDefinitions.find(item->name());
|
|
500
|
|
501 while (it != _M_functionDefinitions.end() && it.key() == item->name()
|
|
502 && it.value() != item)
|
|
503 {
|
|
504 ++it;
|
|
505 }
|
|
506
|
|
507 if (it != _M_functionDefinitions.end() && it.value() == item)
|
|
508 {
|
|
509 _M_functionDefinitions.erase(it);
|
|
510 }
|
|
511 }
|
|
512
|
|
513 void _ScopeModelItem::removeVariable(VariableModelItem item)
|
|
514 {
|
|
515 QHash<QString, VariableModelItem>::Iterator it = _M_variables.find(item->name());
|
|
516
|
|
517 if (it != _M_variables.end() && it.value() == item)
|
|
518 _M_variables.erase(it);
|
|
519 }
|
|
520
|
|
521 void _ScopeModelItem::removeTypeAlias(TypeAliasModelItem item)
|
|
522 {
|
|
523 QHash<QString, TypeAliasModelItem>::Iterator it = _M_typeAliases.find(item->name());
|
|
524
|
|
525 if (it != _M_typeAliases.end() && it.value() == item)
|
|
526 _M_typeAliases.erase(it);
|
|
527 }
|
|
528
|
|
529 void _ScopeModelItem::removeEnum(EnumModelItem item)
|
|
530 {
|
|
531 QHash<QString, EnumModelItem>::Iterator it = _M_enums.find(item->name());
|
|
532
|
|
533 if (it != _M_enums.end() && it.value() == item)
|
|
534 _M_enums.erase(it);
|
|
535 }
|
|
536
|
|
537 ClassModelItem _ScopeModelItem::findClass(const QString &name) const
|
|
538 {
|
|
539 return _M_classes.value(name);
|
|
540 }
|
|
541
|
|
542 VariableModelItem _ScopeModelItem::findVariable(const QString &name) const
|
|
543 {
|
|
544 return _M_variables.value(name);
|
|
545 }
|
|
546
|
|
547 TypeAliasModelItem _ScopeModelItem::findTypeAlias(const QString &name) const
|
|
548 {
|
|
549 return _M_typeAliases.value(name);
|
|
550 }
|
|
551
|
|
552 EnumModelItem _ScopeModelItem::findEnum(const QString &name) const
|
|
553 {
|
|
554 return _M_enums.value(name);
|
|
555 }
|
|
556
|
|
557 FunctionList _ScopeModelItem::findFunctions(const QString &name) const
|
|
558 {
|
|
559 return _M_functions.values(name);
|
|
560 }
|
|
561
|
|
562 FunctionDefinitionList _ScopeModelItem::findFunctionDefinitions(const QString &name) const
|
|
563 {
|
|
564 return _M_functionDefinitions.values(name);
|
|
565 }
|
|
566
|
|
567 // ---------------------------------------------------------------------------
|
|
568 NamespaceList _NamespaceModelItem::namespaces() const
|
|
569 {
|
|
570 return _M_namespaces.values();
|
|
571 }
|
|
572 void _NamespaceModelItem::addNamespace(NamespaceModelItem item)
|
|
573 {
|
|
574 _M_namespaces.insert(item->name(), item);
|
|
575 }
|
|
576 void _NamespaceModelItem::removeNamespace(NamespaceModelItem item)
|
|
577 {
|
|
578 QHash<QString, NamespaceModelItem>::Iterator it = _M_namespaces.find(item->name());
|
|
579
|
|
580 if (it != _M_namespaces.end() && it.value() == item)
|
|
581 _M_namespaces.erase(it);
|
|
582 }
|
|
583
|
|
584 NamespaceModelItem _NamespaceModelItem::findNamespace(const QString &name) const
|
|
585 {
|
|
586 return _M_namespaces.value(name);
|
|
587 }
|
|
588
|
|
589 // ---------------------------------------------------------------------------
|
|
590 TypeInfo _ArgumentModelItem::type() const
|
|
591 {
|
|
592 return _M_type;
|
|
593 }
|
|
594
|
|
595 void _ArgumentModelItem::setType(const TypeInfo &type)
|
|
596 {
|
|
597 _M_type = type;
|
|
598 }
|
|
599
|
|
600 bool _ArgumentModelItem::defaultValue() const
|
|
601 {
|
|
602 return _M_defaultValue;
|
|
603 }
|
|
604
|
|
605 void _ArgumentModelItem::setDefaultValue(bool defaultValue)
|
|
606 {
|
|
607 _M_defaultValue = defaultValue;
|
|
608 }
|
|
609
|
|
610 // ---------------------------------------------------------------------------
|
|
611 bool _FunctionModelItem::isSimilar(FunctionModelItem other) const
|
|
612 {
|
|
613 if (name() != other->name())
|
|
614 return false;
|
|
615
|
|
616 if (isConstant() != other->isConstant())
|
|
617 return false;
|
|
618
|
|
619 if (isVariadics() != other->isVariadics())
|
|
620 return false;
|
|
621
|
|
622 if (arguments().count() != other->arguments().count())
|
|
623 return false;
|
|
624
|
|
625 // ### check the template parameters
|
|
626
|
|
627 for (int i=0; i<arguments().count(); ++i)
|
|
628 {
|
|
629 ArgumentModelItem arg1 = arguments().at(i);
|
|
630 ArgumentModelItem arg2 = other->arguments().at(i);
|
|
631
|
|
632 if (arg1->type() != arg2->type())
|
|
633 return false;
|
|
634 }
|
|
635
|
|
636 return true;
|
|
637 }
|
|
638
|
|
639 ArgumentList _FunctionModelItem::arguments() const
|
|
640 {
|
|
641 return _M_arguments;
|
|
642 }
|
|
643
|
|
644 void _FunctionModelItem::addArgument(ArgumentModelItem item)
|
|
645 {
|
|
646 _M_arguments.append(item);
|
|
647 }
|
|
648
|
|
649 void _FunctionModelItem::removeArgument(ArgumentModelItem item)
|
|
650 {
|
|
651 _M_arguments.removeAt(_M_arguments.indexOf(item));
|
|
652 }
|
|
653
|
|
654 CodeModel::FunctionType _FunctionModelItem::functionType() const
|
|
655 {
|
|
656 return _M_functionType;
|
|
657 }
|
|
658
|
|
659 void _FunctionModelItem::setFunctionType(CodeModel::FunctionType functionType)
|
|
660 {
|
|
661 _M_functionType = functionType;
|
|
662 }
|
|
663
|
|
664 bool _FunctionModelItem::isVariadics() const
|
|
665 {
|
|
666 return _M_isVariadics;
|
|
667 }
|
|
668
|
|
669 void _FunctionModelItem::setVariadics(bool isVariadics)
|
|
670 {
|
|
671 _M_isVariadics = isVariadics;
|
|
672 }
|
|
673
|
|
674 bool _FunctionModelItem::isVirtual() const
|
|
675 {
|
|
676 return _M_isVirtual;
|
|
677 }
|
|
678
|
|
679 void _FunctionModelItem::setVirtual(bool isVirtual)
|
|
680 {
|
|
681 _M_isVirtual = isVirtual;
|
|
682 }
|
|
683
|
|
684 bool _FunctionModelItem::isInline() const
|
|
685 {
|
|
686 return _M_isInline;
|
|
687 }
|
|
688
|
|
689 void _FunctionModelItem::setInline(bool isInline)
|
|
690 {
|
|
691 _M_isInline = isInline;
|
|
692 }
|
|
693
|
|
694 bool _FunctionModelItem::isExplicit() const
|
|
695 {
|
|
696 return _M_isExplicit;
|
|
697 }
|
|
698
|
|
699 void _FunctionModelItem::setExplicit(bool isExplicit)
|
|
700 {
|
|
701 _M_isExplicit = isExplicit;
|
|
702 }
|
|
703
|
|
704 bool _FunctionModelItem::isAbstract() const
|
|
705 {
|
|
706 return _M_isAbstract;
|
|
707 }
|
|
708
|
|
709 void _FunctionModelItem::setAbstract(bool isAbstract)
|
|
710 {
|
|
711 _M_isAbstract = isAbstract;
|
|
712 }
|
|
713
|
|
714 // Qt
|
|
715 bool _FunctionModelItem::isInvokable() const
|
|
716 {
|
|
717 return _M_isInvokable;
|
|
718 }
|
|
719
|
|
720 void _FunctionModelItem::setInvokable(bool isInvokable)
|
|
721 {
|
|
722 _M_isInvokable = isInvokable;
|
|
723 }
|
|
724
|
|
725 // ---------------------------------------------------------------------------
|
|
726 TypeInfo _TypeAliasModelItem::type() const
|
|
727 {
|
|
728 return _M_type;
|
|
729 }
|
|
730
|
|
731 void _TypeAliasModelItem::setType(const TypeInfo &type)
|
|
732 {
|
|
733 _M_type = type;
|
|
734 }
|
|
735
|
|
736 // ---------------------------------------------------------------------------
|
|
737 CodeModel::AccessPolicy _EnumModelItem::accessPolicy() const
|
|
738 {
|
|
739 return _M_accessPolicy;
|
|
740 }
|
|
741
|
|
742 void _EnumModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy)
|
|
743 {
|
|
744 _M_accessPolicy = accessPolicy;
|
|
745 }
|
|
746
|
|
747 EnumeratorList _EnumModelItem::enumerators() const
|
|
748 {
|
|
749 return _M_enumerators;
|
|
750 }
|
|
751
|
|
752 void _EnumModelItem::addEnumerator(EnumeratorModelItem item)
|
|
753 {
|
|
754 _M_enumerators.append(item);
|
|
755 }
|
|
756
|
|
757 void _EnumModelItem::removeEnumerator(EnumeratorModelItem item)
|
|
758 {
|
|
759 _M_enumerators.removeAt(_M_enumerators.indexOf(item));
|
|
760 }
|
|
761
|
|
762 // ---------------------------------------------------------------------------
|
|
763 QString _EnumeratorModelItem::value() const
|
|
764 {
|
|
765 return _M_value;
|
|
766 }
|
|
767
|
|
768 void _EnumeratorModelItem::setValue(const QString &value)
|
|
769 {
|
|
770 _M_value = value;
|
|
771 }
|
|
772
|
|
773 // ---------------------------------------------------------------------------
|
|
774 TypeInfo _TemplateParameterModelItem::type() const
|
|
775 {
|
|
776 return _M_type;
|
|
777 }
|
|
778
|
|
779 void _TemplateParameterModelItem::setType(const TypeInfo &type)
|
|
780 {
|
|
781 _M_type = type;
|
|
782 }
|
|
783
|
|
784 bool _TemplateParameterModelItem::defaultValue() const
|
|
785 {
|
|
786 return _M_defaultValue;
|
|
787 }
|
|
788
|
|
789 void _TemplateParameterModelItem::setDefaultValue(bool defaultValue)
|
|
790 {
|
|
791 _M_defaultValue = defaultValue;
|
|
792 }
|
|
793
|
|
794 // ---------------------------------------------------------------------------
|
|
795 ScopeModelItem _ScopeModelItem::create(CodeModel *model)
|
|
796 {
|
|
797 ScopeModelItem item(new _ScopeModelItem(model));
|
|
798 return item;
|
|
799 }
|
|
800
|
|
801 ClassModelItem _ClassModelItem::create(CodeModel *model)
|
|
802 {
|
|
803 ClassModelItem item(new _ClassModelItem(model));
|
|
804 return item;
|
|
805 }
|
|
806
|
|
807 NamespaceModelItem _NamespaceModelItem::create(CodeModel *model)
|
|
808 {
|
|
809 NamespaceModelItem item(new _NamespaceModelItem(model));
|
|
810 return item;
|
|
811 }
|
|
812
|
|
813 FileModelItem _FileModelItem::create(CodeModel *model)
|
|
814 {
|
|
815 FileModelItem item(new _FileModelItem(model));
|
|
816 return item;
|
|
817 }
|
|
818
|
|
819 ArgumentModelItem _ArgumentModelItem::create(CodeModel *model)
|
|
820 {
|
|
821 ArgumentModelItem item(new _ArgumentModelItem(model));
|
|
822 return item;
|
|
823 }
|
|
824
|
|
825 FunctionModelItem _FunctionModelItem::create(CodeModel *model)
|
|
826 {
|
|
827 FunctionModelItem item(new _FunctionModelItem(model));
|
|
828 return item;
|
|
829 }
|
|
830
|
|
831 FunctionDefinitionModelItem _FunctionDefinitionModelItem::create(CodeModel *model)
|
|
832 {
|
|
833 FunctionDefinitionModelItem item(new _FunctionDefinitionModelItem(model));
|
|
834 return item;
|
|
835 }
|
|
836
|
|
837 VariableModelItem _VariableModelItem::create(CodeModel *model)
|
|
838 {
|
|
839 VariableModelItem item(new _VariableModelItem(model));
|
|
840 return item;
|
|
841 }
|
|
842
|
|
843 TypeAliasModelItem _TypeAliasModelItem::create(CodeModel *model)
|
|
844 {
|
|
845 TypeAliasModelItem item(new _TypeAliasModelItem(model));
|
|
846 return item;
|
|
847 }
|
|
848
|
|
849 EnumModelItem _EnumModelItem::create(CodeModel *model)
|
|
850 {
|
|
851 EnumModelItem item(new _EnumModelItem(model));
|
|
852 return item;
|
|
853 }
|
|
854
|
|
855 EnumeratorModelItem _EnumeratorModelItem::create(CodeModel *model)
|
|
856 {
|
|
857 EnumeratorModelItem item(new _EnumeratorModelItem(model));
|
|
858 return item;
|
|
859 }
|
|
860
|
|
861 TemplateParameterModelItem _TemplateParameterModelItem::create(CodeModel *model)
|
|
862 {
|
|
863 TemplateParameterModelItem item(new _TemplateParameterModelItem(model));
|
|
864 return item;
|
|
865 }
|
|
866
|
|
867 // ---------------------------------------------------------------------------
|
|
868 TypeInfo _MemberModelItem::type() const
|
|
869 {
|
|
870 return _M_type;
|
|
871 }
|
|
872
|
|
873 void _MemberModelItem::setType(const TypeInfo &type)
|
|
874 {
|
|
875 _M_type = type;
|
|
876 }
|
|
877
|
|
878 CodeModel::AccessPolicy _MemberModelItem::accessPolicy() const
|
|
879 {
|
|
880 return _M_accessPolicy;
|
|
881 }
|
|
882
|
|
883 void _MemberModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy)
|
|
884 {
|
|
885 _M_accessPolicy = accessPolicy;
|
|
886 }
|
|
887
|
|
888 bool _MemberModelItem::isStatic() const
|
|
889 {
|
|
890 return _M_isStatic;
|
|
891 }
|
|
892
|
|
893 void _MemberModelItem::setStatic(bool isStatic)
|
|
894 {
|
|
895 _M_isStatic = isStatic;
|
|
896 }
|
|
897
|
|
898 bool _MemberModelItem::isConstant() const
|
|
899 {
|
|
900 return _M_isConstant;
|
|
901 }
|
|
902
|
|
903 void _MemberModelItem::setConstant(bool isConstant)
|
|
904 {
|
|
905 _M_isConstant = isConstant;
|
|
906 }
|
|
907
|
|
908 bool _MemberModelItem::isVolatile() const
|
|
909 {
|
|
910 return _M_isVolatile;
|
|
911 }
|
|
912
|
|
913 void _MemberModelItem::setVolatile(bool isVolatile)
|
|
914 {
|
|
915 _M_isVolatile = isVolatile;
|
|
916 }
|
|
917
|
|
918 bool _MemberModelItem::isAuto() const
|
|
919 {
|
|
920 return _M_isAuto;
|
|
921 }
|
|
922
|
|
923 void _MemberModelItem::setAuto(bool isAuto)
|
|
924 {
|
|
925 _M_isAuto = isAuto;
|
|
926 }
|
|
927
|
|
928 bool _MemberModelItem::isFriend() const
|
|
929 {
|
|
930 return _M_isFriend;
|
|
931 }
|
|
932
|
|
933 void _MemberModelItem::setFriend(bool isFriend)
|
|
934 {
|
|
935 _M_isFriend = isFriend;
|
|
936 }
|
|
937
|
|
938 bool _MemberModelItem::isRegister() const
|
|
939 {
|
|
940 return _M_isRegister;
|
|
941 }
|
|
942
|
|
943 void _MemberModelItem::setRegister(bool isRegister)
|
|
944 {
|
|
945 _M_isRegister = isRegister;
|
|
946 }
|
|
947
|
|
948 bool _MemberModelItem::isExtern() const
|
|
949 {
|
|
950 return _M_isExtern;
|
|
951 }
|
|
952
|
|
953 void _MemberModelItem::setExtern(bool isExtern)
|
|
954 {
|
|
955 _M_isExtern = isExtern;
|
|
956 }
|
|
957
|
|
958 bool _MemberModelItem::isMutable() const
|
|
959 {
|
|
960 return _M_isMutable;
|
|
961 }
|
|
962
|
|
963 void _MemberModelItem::setMutable(bool isMutable)
|
|
964 {
|
|
965 _M_isMutable = isMutable;
|
|
966 }
|
|
967
|
|
968 // kate: space-indent on; indent-width 2; replace-tabs on;
|
|
969
|