aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abstractmetalang.cpp79
-rw-r--r--abstractmetalang.h2
2 files changed, 42 insertions, 39 deletions
diff --git a/abstractmetalang.cpp b/abstractmetalang.cpp
index 3dc48fac7..b1f5fd6e9 100644
--- a/abstractmetalang.cpp
+++ b/abstractmetalang.cpp
@@ -84,32 +84,32 @@ AbstractMetaType *AbstractMetaType::copy() const
QString AbstractMetaType::cppSignature() const
{
- QString s;
-
- if (isConstant())
- s += "const ";
-
- s += typeEntry()->qualifiedCppName();
-
- if (hasInstantiationInCpp()) {
- AbstractMetaTypeList types = instantiations();
- s += "<";
- for (int i = 0; i < types.count(); ++i) {
- if (i > 0)
- s += ", ";
- s += types[i]->cppSignature();
+ if (m_cachedCppSignature.isEmpty()) {
+ if (isConstant())
+ m_cachedCppSignature += "const ";
+
+ m_cachedCppSignature += typeEntry()->qualifiedCppName();
+
+ if (hasInstantiationInCpp()) {
+ AbstractMetaTypeList types = instantiations();
+ m_cachedCppSignature += "<";
+ for (int i = 0; i < types.count(); ++i) {
+ if (i > 0)
+ m_cachedCppSignature += ", ";
+ m_cachedCppSignature += types[i]->cppSignature();
+ }
+ m_cachedCppSignature += " >";
}
- s += " >";
- }
- if (actualIndirections()) {
- s += ' ';
- if (indirections())
- s += QString(indirections(), '*');
- if (isReference())
- s += '&';
+ if (actualIndirections()) {
+ m_cachedCppSignature += ' ';
+ if (indirections())
+ m_cachedCppSignature += QString(indirections(), '*');
+ if (isReference())
+ m_cachedCppSignature += '&';
+ }
}
- return s;
+ return m_cachedCppSignature;
}
@@ -326,26 +326,27 @@ QStringList AbstractMetaFunction::introspectionCompatibleSignatures(const QStrin
QString AbstractMetaFunction::signature() const
{
- QString s(m_originalName);
+ if (m_cachedSignature.isEmpty()) {
+ m_cachedSignature = m_originalName;
- s += "(";
-
- for (int i = 0; i < m_arguments.count(); ++i) {
- if (i > 0)
- s += ", ";
- AbstractMetaArgument *a = m_arguments.at(i);
- s += a->type()->cppSignature();
+ m_cachedSignature += '(';
- // We need to have the argument names in the qdoc files
- s += " ";
- s += a->name();
- }
- s += ")";
+ for (int i = 0; i < m_arguments.count(); ++i) {
+ if (i > 0)
+ m_cachedSignature += ", ";
+ AbstractMetaArgument *a = m_arguments.at(i);
+ m_cachedSignature += a->type()->cppSignature();
- if (isConstant())
- s += " const";
+ // We need to have the argument names in the qdoc files
+ m_cachedSignature += ' ';
+ m_cachedSignature += a->name();
+ }
+ m_cachedSignature += ")";
- return s;
+ if (isConstant())
+ m_cachedSignature += " const";
+ }
+ return m_cachedSignature;
}
int AbstractMetaFunction::actualMinimumArgumentCount() const
diff --git a/abstractmetalang.h b/abstractmetalang.h
index a58052734..4f1f25400 100644
--- a/abstractmetalang.h
+++ b/abstractmetalang.h
@@ -594,6 +594,7 @@ private:
AbstractMetaTypeList m_instantiations;
QString m_package;
mutable QString m_name;
+ mutable QString m_cachedCppSignature;
QString m_originalTypeDescription;
int m_arrayElementCount;
@@ -1163,6 +1164,7 @@ private:
QString m_name;
QString m_originalName;
mutable QString m_cachedMinimalSignature;
+ mutable QString m_cachedSignature;
mutable QString m_cachedModifiedName;
FunctionTypeEntry* m_typeEntry;