[Uml-devel] branches/work/soc-umbrello/umbrello/codeimport
Andi Fischer
andi.fischer at hispeed.ch
Fri Oct 3 07:21:13 UTC 2008
SVN commit 867235 by fischer:
Porting r867234.
M +5 -4 adaimport.cpp
M +2 -2 idlimport.cpp
M +3 -3 javaimport.cpp
M +32 -24 nativeimportbase.cpp
M +2 -2 pascalimport.cpp
M +3 -2 pythonimport.cpp
--- branches/work/soc-umbrello/umbrello/codeimport/adaimport.cpp #867234:867235
@@ -68,7 +68,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;
@@ -125,7 +125,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;
@@ -523,11 +523,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);
}
--- branches/work/soc-umbrello/umbrello/codeimport/idlimport.cpp #867234:867235
@@ -76,7 +76,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;
@@ -142,7 +142,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)) {
--- branches/work/soc-umbrello/umbrello/codeimport/javaimport.cpp #867234:867235
@@ -64,7 +64,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];
}
}
@@ -82,7 +82,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;
@@ -176,7 +176,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();
--- branches/work/soc-umbrello/umbrello/codeimport/nativeimportbase.cpp #867234:867235
@@ -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,7 +32,8 @@
m_inComment = false;
}
-NativeImportBase::~NativeImportBase() {
+NativeImportBase::~NativeImportBase()
+{
}
/**
@@ -42,7 +44,8 @@
* @param end In languages with a C style multiline comment
* this is star-slash.
*/
-void NativeImportBase::setMultiLineComment(const QString &intro, const QString &end) {
+void NativeImportBase::setMultiLineComment(const QString &intro, const QString &end)
+{
m_multiLineCommentIntro = intro;
m_multiLineCommentEnd = end;
}
@@ -51,12 +54,14 @@
* Set the delimiter strings for an alternative form of
* multi line comment. See setMultiLineComment().
*/
-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++;
@@ -70,7 +75,8 @@
* @return True for success, false for misuse (invalid opener) or
* if no matching closing character is found in m_source.
*/
-bool NativeImportBase::skipToClosing(QChar opener) {
+bool NativeImportBase::skipToClosing(QChar opener)
+{
QString closing;
switch (opener.toLatin1()) {
case '{':
@@ -115,7 +121,8 @@
* Comments encountered during advancement are accumulated in `m_comment'.
* If m_srcIndex hits the end of m_source then QString() is returned.
*/
-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];
@@ -142,7 +149,8 @@
* false if there are still items left in the line
* for further analysis.
*/
-bool NativeImportBase::preprocess(QString& line) {
+bool NativeImportBase::preprocess(QString& line)
+{
if (m_multiLineCommentIntro.isEmpty())
return false;
// Check for end of multi line comment.
@@ -223,21 +231,19 @@
return false; // The input was not completely consumed by preprocessing.
}
-/// 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.
-
/**
* 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.
* The default implementation is suitable for C style strings and char constants.
*/
-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;
@@ -272,17 +278,16 @@
return list;
}
-/// The lexer. Tokenizes the given string and fills `m_source'.
-/// Stores possible comments in `m_comment'.
/**
- * Scan a single line.
+ * The lexer. Scan a single line. Tokenizes the given string and fills `m_source'.
+ * Stores possible comments in `m_comment'.
* parseFile() calls this for each line read from the input file.
* This in turn calls other methods such as preprocess() and fillSource().
- *
* @param line The line to scan.
*/
-void NativeImportBase::scan(QString line) {
+void NativeImportBase::scan(QString line)
+{
if (preprocess(line))
return;
// Check for single line comment.
@@ -312,7 +317,8 @@
* after scanning (before parsing the QStringList m_source.)
* The default implementation is empty.
*/
-void NativeImportBase::initVars() {
+void NativeImportBase::initVars()
+{
}
/**
@@ -322,7 +328,8 @@
*
* @param filename The file to import.
*/
-void NativeImportBase::parseFile(const QString& filename) {
+void NativeImportBase::parseFile(const QString& filename)
+{
QString nameWithoutPath = filename;
nameWithoutPath.remove(QRegExp("^.*/"));
if (m_parsedFiles.contains(nameWithoutPath))
@@ -382,7 +389,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)) {
@@ -399,7 +406,8 @@
/**
* Implement abstract operation from ClassImport.
*/
-void NativeImportBase::initialize() {
+void NativeImportBase::initialize()
+{
m_parsedFiles.clear();
}
--- branches/work/soc-umbrello/umbrello/codeimport/pascalimport.cpp #867234:867235
@@ -57,7 +57,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;
@@ -276,7 +276,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);
}
--- branches/work/soc-umbrello/umbrello/codeimport/pythonimport.cpp #867234:867235
@@ -114,7 +114,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;
@@ -140,8 +140,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