diff options
Diffstat (limited to 'typesystem.cpp')
-rw-r--r-- | typesystem.cpp | 78 |
1 files changed, 1 insertions, 77 deletions
diff --git a/typesystem.cpp b/typesystem.cpp index 2a17d703b..6475db065 100644 --- a/typesystem.cpp +++ b/typesystem.cpp @@ -22,10 +22,7 @@ */ #include "typesystem.h" -#include "generator.h" - -#include <reporthandler.h> - +#include "reporthandler.h" #include <Qt/QtXml> QString strings_Object = QLatin1String("Object"); @@ -1923,79 +1920,6 @@ QString fixCppTypeName(const QString &name) return name; } -QString formattedCodeHelper(QTextStream &s, Indentor &indentor, QStringList &lines) -{ - bool multilineComment = false; - bool lastEmpty = true; - QString lastLine; - while (!lines.isEmpty()) { - const QString line = lines.takeFirst().trimmed(); - if (line.isEmpty()) { - if (!lastEmpty) - s << endl; - lastEmpty = true; - continue; - } else - lastEmpty = false; - - if (line.startsWith("/*")) - multilineComment = true; - - if (multilineComment) { - s << indentor; - if (line.startsWith("*")) - s << " "; - s << line << endl; - if (line.endsWith("*/")) - multilineComment = false; - } else if (line.startsWith("}")) - return line; - else if (line.endsWith("")) { - s << indentor << line << endl; - return 0; - } else if (line.endsWith("{")) { - s << indentor << line << endl; - QString tmp; - { - Indentation indent(indentor); - tmp = formattedCodeHelper(s, indentor, lines); - } - if (!tmp.isNull()) - s << indentor << tmp << endl; - - lastLine = tmp; - continue; - } else { - s << indentor; - if (!lastLine.isEmpty() && - !lastLine.endsWith(";") && - !line.startsWith("@") && - !line.startsWith("//") && - !lastLine.startsWith("//") && - !lastLine.endsWith("}") && - !line.startsWith("{")) - s << " "; - s << line << endl; - } - lastLine = line; - } - return 0; -} - - -QTextStream &CodeSnip::formattedCode(QTextStream &s, Indentor &indentor) const -{ - QStringList lst(code().split("\n")); - while (!lst.isEmpty()) { - QString tmp = formattedCodeHelper(s, indentor, lst); - if (!tmp.isNull()) - s << indentor << tmp << endl; - - } - s.flush(); - return s; -} - QString TemplateInstance::expandCode() const { TemplateEntry *templateEntry = TypeDatabase::instance()->findTemplate(m_name); |