[Uml-devel] KDE/kdesdk/umbrello/umbrello/codeimport
Andi Fischer
andi.fischer at hispeed.ch
Fri Oct 3 07:20:47 UTC 2008
SVN commit 867234 by fischer:
Krazy: fixing postfix usage of ++ and --.
M +5 -4 adaimport.cpp
M +2 -2 idlimport.cpp
M +3 -3 javaimport.cpp
M +30 -17 nativeimportbase.cpp
M +2 -2 pascalimport.cpp
M +3 -2 pythonimport.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/adaimport.cpp #867233:867234
@@ -57,7 +57,7 @@
bool seenSpace = false;
QString line = lin.trimmed();
uint len = line.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
const QChar& c = line[i];
if (inString) {
listElement += c;
@@ -111,7 +111,7 @@
{
QString lexeme;
const uint len = word.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
QChar c = word[i];
if (c.isLetterOrNumber() || c == '_' || c == '.' || c == '#') {
lexeme += c;
@@ -498,11 +498,12 @@
// The controlling parameter is suppressed.
parNameCount--;
if (parNameCount) {
- for (uint i = 0; i < parNameCount; i++)
+ for (uint i = 0; i < parNameCount; ++i) {
parName[i] = parName[i + 1];
+ }
}
}
- for (uint i = 0; i < parNameCount; i++) {
+ for (uint i = 0; i < parNameCount; ++i) {
UMLAttribute *att = Import_Utils::addMethodParameter(op, typeName, parName[i]);
att->setParmKind(dir);
}
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/idlimport.cpp #867233:867234
@@ -66,7 +66,7 @@
{
QString lexeme;
const uint len = word.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
QChar c = word[i];
if (c.isLetterOrNumber() || c == '_') {
lexeme += c;
@@ -128,7 +128,7 @@
m_scopeIndex = 0;
m_scope[0] = NULL;
const int srcLength = m_source.count();
- for (m_srcIndex = 0; m_srcIndex < srcLength; m_srcIndex++) {
+ for (m_srcIndex = 0; m_srcIndex < srcLength; ++m_srcIndex) {
const QString& keyword = m_source[m_srcIndex];
//uDebug() << '"' << keyword << '"';
if (keyword.startsWith(m_singleLineCommentIntro)) {
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #867233:867234
@@ -57,7 +57,7 @@
int start = ++m_srcIndex;
if (! skipToClosing(m_source[start][0]))
return typeName;
- for (int i = start; i <= m_srcIndex; i++) {
+ for (int i = start; i <= m_srcIndex; ++i) {
typeName += m_source[i];
}
}
@@ -72,7 +72,7 @@
{
QString lexeme;
const uint len = word.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
const QChar& c = word[i];
if (c.isLetterOrNumber() || c == '_' || c == '.') {
lexeme += c;
@@ -158,7 +158,7 @@
QStringList package = m_currentPackage.split( '.' );
int dirsInPackageCount = package.size();
- for (int count=0; count < dirsInPackageCount; count ++ ) {
+ for (int count=0; count < dirsInPackageCount; ++count ) {
// pop off one by one the directories, until only the source root remains
//
file.pop_back();
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/nativeimportbase.cpp #867233:867234
@@ -1,11 +1,10 @@
/***************************************************************************
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2005-2007 *
+ * copyright (C) 2005-2008 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -18,10 +17,12 @@
#include <qregexp.h>
#include <klocale.h>
#include <kdebug.h>
+
// app includes
#include "import_utils.h"
-NativeImportBase::NativeImportBase(const QString &singleLineCommentIntro) {
+NativeImportBase::NativeImportBase(const QString &singleLineCommentIntro)
+{
m_singleLineCommentIntro = singleLineCommentIntro;
m_srcIndex = 0;
m_scopeIndex = 0; // index 0 is reserved for global scope
@@ -31,26 +32,31 @@
m_inComment = false;
}
-NativeImportBase::~NativeImportBase() {
+NativeImportBase::~NativeImportBase()
+{
}
-void NativeImportBase::setMultiLineComment(const QString &intro, const QString &end) {
+void NativeImportBase::setMultiLineComment(const QString &intro, const QString &end)
+{
m_multiLineCommentIntro = intro;
m_multiLineCommentEnd = end;
}
-void NativeImportBase::setMultiLineAltComment(const QString &intro, const QString &end) {
+void NativeImportBase::setMultiLineAltComment(const QString &intro, const QString &end)
+{
m_multiLineAltCommentIntro = intro;
m_multiLineAltCommentEnd = end;
}
-void NativeImportBase::skipStmt(QString until /* = ";" */) {
+void NativeImportBase::skipStmt(QString until /* = ";" */)
+{
const int srcLength = m_source.count();
while (m_srcIndex < srcLength && m_source[m_srcIndex] != until)
m_srcIndex++;
}
-bool NativeImportBase::skipToClosing(QChar opener) {
+bool NativeImportBase::skipToClosing(QChar opener)
+{
QString closing;
switch (opener.toLatin1()) {
case '{':
@@ -90,7 +96,8 @@
return true;
}
-QString NativeImportBase::advance() {
+QString NativeImportBase::advance()
+{
while (m_srcIndex < m_source.count() - 1) {
if (m_source[++m_srcIndex].startsWith(m_singleLineCommentIntro))
m_comment += m_source[m_srcIndex];
@@ -106,7 +113,8 @@
return m_source[m_srcIndex];
}
-bool NativeImportBase::preprocess(QString& line) {
+bool NativeImportBase::preprocess(QString& line)
+{
if (m_multiLineCommentIntro.isEmpty())
return false;
// Check for end of multi line comment.
@@ -189,13 +197,14 @@
/// Split the line so that a string is returned as a single element of the list,
/// when not in a string then split at white space.
-QStringList NativeImportBase::split(const QString& lin) {
+QStringList NativeImportBase::split(const QString& lin)
+{
QStringList list;
QString listElement;
QChar stringIntro = 0; // buffers the string introducer character
bool seenSpace = false;
QString line = lin.trimmed();
- for (int i = 0; i < line.length(); i++) {
+ for (int i = 0; i < line.length(); ++i) {
const QChar& c = line[i];
if (stringIntro.toLatin1()) { // we are in a string
listElement += c;
@@ -232,7 +241,8 @@
/// The lexer. Tokenizes the given string and fills `m_source'.
/// Stores possible comments in `m_comment'.
-void NativeImportBase::scan(QString line) {
+void NativeImportBase::scan(QString line)
+{
if (preprocess(line))
return;
// Check for single line comment.
@@ -256,10 +266,12 @@
}
}
-void NativeImportBase::initVars() {
+void NativeImportBase::initVars()
+{
}
-void NativeImportBase::parseFile(const QString& filename) {
+void NativeImportBase::parseFile(const QString& filename)
+{
QString nameWithoutPath = filename;
nameWithoutPath.remove(QRegExp("^.*/"));
if (m_parsedFiles.contains(nameWithoutPath))
@@ -319,7 +331,7 @@
m_scopeIndex = 0;
m_scope[0] = NULL; // index 0 is reserved for global scope
const int srcLength = m_source.count();
- for (m_srcIndex = 0; m_srcIndex < srcLength; m_srcIndex++) {
+ for (m_srcIndex = 0; m_srcIndex < srcLength; ++m_srcIndex) {
const QString& firstToken = m_source[m_srcIndex];
//uDebug() << '"' << firstToken << '"';
if (firstToken.startsWith(m_singleLineCommentIntro)) {
@@ -333,7 +345,8 @@
uDebug() << msgPrefix << "end of parse.";
}
-void NativeImportBase::initialize() {
+void NativeImportBase::initialize()
+{
m_parsedFiles.clear();
}
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/pascalimport.cpp #867233:867234
@@ -51,7 +51,7 @@
{
QString lexeme;
const uint len = word.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
QChar c = word[i];
if (c.isLetterOrNumber() || c == '_' || c == '.' || c == '#') {
lexeme += c;
@@ -260,7 +260,7 @@
}
nextToken = advance();
}
- for (uint i = 0; i < parNameCount; i++) {
+ for (uint i = 0; i < parNameCount; ++i) {
UMLAttribute *att = Import_Utils::addMethodParameter(op, nextToken, parName[i]);
att->setParmKind(dir);
}
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/pythonimport.cpp #867233:867234
@@ -100,7 +100,7 @@
{
QString lexeme;
const uint len = word.length();
- for (uint i = 0; i < len; i++) {
+ for (uint i = 0; i < len; ++i) {
const QChar& c = word[i];
if (c.isLetterOrNumber() || c == '_' || c == '.') {
lexeme += c;
@@ -123,8 +123,9 @@
QString PythonImport::indentation(int level)
{
QString spaces;
- for (int i = 0; i < level; i++)
+ for (int i = 0; i < level; ++i) {
spaces += " ";
+ }
return spaces;
}
More information about the umbrello-devel
mailing list