[Uml-devel] KDE/kdesdk/umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Mon Jul 14 19:49:26 UTC 2008
SVN commit 832481 by fischer:
Krazy: fixing assignments to QString.
M +27 -18 classifierlistitem.cpp
M +22 -20 codeclassfield.cpp
M +19 -20 codegenerationpolicy.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/classifierlistitem.cpp #832480:832481
@@ -1,31 +1,32 @@
/***************************************************************************
- * *
* 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) 2003-2007 *
+ * copyright (C) 2003-2008 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
// own header
#include "classifierlistitem.h"
-// qt/kde includes
-#include <kdebug.h>
-#include <klocale.h>
-
// local includes
#include "classifier.h"
+#include "model_utils.h"
+#include "object_factory.h"
#include "uml.h"
#include "umldoc.h"
-#include "model_utils.h"
-#include "object_factory.h"
+// qt/kde includes
+#include <kdebug.h>
+#include <klocale.h>
+
+
UMLClassifierListItem::UMLClassifierListItem(UMLObject *parent,
const QString& name, Uml::IDType id)
- : UMLObject(parent, name, id) {
+ : UMLObject(parent, name, id)
+{
UMLObject *parentObj = const_cast<UMLObject*>(parent);
UMLClassifier *pc = dynamic_cast<UMLClassifier*>(parentObj);
if (pc)
@@ -33,14 +34,16 @@
}
UMLClassifierListItem::UMLClassifierListItem(UMLObject *parent)
- : UMLObject(parent) {
+ : UMLObject(parent)
+{
UMLObject *parentObj = const_cast<UMLObject*>(parent);
UMLClassifier *pc = dynamic_cast<UMLClassifier*>(parentObj);
if (pc)
UMLObject::setUMLPackage(pc);
}
-UMLClassifierListItem::~UMLClassifierListItem() {
+UMLClassifierListItem::~UMLClassifierListItem()
+{
}
void UMLClassifierListItem::copyInto(UMLObject *lhs) const
@@ -49,15 +52,19 @@
UMLObject::copyInto(lhs);
}
-QString UMLClassifierListItem::toString(Uml::Signature_Type /*sig*/) {
+QString UMLClassifierListItem::toString(Uml::Signature_Type sig)
+{
+ Q_UNUSED(sig);
return getName();
}
-UMLClassifier * UMLClassifierListItem::getType() const{
+UMLClassifier * UMLClassifierListItem::getType() const
+{
return static_cast<UMLClassifier*>(m_pSecondary);
}
-QString UMLClassifierListItem::getTypeName() const{
+QString UMLClassifierListItem::getTypeName() const
+{
if (m_pSecondary == NULL)
return m_SecondaryId;
const UMLPackage *typePkg = m_pSecondary->getUMLPackage();
@@ -66,17 +73,19 @@
return m_pSecondary->getName();
}
-void UMLClassifierListItem::setType(UMLObject *type) {
+void UMLClassifierListItem::setType(UMLObject *type)
+{
if (m_pSecondary != type) {
m_pSecondary = type;
UMLObject::emitModified();
}
}
-void UMLClassifierListItem::setTypeName(const QString &type) {
+void UMLClassifierListItem::setTypeName(const QString &type)
+{
if (type.isEmpty() || type == "void") {
m_pSecondary = NULL;
- m_SecondaryId = QString();
+ m_SecondaryId.clear();
return;
}
UMLDoc *pDoc = UMLApp::app()->getDocument();
@@ -85,7 +94,7 @@
// Make data type for easily identified cases
if (Model_Utils::isCommonDataType(type) || type.contains('*')) {
m_pSecondary = Object_Factory::createUMLObject(Uml::ot_Datatype, type);
- uDebug() << "created datatype for " << type << endl;
+ uDebug() << "created datatype for " << type;
} else {
m_SecondaryId = type;
}
--- trunk/KDE/kdesdk/umbrello/umbrello/codeclassfield.cpp #832480:832481
@@ -1,5 +1,4 @@
/***************************************************************************
- * *
* 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 *
@@ -16,20 +15,23 @@
// own header
#include "codeclassfield.h"
-// qt/kde includes
-#include <QtCore/QRegExp>
-#include <kdebug.h>
+
// app includes
#include "association.h"
#include "classifiercodedocument.h"
#include "codegenerator.h"
+#include "codegenerators/codegenfactory.h"
#include "attribute.h"
#include "umlobject.h"
#include "umlrole.h"
#include "uml.h"
-#include "codegenerators/codegenfactory.h"
+// kde includes
+#include <kdebug.h>
+// qt includes
+#include <QtCore/QRegExp>
+
CodeClassField::CodeClassField ( ClassifierCodeDocument * doc , UMLRole * role)
: CodeParameter ( doc , (UMLObject*) role)
{
@@ -112,7 +114,7 @@
}
/**
- * Get the value of m_isAbstract
+ * Get the value of m_isAbstract.
* @return the value of m_isAbstract
*/
bool CodeClassField::parentIsAttribute ( ) const
@@ -130,7 +132,7 @@
}
/**
- * Get the value of m_dialog
+ * Get the value of m_dialog.
* @return the value of m_dialog
*/
/*
@@ -146,7 +148,7 @@
}
/**
- * Add a Method object to the m_methodVector List
+ * Add a Method object to the m_methodVector List.
*/
bool CodeClassField::addMethod ( CodeAccessorMethod * add_object )
{
@@ -167,7 +169,7 @@
}
/**
- * Remove a Method object from m_methodVector List
+ * Remove a Method object from m_methodVector List.
*/
bool CodeClassField::removeMethod ( CodeAccessorMethod * remove_object )
{
@@ -178,7 +180,7 @@
}
/**
- * Get the list of Method objects held by m_methodVector
+ * Get the list of Method objects held by m_methodVector.
* @return QPtrList<CodeMethodBlock *> list of Method objects held by
* m_methodVector
*/
@@ -187,7 +189,8 @@
return m_methodVector;
}
-/** determine if we will *allow* methods to be viewable.
+/**
+ * Determine if we will *allow* methods to be viewable.
* this flag is often used to toggle autogeneration of accessor
* methods in the code class field.
*/
@@ -203,7 +206,7 @@
}
/**
- * return the declaration statement for this class field object.
+ * Return the declaration statement for this class field object.
* will be empty until this (abstract) class is inherited in elsewhere.
*/
CodeClassFieldDeclarationBlock * CodeClassField::getDeclarationCodeBlock( )
@@ -212,14 +215,15 @@
}
/**
- * load params from the appropriate XMI element node.
+ * Load params from the appropriate XMI element node.
*/
void CodeClassField::loadFromXMI ( QDomElement & root )
{
setAttributesFromNode(root);
}
-/** set attributes of the node that represents this class
+/**
+ * Set attributes of the node that represents this class
* in the XMI document.
*/
void CodeClassField::setAttributesOnNode ( QDomDocument & doc, QDomElement & cfElem)
@@ -244,7 +248,8 @@
}
-/** set the class attributes of this object from
+/**
+ * Set the class attributes of this object from
* the passed element node.
*/
void CodeClassField::setAttributesFromNode ( QDomElement & root)
@@ -294,7 +299,7 @@
}
/**
- * Save the XMI representation of this object
+ * Save the XMI representation of this object.
*/
void CodeClassField::saveToXMI ( QDomDocument & doc, QDomElement & root )
{
@@ -405,7 +410,6 @@
void CodeClassField::initAccessorMethods()
{
-
// everything gets potential get/set method
//if(!m_methodMap->contains(CodeAccessorMethod::GET))
if(!findMethodByType(CodeAccessorMethod::GET))
@@ -459,8 +463,6 @@
}
}
-
-
}
void CodeClassField::updateContent()
@@ -578,7 +580,7 @@
void CodeClassField::initFields(bool inConstructor)
{
m_writeOutMethods = false;
- m_listClassName = QString ();
+ m_listClassName.clear();
m_declCodeBlock = NULL;
// m_methodMap = new QMap<CodeAccessorMethod::AccessorType, CodeAccessorMethod *>;
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerationpolicy.cpp #832480:832481
@@ -1,5 +1,4 @@
/***************************************************************************
- * *
* 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 *
@@ -35,6 +34,7 @@
#include "dialogs/codegenerationpolicypage.h"
#include "umbrellosettings.h"
+
using namespace std;
#define MAXLINES 256
@@ -238,7 +238,8 @@
return Settings::getOptionState().codeGenerationState.lineEndingType;
}
-/** Utility function to get the actual characters.
+/**
+ * Utility function to get the actual characters.
*/
QString CodeGenerationPolicy::getNewLineEndingChars ( ) const
{
@@ -264,7 +265,7 @@
void CodeGenerationPolicy::setIndentationAmount ( int amount )
{
- if(amount > -1)
+ if (amount > -1)
{
Settings::getOptionState().codeGenerationState.indentationAmount = amount;
calculateIndentation();
@@ -289,7 +290,7 @@
void CodeGenerationPolicy::calculateIndentation ( )
{
QString indent;
- m_indentation = QString();
+ m_indentation.clear();
switch (Settings::getOptionState().codeGenerationState.indentationType) {
case NONE:
break;
@@ -302,7 +303,7 @@
break;
}
- for (int i=0; i < Settings::getOptionState().codeGenerationState.indentationAmount; i++)
+ for (int i = 0; i < Settings::getOptionState().codeGenerationState.indentationAmount; i++)
m_indentation += indent;
}
@@ -382,7 +383,7 @@
void CodeGenerationPolicy::setDefaults ( CodeGenerationPolicy * clone , bool emitUpdateSignal)
{
- if(!clone)
+ if (!clone)
return;
blockSignals(true); // we need to do this because otherwise most of these
@@ -403,9 +404,8 @@
calculateIndentation();
blockSignals(false); // "as you were citizen"
- if(emitUpdateSignal)
+ if (emitUpdateSignal)
emit modifiedCodeContent();
-
}
void CodeGenerationPolicy::setDefaults(bool emitUpdateSignal)
@@ -427,12 +427,12 @@
calculateIndentation();
QString path = UmbrelloSettings::outputDirectory();
- if(path.isEmpty())
+ if (path.isEmpty())
path = QDir::homePath() + "/uml-generated-code/";
setOutputDirectory ( QDir (path) );
path = UmbrelloSettings::headingsDirectory();
- if(path.isEmpty()) {
+ if (path.isEmpty()) {
KStandardDirs stddirs;
path = stddirs.findDirs("data","umbrello/headings").first();
}
@@ -444,9 +444,8 @@
blockSignals(false); // "as you were citizen"
- if(emitUpdateSignal)
+ if (emitUpdateSignal)
emit modifiedCodeContent();
-
}
void CodeGenerationPolicy::writeConfig ()
@@ -475,9 +474,9 @@
// return the actual text
QString CodeGenerationPolicy::getHeadingFile(const QString& str)
{
- if(!getIncludeHeadings() || str.isEmpty())
+ if (!getIncludeHeadings() || str.isEmpty())
return QString();
- if(str.contains(" ") || str.contains(";")) {
+ if (str.contains(" ") || str.contains(";")) {
uWarning() << "File folder must not have spaces or semi colons!";
return QString();
}
@@ -486,8 +485,8 @@
// get any file with the same extension
QString filename;
QDir headingFiles = Settings::getOptionState().codeGenerationState.headingsDirectory;
- if(str.startsWith('.')) {
- if(QFile::exists(headingFiles.absoluteFilePath("heading"+str)))
+ if (str.startsWith('.')) {
+ if (QFile::exists(headingFiles.absoluteFilePath("heading"+str)))
filename = headingFiles.absoluteFilePath("heading"+str);
else {
QStringList filters;
@@ -503,12 +502,12 @@
filename = headingFiles.absoluteFilePath(str);
}
- if(filename.isEmpty())
+ if (filename.isEmpty())
return QString();
QFile f(filename);
- if(!f.open(QIODevice::ReadOnly)) {
- // uWarning() << "Error opening heading file: " << f.name();
- // uWarning() << "Headings directory was " << headingFiles.absolutePath();
+ if (!f.open(QIODevice::ReadOnly)) {
+ // uWarning() << "Error opening heading file: " << f.name();
+ // uWarning() << "Headings directory was " << headingFiles.absolutePath();
return QString();
}
More information about the umbrello-devel
mailing list