aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetalang.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-17 15:47:23 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:15 -0300
commit2b671a5452d9f8c528948e4dcd707a11d3b8962b (patch)
treeb121498449f21ee17a9ef268d535f6f782ea2b7f /abstractmetalang.cpp
parent3932724b812f711893461038d0d0808dc1e2d79f (diff)
Add more cache stuff to speed up the generation process.
Diffstat (limited to 'abstractmetalang.cpp')
-rw-r--r--abstractmetalang.cpp79
1 files changed, 40 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