Mercurial > projects > qtd
annotate generator/abstractmetalang.h @ 356:12cec2d14e1c
a better name for qtd.Str
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Tue, 25 May 2010 20:14:04 +0300 |
parents | 18bd68f586c6 |
children | 9784459f0750 |
rev | line source |
---|---|
1 | 1 /**************************************************************************** |
2 ** | |
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved. | |
4 ** | |
5 ** This file is part of Qt Jambi. | |
6 ** | |
7 ** * Commercial Usage | |
8 * Licensees holding valid Qt Commercial licenses may use this file in | |
9 * accordance with the Qt Commercial License Agreement provided with the | |
10 * Software or, alternatively, in accordance with the terms contained in | |
11 * a written agreement between you and Nokia. | |
12 * | |
13 * | |
14 * GNU General Public License Usage | |
15 * Alternatively, this file may be used under the terms of the GNU | |
16 * General Public License versions 2.0 or 3.0 as published by the Free | |
17 * Software Foundation and appearing in the file LICENSE.GPL included in | |
18 * the packaging of this file. Please review the following information | |
19 * to ensure GNU General Public Licensing requirements will be met: | |
20 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and | |
21 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special | |
22 * exception, Nokia gives you certain additional rights. These rights | |
23 * are described in the Nokia Qt GPL Exception version 1.2, included in | |
24 * the file GPL_EXCEPTION.txt in this package. | |
25 * | |
26 * Qt for Windows(R) Licensees | |
27 * As a special exception, Nokia, as the sole copyright holder for Qt | |
28 * Designer, grants users of the Qt/Eclipse Integration plug-in the | |
29 * right for the Qt/Eclipse Integration to link to functionality | |
30 * provided by Qt Designer and its related libraries. | |
31 * | |
32 * | |
33 * If you are unsure which license is appropriate for your use, please | |
34 * contact the sales department at qt-sales@nokia.com. | |
35 | |
36 ** | |
37 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | |
38 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
39 ** | |
40 ****************************************************************************/ | |
41 | |
42 #ifndef ABSTRACTMETALANG_H | |
43 #define ABSTRACTMETALANG_H | |
44 | |
45 #include "codemodel.h" | |
46 | |
47 #include "typesystem.h" | |
48 | |
49 #include <QHash> | |
50 #include <QSet> | |
51 #include <QStringList> | |
52 #include <QTextStream> | |
53 | |
54 | |
55 class AbstractMeta; | |
56 class AbstractMetaClass; | |
57 class AbstractMetaField; | |
58 class AbstractMetaFunction; | |
59 class AbstractMetaType; | |
60 class AbstractMetaVariable; | |
61 class AbstractMetaArgument; | |
62 class AbstractMetaEnumValue; | |
63 class AbstractMetaEnum; | |
64 class QPropertySpec; | |
65 | |
66 typedef QList<AbstractMetaField *> AbstractMetaFieldList; | |
67 typedef QList<AbstractMetaArgument *> AbstractMetaArgumentList; | |
68 typedef QList<AbstractMetaFunction *> AbstractMetaFunctionList; | |
69 class AbstractMetaClassList : public QList<AbstractMetaClass *> | |
70 { | |
71 public: | |
72 AbstractMetaClass *findClass(const QString &name) const; | |
73 AbstractMetaEnumValue *findEnumValue(const QString &string) const; | |
74 AbstractMetaEnum *findEnum(const EnumTypeEntry *entry) const; | |
75 | |
76 }; | |
77 | |
78 | |
79 | |
80 class AbstractMetaAttributes | |
81 { | |
82 public: | |
83 AbstractMetaAttributes() : m_attributes(0) { }; | |
84 | |
85 enum Attribute { | |
86 None = 0x00000000, | |
87 | |
88 Private = 0x00000001, | |
89 Protected = 0x00000002, | |
90 Public = 0x00000004, | |
91 Friendly = 0x00000008, | |
92 Visibility = 0x0000000f, | |
93 | |
94 Native = 0x00000010, | |
95 Abstract = 0x00000020, | |
96 Static = 0x00000040, | |
97 | |
98 FinalInTargetLang = 0x00000080, | |
99 FinalInCpp = 0x00000100, | |
100 ForceShellImplementation = 0x00000200, | |
101 | |
102 GetterFunction = 0x00000400, | |
103 SetterFunction = 0x00000800, | |
104 | |
105 FinalOverload = 0x00001000, | |
106 InterfaceFunction = 0x00002000, | |
107 | |
108 PropertyReader = 0x00004000, | |
109 PropertyWriter = 0x00008000, | |
110 PropertyResetter = 0x00010000, | |
111 | |
112 Fake = 0x00020000, | |
113 | |
114 Invokable = 0x00040000, | |
115 | |
116 Final = FinalInTargetLang | FinalInCpp | |
117 }; | |
118 | |
119 uint attributes() const { return m_attributes; } | |
120 void setAttributes(uint attributes) { m_attributes = attributes; } | |
121 | |
122 uint originalAttributes() const { return m_originalAttributes; } | |
123 void setOriginalAttributes(uint attributes) { m_originalAttributes = attributes; } | |
124 | |
125 uint visibility() const { return m_attributes & Visibility; } | |
126 void setVisibility(uint visi) { m_attributes = (m_attributes & ~Visibility) | visi; } | |
127 | |
128 void operator+=(Attribute attribute) { m_attributes |= attribute; } | |
129 void operator-=(Attribute attribute) { m_attributes &= ~attribute; } | |
130 | |
131 bool isNative() const { return m_attributes & Native; } | |
132 bool isFinal() const { return (m_attributes & Final) == Final; } | |
133 bool isFinalInTargetLang() const { return m_attributes & FinalInTargetLang; } | |
134 bool isFinalInCpp() const { return m_attributes & FinalInCpp; } | |
135 bool isAbstract() const { return m_attributes & Abstract; } | |
136 bool isStatic() const { return m_attributes & Static; } | |
137 bool isForcedShellImplementation() const { return m_attributes & ForceShellImplementation; } | |
138 bool isInterfaceFunction() const { return m_attributes & InterfaceFunction; } | |
139 bool isFinalOverload() const { return m_attributes & FinalOverload; } | |
140 bool isInvokable() const { return m_attributes & Invokable; } | |
141 | |
142 bool isPropertyReader() const { return m_attributes & PropertyReader; } | |
143 bool isPropertyWriter() const { return m_attributes & PropertyWriter; } | |
144 bool isPropertyResetter() const { return m_attributes & PropertyResetter; } | |
145 | |
146 bool isPrivate() const { return m_attributes & Private; } | |
147 bool isProtected() const { return m_attributes & Protected; } | |
148 bool isPublic() const { return m_attributes & Public; } | |
149 bool isFriendly() const { return m_attributes & Friendly; } | |
150 | |
151 bool wasPrivate() const { return m_originalAttributes & Private; } | |
152 bool wasProtected() const { return m_originalAttributes & Protected; } | |
153 bool wasPublic() const { return m_originalAttributes & Public; } | |
154 bool wasFriendly() const { return m_originalAttributes & Friendly; } | |
155 | |
156 private: | |
157 uint m_attributes; | |
158 uint m_originalAttributes; | |
159 }; | |
160 | |
161 | |
162 class AbstractMetaType | |
163 { | |
164 public: | |
165 enum TypeUsagePattern { | |
166 InvalidPattern, | |
167 PrimitivePattern, | |
168 FlagsPattern, | |
169 EnumPattern, | |
170 ValuePattern, | |
171 StringPattern, | |
172 CharPattern, | |
173 ObjectPattern, | |
174 QObjectPattern, | |
175 NativePointerPattern, | |
176 ContainerPattern, | |
177 VariantPattern, | |
178 JObjectWrapperPattern, | |
179 ArrayPattern, | |
180 ThreadPattern | |
181 }; | |
182 | |
183 AbstractMetaType() : | |
184 m_type_entry(0), | |
185 m_array_element_count(0), | |
186 m_array_element_type(0), | |
187 m_original_template_type(0), | |
188 m_pattern(InvalidPattern), | |
189 m_constant(false), | |
190 m_reference(false), | |
191 m_cpp_instantiation(true), | |
192 m_indirections(0), | |
193 m_reserved(0) | |
194 { | |
195 } | |
196 | |
197 QString package() const { return m_type_entry->javaPackage(); } | |
198 QString name() const { return m_type_entry->targetLangName(); } | |
199 QString fullName() const { return m_type_entry->qualifiedTargetLangName(); } | |
200 | |
201 void setTypeUsagePattern(TypeUsagePattern pattern) { m_pattern = pattern; } | |
202 TypeUsagePattern typeUsagePattern() const { return m_pattern; } | |
203 | |
204 // true when use pattern is container | |
205 bool hasInstantiations() const { return !m_instantiations.isEmpty(); } | |
206 void addInstantiation(AbstractMetaType *inst) { m_instantiations << inst; } | |
207 void setInstantiations(const QList<AbstractMetaType *> &insts) { m_instantiations = insts; } | |
208 QList<AbstractMetaType *> instantiations() const { return m_instantiations; } | |
209 void setInstantiationInCpp(bool incpp) { m_cpp_instantiation = incpp; } | |
210 bool hasInstantiationInCpp() const { return hasInstantiations() && m_cpp_instantiation; } | |
211 | |
212 QString minimalSignature() const; | |
213 | |
214 // true when the type is a QtJambiObject subclass | |
215 bool hasNativeId() const; | |
216 | |
217 // returns true if the typs is used as a non complex primitive, no & or *'s | |
218 bool isPrimitive() const { return m_pattern == PrimitivePattern; } | |
219 | |
220 // returns true if the type is used as an enum | |
221 bool isEnum() const { return m_pattern == EnumPattern; } | |
222 | |
223 // returns true if the type is used as a QObject * | |
224 bool isQObject() const { return m_pattern == QObjectPattern; } | |
225 | |
226 // returns true if the type is used as an object, e.g. Xxx * | |
227 bool isObject() const { return m_pattern == ObjectPattern; } | |
228 | |
229 // returns true if the type is used as an array, e.g. Xxx[42] | |
230 bool isArray() const { return m_pattern == ArrayPattern; } | |
231 | |
232 // returns true if the type is used as a value type (X or const X &) | |
233 bool isValue() const { return m_pattern == ValuePattern; } | |
234 | |
235 // returns true for more complex types... | |
236 bool isNativePointer() const { return m_pattern == NativePointerPattern; } | |
237 | |
238 // returns true if the type was originally a QString or const QString & or equivalent for QLatin1String | |
239 bool isTargetLangString() const { return m_pattern == StringPattern; } | |
240 | |
241 // returns true if the type was originally a QChar or const QChar & | |
242 bool isTargetLangChar() const { return m_pattern == CharPattern; } | |
243 | |
244 // return true if the type was originally a QVariant or const QVariant & | |
245 bool isVariant() const { return m_pattern == VariantPattern; } | |
246 | |
247 // return true if the type was originally a JObjectWrapper or const JObjectWrapper & | |
248 bool isJObjectWrapper() const { return m_pattern == JObjectWrapperPattern; } | |
249 | |
250 // returns true if the type was used as a container | |
251 bool isContainer() const { return m_pattern == ContainerPattern; } | |
252 | |
253 // returns true if the type was used as a flag | |
254 bool isFlags() const { return m_pattern == FlagsPattern; } | |
255 | |
256 // returns true if the type was used as a thread | |
257 bool isThread() const { return m_pattern == ThreadPattern; } | |
258 | |
259 bool isConstant() const { return m_constant; } | |
260 void setConstant(bool constant) { m_constant = constant; } | |
261 | |
262 bool isReference() const { return m_reference; } | |
263 void setReference(bool ref) { m_reference = ref; } | |
264 | |
265 // Returns true if the type is to be implemented using Java enums, e.g. not plain ints. | |
266 bool isTargetLangEnum() const { return isEnum() && !((EnumTypeEntry *) typeEntry())->forceInteger(); } | |
267 bool isIntegerEnum() const { return isEnum() && !isTargetLangEnum(); } | |
268 | |
269 // Returns true if the type is to be implemented using Java QFlags, e.g. not plain ints. | |
270 bool isTargetLangFlags() const { | |
271 return isFlags() && !((FlagsTypeEntry *) typeEntry())->forceInteger(); } | |
272 bool isIntegerFlags() const { return isFlags() && !isTargetLangFlags(); } | |
273 | |
274 int actualIndirections() const { return m_indirections + (isReference() ? 1 : 0); } | |
275 int indirections() const { return m_indirections; } | |
276 void setIndirections(int indirections) { m_indirections = indirections; } | |
277 | |
278 void setArrayElementCount(int n) { m_array_element_count = n; } | |
279 int arrayElementCount() const { return m_array_element_count; } | |
280 | |
281 AbstractMetaType *arrayElementType() const { return m_array_element_type; } | |
282 void setArrayElementType(AbstractMetaType *t) { m_array_element_type = t; } | |
283 | |
284 QString cppSignature() const; | |
285 | |
286 AbstractMetaType *copy() const; | |
287 | |
288 const TypeEntry *typeEntry() const { return m_type_entry; } | |
289 void setTypeEntry(const TypeEntry *type) { m_type_entry = type; } | |
290 | |
291 void setOriginalTypeDescription(const QString &otd) { m_original_type_description = otd; } | |
292 QString originalTypeDescription() const { return m_original_type_description; } | |
293 | |
294 void setOriginalTemplateType(const AbstractMetaType *type) { m_original_template_type = type; } | |
295 const AbstractMetaType *originalTemplateType() const { return m_original_template_type; } | |
296 | |
297 private: | |
298 const TypeEntry *m_type_entry; | |
299 QList <AbstractMetaType *> m_instantiations; | |
300 QString m_package; | |
301 QString m_original_type_description; | |
302 | |
303 int m_array_element_count; | |
304 AbstractMetaType *m_array_element_type; | |
305 const AbstractMetaType *m_original_template_type; | |
306 | |
307 TypeUsagePattern m_pattern; | |
308 uint m_constant : 1; | |
309 uint m_reference : 1; | |
310 uint m_cpp_instantiation : 1; | |
311 int m_indirections : 4; | |
312 uint m_reserved : 25; // unused | |
313 }; | |
314 | |
315 class AbstractMetaVariable | |
316 { | |
317 public: | |
318 AbstractMetaVariable() : m_type(0) { } | |
319 | |
320 AbstractMetaType *type() const { return m_type; } | |
321 void setType(AbstractMetaType *type) { m_type = type; } | |
322 | |
323 QString name() const { return m_name; } | |
324 void setName(const QString &name) { m_name = name; } | |
325 | |
326 private: | |
327 QString m_name; | |
328 AbstractMetaType *m_type; | |
329 }; | |
330 | |
331 | |
332 | |
333 class AbstractMetaArgument : public AbstractMetaVariable | |
334 { | |
335 public: | |
336 AbstractMetaArgument() : m_argument_index(0) { }; | |
337 | |
338 QString defaultValueExpression() const { return m_expression; } | |
339 void setDefaultValueExpression(const QString &expr) { m_expression = expr; } | |
340 | |
341 QString originalDefaultValueExpression() const { return m_original_expression; } | |
342 void setOriginalDefaultValueExpression(const QString &expr) { m_original_expression = expr; } | |
343 | |
344 QString toString() const { return type()->name() + " " + AbstractMetaVariable::name() + | |
345 (m_expression.isEmpty() ? "" : " = " + m_expression); } | |
346 | |
347 int argumentIndex() const { return m_argument_index; } | |
348 void setArgumentIndex(int argIndex) { m_argument_index = argIndex; } | |
349 | |
350 QString argumentName() const; | |
351 QString indexedName() const; | |
352 | |
353 AbstractMetaArgument *copy() const; | |
354 | |
355 private: | |
356 // Just to force people to call argumentName() And indexedName(); | |
357 QString name() const; | |
358 | |
359 QString m_expression; | |
360 QString m_original_expression; | |
361 int m_argument_index; | |
362 }; | |
363 | |
364 | |
365 class AbstractMetaField : public AbstractMetaVariable, public AbstractMetaAttributes | |
366 { | |
367 public: | |
368 AbstractMetaField(); | |
369 ~AbstractMetaField(); | |
370 | |
371 const AbstractMetaClass *enclosingClass() const { return m_class; } | |
372 void setEnclosingClass(const AbstractMetaClass *cls) { m_class = cls; } | |
373 | |
374 const AbstractMetaFunction *getter() const; | |
375 const AbstractMetaFunction *setter() const; | |
376 | |
377 FieldModificationList modifications() const; | |
378 | |
379 AbstractMetaField *copy() const; | |
380 | |
381 private: | |
382 mutable AbstractMetaFunction *m_getter; | |
383 mutable AbstractMetaFunction *m_setter; | |
384 const AbstractMetaClass *m_class; | |
385 }; | |
386 | |
387 | |
388 class AbstractMetaFunction : public AbstractMetaAttributes | |
389 { | |
390 public: | |
391 enum FunctionType { | |
392 ConstructorFunction, | |
393 DestructorFunction, | |
394 NormalFunction, | |
395 SignalFunction, | |
396 EmptyFunction, | |
397 SlotFunction, | |
398 GlobalScopeFunction | |
399 }; | |
400 | |
401 enum CompareResult { | |
402 EqualName = 0x00000001, | |
403 EqualArguments = 0x00000002, | |
404 EqualAttributes = 0x00000004, | |
405 EqualImplementor = 0x00000008, | |
406 EqualReturnType = 0x00000010, | |
407 EqualDefaultValueOverload = 0x00000020, | |
408 EqualModifiedName = 0x00000040, | |
326
baaf74652f4c
treat const and non-const functions as separate
eldar1@eldar1-laptop
parents:
304
diff
changeset
|
409 EqualConstness = 0x00000080, |
1 | 410 |
411 NameLessThan = 0x00001000, | |
412 | |
326
baaf74652f4c
treat const and non-const functions as separate
eldar1@eldar1-laptop
parents:
304
diff
changeset
|
413 PrettySimilar = EqualName | EqualArguments | EqualConstness, |
1 | 414 Equal = 0x0000001f, |
415 NotEqual = 0x00001000 | |
416 }; | |
417 | |
418 AbstractMetaFunction() | |
419 : m_function_type(NormalFunction), | |
420 m_type(0), | |
421 m_class(0), | |
422 m_implementing_class(0), | |
423 m_declaring_class(0), | |
424 m_interface_class(0), | |
425 m_property_spec(0), | |
426 m_constant(false), | |
427 m_invalid(false), | |
428 m_jumptable_id(-1), | |
429 // qtd | |
430 m_store_result(0) | |
431 { | |
432 } | |
433 | |
434 ~AbstractMetaFunction(); | |
435 | |
436 QString name() const { return m_name; } | |
437 void setName(const QString &name) { m_name = name; } | |
438 | |
439 QString originalName() const { return m_original_name.isEmpty() ? name() : m_original_name; } | |
440 void setOriginalName(const QString &name) { m_original_name = name; } | |
441 | |
442 QString modifiedName() const; | |
443 | |
288 | 444 QString minimalSignature(int reduce = 0) const; |
1 | 445 QStringList possibleIntrospectionCompatibleSignatures() const; |
446 | |
447 QString marshalledName(bool classIsOwner = true) const; | |
448 | |
449 // true if one or more of the arguments are of QtJambiObject subclasses | |
450 bool argumentsHaveNativeId() const | |
451 { | |
452 foreach (const AbstractMetaArgument *arg, m_arguments) { | |
453 if (arg->type()->hasNativeId()) | |
454 return true; | |
455 } | |
456 | |
457 return false; | |
458 } | |
459 | |
460 bool isModifiedRemoved(int types = TypeSystem::All) const; | |
461 | |
462 AbstractMetaType *type() const { return m_type; } | |
463 void setType(AbstractMetaType *type) { m_type = type; } | |
464 | |
465 // The class that has this function as a member. | |
466 const AbstractMetaClass *ownerClass() const { return m_class; } | |
467 void setOwnerClass(const AbstractMetaClass *cls) { m_class = cls; } | |
468 | |
469 // The first class in a hierarchy that declares the function | |
470 const AbstractMetaClass *declaringClass() const { return m_declaring_class; } | |
471 void setDeclaringClass(const AbstractMetaClass *cls) { m_declaring_class = cls; } | |
472 | |
473 // The class that actually implements this function | |
474 const AbstractMetaClass *implementingClass() const { return m_implementing_class; } | |
475 void setImplementingClass(const AbstractMetaClass *cls) { m_implementing_class = cls; } | |
476 | |
477 bool needsCallThrough() const; | |
478 | |
479 AbstractMetaArgumentList arguments() const { return m_arguments; } | |
480 void setArguments(const AbstractMetaArgumentList &arguments) { m_arguments = arguments; } | |
481 void addArgument(AbstractMetaArgument *argument) { m_arguments << argument; } | |
482 int actualMinimumArgumentCount() const; | |
483 | |
484 void setInvalid(bool on) { m_invalid = on; } | |
485 bool isInvalid() const { return m_invalid; } | |
486 bool isDeprecated() const; | |
487 bool isDestructor() const { return functionType() == DestructorFunction; } | |
488 bool isConstructor() const { return functionType() == ConstructorFunction; } | |
489 bool isNormal() const { return functionType() == NormalFunction || isSlot() || isInGlobalScope(); } | |
490 bool isInGlobalScope() const { return functionType() == GlobalScopeFunction; } | |
491 bool isSignal() const { return functionType() == SignalFunction; } | |
492 bool isSlot() const { return functionType() == SlotFunction; } | |
493 bool isEmptyFunction() const { return functionType() == EmptyFunction; } | |
494 FunctionType functionType() const { return m_function_type; } | |
495 void setFunctionType(FunctionType type) { m_function_type = type; } | |
496 | |
497 QStringList introspectionCompatibleSignatures(const QStringList &resolvedArguments = QStringList()) const; | |
498 QString signature() const; | |
499 QString targetLangSignature(bool minimal = false) const; | |
500 bool shouldReturnThisObject() const { return QLatin1String("this") == argumentReplaced(0); } | |
501 | |
502 bool isConstant() const { return m_constant; } | |
503 void setConstant(bool constant) { m_constant = constant; } | |
504 | |
505 QString toString() const { return m_name; } | |
506 | |
507 uint compareTo(const AbstractMetaFunction *other) const; | |
508 | |
509 bool operator <(const AbstractMetaFunction &a) const; | |
510 | |
511 AbstractMetaFunction *copy() const; | |
512 | |
513 QString replacedDefaultExpression(const AbstractMetaClass *cls, int idx) const; | |
514 bool removedDefaultExpression(const AbstractMetaClass *cls, int idx) const; | |
515 QString conversionRule(TypeSystem::Language language, int idx) const; | |
516 QList<ReferenceCount> referenceCounts(const AbstractMetaClass *cls, int idx = -2) const; | |
517 | |
518 bool nullPointersDisabled(const AbstractMetaClass *cls = 0, int argument_idx = 0) const; | |
519 QString nullPointerDefaultValue(const AbstractMetaClass *cls = 0, int argument_idx = 0) const; | |
520 | |
521 bool resetObjectAfterUse(int argument_idx) const; | |
522 | |
523 // Returns whether garbage collection is disabled for the argument in any context | |
524 bool disabledGarbageCollection(const AbstractMetaClass *cls, int key) const; | |
525 | |
526 // Returns the ownership rules for the given argument in the given context | |
527 TypeSystem::Ownership ownership(const AbstractMetaClass *cls, TypeSystem::Language language, int idx) const; | |
528 | |
529 bool isVirtualSlot() const; | |
530 | |
531 QString typeReplaced(int argument_index) const; | |
532 bool isRemovedFromAllLanguages(const AbstractMetaClass *) const; | |
533 bool isRemovedFrom(const AbstractMetaClass *, TypeSystem::Language language) const; | |
534 bool argumentRemoved(int) const; | |
535 | |
536 QString argumentReplaced(int key) const; | |
537 bool needsSuppressUncheckedWarning() const; | |
538 | |
539 bool hasModifications(const AbstractMetaClass *implementor) const; | |
540 FunctionModificationList modifications(const AbstractMetaClass *implementor) const; | |
541 | |
542 // If this function stems from an interface, this returns the | |
543 // interface that declares it. | |
544 const AbstractMetaClass *interfaceClass() const { return m_interface_class; } | |
545 void setInterfaceClass(const AbstractMetaClass *cl) { m_interface_class = cl; } | |
546 | |
547 void setPropertySpec(QPropertySpec *spec) { m_property_spec = spec; } | |
548 QPropertySpec *propertySpec() const { return m_property_spec; } | |
549 | |
550 int jumpTableId() const { return m_jumptable_id; } | |
551 void setJumpTableId(int id) { m_jumptable_id = id; } | |
552 | |
553 // qtd | |
554 bool storeResult() const; | |
555 void checkStoreResult(); | |
556 | |
557 private: | |
558 int m_store_result; | |
559 | |
560 private: | |
561 QString m_name; | |
562 QString m_original_name; | |
563 mutable QString m_cached_minimal_signature; | |
564 mutable QString m_cached_modified_name; | |
565 | |
566 FunctionType m_function_type; | |
567 AbstractMetaType *m_type; | |
568 const AbstractMetaClass *m_class; | |
569 const AbstractMetaClass *m_implementing_class; | |
570 const AbstractMetaClass *m_declaring_class; | |
571 const AbstractMetaClass *m_interface_class; | |
572 QPropertySpec *m_property_spec; | |
573 AbstractMetaArgumentList m_arguments; | |
574 uint m_constant : 1; | |
575 uint m_invalid : 1; | |
576 int m_jumptable_id; | |
577 }; | |
578 | |
579 | |
580 class AbstractMetaEnumValue | |
581 { | |
582 public: | |
583 AbstractMetaEnumValue() | |
584 : m_value_set(false), m_value(0) | |
585 { | |
586 } | |
587 | |
588 int value() const { return m_value; } | |
589 void setValue(int value) { m_value_set = true; m_value = value; } | |
590 | |
591 QString stringValue() const { return m_string_value; } | |
592 void setStringValue(const QString &v) { m_string_value = v; } | |
593 | |
594 QString name() const { return m_name; } | |
595 void setName(const QString &name) { m_name = name; } | |
596 | |
597 bool isValueSet() const { return m_value_set; } | |
598 | |
599 private: | |
600 QString m_name; | |
601 QString m_string_value; | |
602 | |
603 bool m_value_set; | |
604 int m_value; | |
605 }; | |
606 | |
607 | |
608 class AbstractMetaEnumValueList : public QList<AbstractMetaEnumValue *> | |
609 { | |
610 public: | |
611 AbstractMetaEnumValue *find(const QString &name) const; | |
612 }; | |
613 | |
614 class AbstractMetaEnum : public AbstractMetaAttributes | |
615 { | |
616 public: | |
617 AbstractMetaEnum() : m_type_entry(0), m_class(0), m_has_qenums_declaration(false) {} | |
618 | |
619 AbstractMetaEnumValueList values() const { return m_enum_values; } | |
620 void addEnumValue(AbstractMetaEnumValue *enumValue) { m_enum_values << enumValue; } | |
621 | |
622 QString name() const { return m_type_entry->targetLangName(); } | |
623 QString qualifier() const { return m_type_entry->javaQualifier(); } | |
624 QString package() const { return m_type_entry->javaPackage(); } | |
625 QString fullName() const { return package() + "." + qualifier() + "." + name(); } | |
626 | |
627 // Has the enum been declared inside a Q_ENUMS() macro in its enclosing class? | |
628 void setHasQEnumsDeclaration(bool on) { m_has_qenums_declaration = on; } | |
629 bool hasQEnumsDeclaration() const { return m_has_qenums_declaration; } | |
630 | |
631 EnumTypeEntry *typeEntry() const { return m_type_entry; } | |
632 void setTypeEntry(EnumTypeEntry *entry) { m_type_entry = entry; } | |
633 | |
634 AbstractMetaClass *enclosingClass() const { return m_class; } | |
635 void setEnclosingClass(AbstractMetaClass *c) { m_class = c; } | |
636 | |
637 private: | |
638 AbstractMetaEnumValueList m_enum_values; | |
639 EnumTypeEntry *m_type_entry; | |
640 AbstractMetaClass *m_class; | |
641 | |
642 uint m_has_qenums_declaration : 1; | |
643 uint m_reserved : 31; | |
644 }; | |
645 | |
646 typedef QList<AbstractMetaEnum *> AbstractMetaEnumList; | |
647 | |
648 class AbstractMetaClass : public AbstractMetaAttributes | |
649 { | |
650 public: | |
651 enum FunctionQueryOption { | |
652 Constructors = 0x000001, // Only constructors | |
653 //Destructors = 0x000002, // Only destructors. Not included in class. | |
654 VirtualFunctions = 0x000004, // Only virtual functions (virtual in both TargetLang and C++) | |
655 FinalInTargetLangFunctions = 0x000008, // Only functions that are non-virtual in TargetLang | |
656 FinalInCppFunctions = 0x000010, // Only functions that are non-virtual in C++ | |
657 ClassImplements = 0x000020, // Only functions implemented by the current class | |
658 Inconsistent = 0x000040, // Only inconsistent functions (inconsistent virtualness in TargetLang/C++) | |
659 StaticFunctions = 0x000080, // Only static functions | |
660 Signals = 0x000100, // Only signals | |
661 NormalFunctions = 0x000200, // Only functions that aren't signals | |
662 Visible = 0x000400, // Only public and protected functions | |
663 ForcedShellFunctions = 0x000800, // Only functions that are overridden to be implemented in the shell class | |
664 WasPublic = 0x001000, // Only functions that were originally public | |
665 WasProtected = 0x002000, // Only functions that were originally protected | |
666 NonStaticFunctions = 0x004000, // No static functions | |
667 Empty = 0x008000, // Empty overrides of abstract functions | |
668 Invisible = 0x010000, // Only private functions | |
669 VirtualInCppFunctions = 0x020000, // Only functions that are virtual in C++ | |
670 NonEmptyFunctions = 0x040000, // Only functions with JNI implementations | |
671 VirtualInTargetLangFunctions = 0x080000, // Only functions which are virtual in TargetLang | |
672 AbstractFunctions = 0x100000, // Only abstract functions | |
673 WasVisible = 0x200000, // Only functions that were public or protected in the original code | |
674 NotRemovedFromTargetLang = 0x400000, // Only functions that have not been removed from TargetLang | |
675 NotRemovedFromShell = 0x800000, // Only functions that have not been removed from the shell class | |
676 VirtualSlots = 0x1000000 // Only functions that are set as virtual slots in the type system | |
677 }; | |
678 | |
679 AbstractMetaClass() | |
680 : m_namespace(false), | |
681 m_qobject(false), | |
682 m_has_virtuals(false), | |
683 m_has_nonpublic(false), | |
684 m_has_virtual_slots(false), | |
685 m_has_nonprivateconstructor(false), | |
686 m_functions_fixed(false), | |
687 m_has_public_destructor(true), | |
688 m_force_shell_class(false), | |
689 m_has_hash_function(false), | |
690 m_has_equals_operator(false), | |
691 m_has_clone_operator(false), | |
354
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
692 m_has_virtual_destructor(false), |
1 | 693 m_is_type_alias(false), |
694 m_enclosing_class(0), | |
695 m_base_class(0), | |
696 m_template_base_class(0), | |
697 m_extracted_interface(0), | |
698 m_primary_interface_implementor(0), | |
699 m_type_entry(0), | |
110 | 700 m_qDebug_stream_function(0), |
701 needsConversionFunc(false) | |
1 | 702 { |
703 } | |
704 | |
705 virtual ~AbstractMetaClass(); | |
706 | |
707 AbstractMetaClass *extractInterface(); | |
708 void fixFunctions(); | |
709 | |
710 AbstractMetaFunctionList functions() const { return m_functions; } | |
711 void setFunctions(const AbstractMetaFunctionList &functions); | |
712 void addFunction(AbstractMetaFunction *function); | |
713 bool hasFunction(const AbstractMetaFunction *f) const; | |
714 bool hasFunction(const QString &str) const; | |
715 bool hasSignal(const AbstractMetaFunction *f) const; | |
716 | |
717 bool hasConstructors() const; | |
293 | 718 AbstractMetaFunction *copyConstructor() const; |
1 | 719 |
720 void addDefaultConstructor(); | |
721 | |
722 bool hasNonPrivateConstructor() const { return m_has_nonprivateconstructor; } | |
723 void setHasNonPrivateConstructor(bool on) { m_has_nonprivateconstructor = on; } | |
724 bool hasPublicDestructor() const { return m_has_public_destructor; } | |
725 void setHasPublicDestructor(bool on) { m_has_public_destructor = on; } | |
726 | |
727 AbstractMetaFunctionList queryFunctionsByName(const QString &name) const; | |
728 AbstractMetaFunctionList queryFunctions(uint query) const; | |
729 inline AbstractMetaFunctionList allVirtualFunctions() const; | |
730 inline AbstractMetaFunctionList allFinalFunctions() const; | |
731 AbstractMetaFunctionList functionsInTargetLang() const; | |
732 AbstractMetaFunctionList functionsInShellClass() const; | |
733 inline AbstractMetaFunctionList cppInconsistentFunctions() const; | |
734 inline AbstractMetaFunctionList cppSignalFunctions() const; | |
735 AbstractMetaFunctionList publicOverrideFunctions() const; | |
736 AbstractMetaFunctionList virtualOverrideFunctions() const; | |
737 AbstractMetaFunctionList virtualFunctions() const; | |
738 AbstractMetaFunctionList nonVirtualShellFunctions() const; | |
739 | |
740 AbstractMetaFieldList fields() const { return m_fields; } | |
741 void setFields(const AbstractMetaFieldList &fields) { m_fields = fields; } | |
742 void addField(AbstractMetaField *field) { m_fields << field; } | |
743 | |
744 AbstractMetaEnumList enums() const { return m_enums; } | |
745 void setEnums(const AbstractMetaEnumList &enums) { m_enums = enums; } | |
746 void addEnum(AbstractMetaEnum *e) { m_enums << e; } | |
747 | |
748 AbstractMetaEnum *findEnum(const QString &enumName); | |
749 AbstractMetaEnum *findEnumForValue(const QString &enumName); | |
750 AbstractMetaEnumValue *findEnumValue(const QString &enumName, AbstractMetaEnum *meta_enum); | |
751 | |
752 AbstractMetaClassList interfaces() const { return m_interfaces; } | |
753 void addInterface(AbstractMetaClass *interface); | |
754 void setInterfaces(const AbstractMetaClassList &interface); | |
755 | |
756 QString fullName() const { return package() + "." + name(); } | |
757 QString name() const; | |
758 | |
759 QString baseClassName() const { return m_base_class ? m_base_class->name() : QString(); } | |
760 | |
761 AbstractMetaClass *baseClass() const { return m_base_class; } | |
762 void setBaseClass(AbstractMetaClass *base_class) { m_base_class = base_class; } | |
763 | |
764 const AbstractMetaClass *enclosingClass() const { return m_enclosing_class; } | |
765 void setEnclosingClass(AbstractMetaClass *cl) { m_enclosing_class = cl; } | |
766 | |
767 QString package() const { return m_type_entry->javaPackage(); } | |
768 bool isInterface() const { return m_type_entry->isInterface(); } | |
769 bool isNamespace() const { return m_type_entry->isNamespace(); } | |
770 bool isQObject() const { return m_type_entry->isQObject(); } | |
771 bool isQtNamespace() const { return isNamespace() && name() == "Qt"; } | |
772 QString qualifiedCppName() const { return m_type_entry->qualifiedCppName(); } | |
773 | |
774 bool hasInconsistentFunctions() const; | |
775 bool hasSignals() const; | |
776 bool inheritsFrom(const AbstractMetaClass *other) const; | |
777 | |
778 void setForceShellClass(bool on) { m_force_shell_class = on; } | |
779 bool generateShellClass() const; | |
780 | |
781 bool hasVirtualSlots() const { return m_has_virtual_slots; } | |
782 bool hasVirtualFunctions() const { return !isFinal() && m_has_virtuals; } | |
783 bool hasProtectedFunctions() const; | |
784 | |
354
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
785 // returns true if this class or its base classes have a |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
786 // virtual destructor |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
787 bool hasVirtualDestructor() const { return m_has_virtual_destructor |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
788 || m_base_class && m_base_class->hasVirtualDestructor(); } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
789 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
790 const AbstractMetaClass* destructorBase() const |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
791 { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
792 const AbstractMetaClass* ret = this; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
793 for (const AbstractMetaClass* base = this->m_base_class; base; base = base->m_base_class) { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
794 if (base->m_has_virtual_destructor) |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
795 ret = base; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
796 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
797 return ret; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
798 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
799 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
800 bool isDestructorBase() const |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
801 { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
802 return this == destructorBase(); |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
803 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
804 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
805 const AbstractMetaClass* polymorphicBase() const |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
806 { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
807 const AbstractMetaClass *ret = 0; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
808 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
809 for (const AbstractMetaClass *base = this; base; base = base->baseClass()) { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
810 if (base->m_has_virtuals || base->m_has_virtual_destructor) |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
811 ret = base; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
812 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
813 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
814 return ret; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
815 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
816 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
817 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
818 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
819 bool isPolymorphic() const |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
820 { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
821 for (const AbstractMetaClass *base = this; base; base = base->baseClass()) { |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
822 if (base->m_has_virtuals || base->m_has_virtual_destructor) |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
823 return true; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
824 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
825 return false; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
826 } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
827 |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
828 bool setHasVirtualDestructor(bool value) { m_has_virtual_destructor = value; } |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
829 |
1 | 830 QList<TypeEntry *> templateArguments() const { return m_template_args; } |
831 void setTemplateArguments(const QList<TypeEntry *> &args) { m_template_args = args; } | |
832 | |
833 bool hasFieldAccessors() const; | |
834 | |
835 // only valid during metajavabuilder's run | |
836 QStringList baseClassNames() const { return m_base_class_names; } | |
837 void setBaseClassNames(const QStringList &names) { m_base_class_names = names; } | |
838 | |
839 AbstractMetaClass *primaryInterfaceImplementor() const { return m_primary_interface_implementor; } | |
840 void setPrimaryInterfaceImplementor(AbstractMetaClass *cl) { m_primary_interface_implementor = cl; } | |
841 | |
842 const ComplexTypeEntry *typeEntry() const { return m_type_entry; } | |
843 ComplexTypeEntry *typeEntry() { return m_type_entry; } | |
844 void setTypeEntry(ComplexTypeEntry *type) { m_type_entry = type; } | |
845 | |
846 void setHasHashFunction(bool on) { m_has_hash_function = on; } | |
847 bool hasHashFunction() const { return m_has_hash_function; } | |
848 | |
849 void setToStringCapability(FunctionModelItem fun) { m_qDebug_stream_function= fun; } | |
850 FunctionModelItem hasToStringCapability() const { return m_qDebug_stream_function; } | |
851 | |
852 virtual bool hasDefaultToStringFunction() const; | |
853 | |
854 void setHasEqualsOperator(bool on) { m_has_equals_operator = on; } | |
855 bool hasEqualsOperator() const { return m_has_equals_operator; } | |
856 | |
857 void setHasCloneOperator(bool on) { m_has_clone_operator = on; } | |
858 bool hasCloneOperator() const { return m_has_clone_operator; } | |
859 | |
860 void addPropertySpec(QPropertySpec *spec) { m_property_specs << spec; } | |
861 QList<QPropertySpec *> propertySpecs() const { return m_property_specs; } | |
862 | |
863 QPropertySpec *propertySpecForRead(const QString &name) const; | |
864 QPropertySpec *propertySpecForWrite(const QString &name) const; | |
865 QPropertySpec *propertySpecForReset(const QString &name) const; | |
866 | |
867 QList<ReferenceCount> referenceCounts() const; | |
868 | |
869 void setEqualsFunctions(const AbstractMetaFunctionList &lst) { m_equals_functions = lst; } | |
870 AbstractMetaFunctionList equalsFunctions() const { return m_equals_functions; } | |
871 | |
872 void setNotEqualsFunctions(const AbstractMetaFunctionList &lst) { m_nequals_functions = lst; } | |
873 AbstractMetaFunctionList notEqualsFunctions() const { return m_nequals_functions; } | |
874 | |
875 void setLessThanFunctions(const AbstractMetaFunctionList &lst) { m_less_than_functions = lst; } | |
876 AbstractMetaFunctionList lessThanFunctions() const { return m_less_than_functions; } | |
877 | |
878 void setGreaterThanFunctions(const AbstractMetaFunctionList &lst) { m_greater_than_functions = lst; } | |
879 AbstractMetaFunctionList greaterThanFunctions() const { return m_greater_than_functions; } | |
880 | |
881 void setLessThanEqFunctions(const AbstractMetaFunctionList &lst) { m_less_than_eq_functions = lst; } | |
882 AbstractMetaFunctionList lessThanEqFunctions() const { return m_less_than_eq_functions; } | |
883 | |
884 void setGreaterThanEqFunctions(const AbstractMetaFunctionList &lst) { m_greater_than_eq_functions = lst; } | |
885 AbstractMetaFunctionList greaterThanEqFunctions() const { return m_greater_than_eq_functions; } | |
886 | |
887 void sortFunctions(); | |
888 | |
889 const AbstractMetaClass *templateBaseClass() const { return m_template_base_class; } | |
890 void setTemplateBaseClass(const AbstractMetaClass *cls) { m_template_base_class = cls; } | |
891 | |
892 void setTypeAlias(bool typeAlias) { m_is_type_alias = typeAlias; } | |
893 bool isTypeAlias() const { return m_is_type_alias; } | |
894 | |
42 | 895 const QStringList &depends() { return m_type_entry->depends(); } |
304 | 896 AbstractMetaFunctionList allFunctions() const { return m_functions; } |
110 | 897 |
898 bool needsConversionFunc; | |
1 | 899 private: |
900 uint m_namespace : 1; | |
901 uint m_qobject : 1; | |
902 uint m_has_virtuals : 1; | |
903 uint m_has_nonpublic : 1; | |
904 uint m_has_virtual_slots : 1; | |
905 uint m_has_nonprivateconstructor : 1; | |
906 uint m_functions_fixed : 1; | |
907 uint m_has_public_destructor : 1; | |
908 uint m_force_shell_class : 1; | |
909 uint m_has_hash_function : 1; | |
910 uint m_has_equals_operator : 1; | |
911 uint m_has_clone_operator :1; | |
912 uint m_is_type_alias : 1; | |
354
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
913 uint m_has_virtual_destructor : 1; |
18bd68f586c6
removed superfluous destructors
Max Samukha <maxter@spambox.com>
parents:
326
diff
changeset
|
914 uint m_reserved : 18; |
1 | 915 |
916 const AbstractMetaClass *m_enclosing_class; | |
917 AbstractMetaClass *m_base_class; | |
918 const AbstractMetaClass *m_template_base_class; | |
919 AbstractMetaFunctionList m_functions; | |
920 AbstractMetaFieldList m_fields; | |
921 AbstractMetaEnumList m_enums; | |
922 AbstractMetaClassList m_interfaces; | |
923 AbstractMetaClass *m_extracted_interface; | |
924 AbstractMetaClass *m_primary_interface_implementor; | |
925 QList<QPropertySpec *> m_property_specs; | |
926 AbstractMetaFunctionList m_equals_functions; | |
927 AbstractMetaFunctionList m_nequals_functions; | |
928 | |
929 AbstractMetaFunctionList m_less_than_functions; | |
930 AbstractMetaFunctionList m_greater_than_functions; | |
931 AbstractMetaFunctionList m_less_than_eq_functions; | |
932 AbstractMetaFunctionList m_greater_than_eq_functions; | |
933 | |
934 QStringList m_base_class_names; | |
935 QList<TypeEntry *> m_template_args; | |
936 ComplexTypeEntry *m_type_entry; | |
937 FunctionModelItem m_qDebug_stream_function; | |
938 | |
939 // qtd2 hack | |
940 friend class DGenerator; | |
941 }; | |
942 | |
943 class QPropertySpec { | |
944 public: | |
945 QPropertySpec(const TypeEntry *type) | |
946 : m_type(type), | |
947 m_index(-1) | |
948 { | |
949 } | |
950 | |
951 const TypeEntry *type() const { return m_type; } | |
952 | |
953 QString name() const { return m_name; } | |
954 void setName(const QString &name) { m_name = name; } | |
955 | |
956 QString read() const { return m_read; } | |
957 void setRead(const QString &read) { m_read = read; } | |
958 | |
959 QString write() const { return m_write; } | |
960 void setWrite(const QString &write) { m_write = write; } | |
961 | |
962 QString designable() const { return m_designable; } | |
963 void setDesignable(const QString &designable) { m_designable = designable; } | |
964 | |
965 QString reset() const { return m_reset; } | |
966 void setReset(const QString &reset) { m_reset = reset; } | |
967 | |
968 int index() const { return m_index; } | |
969 void setIndex(int index) { m_index = index; } | |
970 | |
971 private: | |
972 QString m_name; | |
973 QString m_read; | |
974 QString m_write; | |
975 QString m_designable; | |
976 QString m_reset; | |
977 const TypeEntry *m_type; | |
978 int m_index; | |
979 }; | |
980 | |
981 // qtd | |
982 class ArgumentReplace | |
983 { | |
984 private: | |
985 QHash<QString, QString> data; | |
986 static ArgumentReplace *m_instance; | |
987 ArgumentReplace(); | |
988 | |
989 public: | |
990 static void init(); | |
991 static QString translate(QString arg); | |
992 }; | |
993 | |
994 inline AbstractMetaFunctionList AbstractMetaClass::allVirtualFunctions() const | |
995 { | |
996 return queryFunctions(VirtualFunctions | |
997 | NotRemovedFromTargetLang); | |
998 } | |
999 | |
1000 inline AbstractMetaFunctionList AbstractMetaClass::allFinalFunctions() const | |
1001 { | |
1002 return queryFunctions(FinalInTargetLangFunctions | |
1003 | FinalInCppFunctions | |
1004 | NotRemovedFromTargetLang); | |
1005 } | |
1006 | |
1007 inline AbstractMetaFunctionList AbstractMetaClass::cppInconsistentFunctions() const | |
1008 { | |
1009 return queryFunctions(Inconsistent | |
1010 | NormalFunctions | |
1011 | Visible | |
1012 | NotRemovedFromTargetLang); | |
1013 } | |
1014 | |
1015 inline AbstractMetaFunctionList AbstractMetaClass::cppSignalFunctions() const | |
1016 { | |
1017 return queryFunctions(Signals | |
1018 | Visible | |
1019 | NotRemovedFromTargetLang); | |
1020 } | |
1021 | |
298
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1022 inline bool isNativeContainer(AbstractMetaType *argumentType) |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1023 { |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1024 if (argumentType && argumentType->isContainer()) |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1025 if (((const ContainerTypeEntry *)argumentType->typeEntry())->isQList()) |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1026 return true; |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1027 return false; |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1028 } |
adae77fdc1ea
Native QList implementation is now used throughout QtD
eldar
parents:
293
diff
changeset
|
1029 |
1 | 1030 #endif // ABSTRACTMETALANG_H |