[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Sat Oct 8 12:40:08 UTC 2011
SVN commit 1257949 by fischer:
Krazy issues for copyright and crashy fixed same as in trunk.
M +19 -13 codeaccessormethod.cpp
M +1 -13 codeaccessormethod.h
M +11 -6 codegenerators/codegenerator.cpp
M +14 -9 codegenerators/simplecodegenerator.cpp
M +3 -4 codeviewerstate.h
--- branches/work/soc-umbrello/umbrello/codeaccessormethod.cpp #1257948:1257949
@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2003 thomas *
+ * copyright (C) 2003 Brian Thomas <thomas at mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2011 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -15,18 +15,20 @@
// qt/kde includes
// local includes
-#include "classifiercodedocument.h"
#include "codeclassfield.h"
-#include "attribute.h"
-#include "umlobject.h"
-#include "umlrole.h"
+/**
+ * Constructors
+ */
CodeAccessorMethod::CodeAccessorMethod ( CodeClassField * parentCF )
: CodeMethodBlock ( parentCF->getParentDocument(), parentCF->getParentObject() )
{
initFields(parentCF);
}
+/**
+ * Empty Destructor
+ */
CodeAccessorMethod::~CodeAccessorMethod ( )
{
}
@@ -72,20 +74,25 @@
m_accessorType = atype;
}
-// this type of textblock is special
-// we DON'T release it when resetTextBlocks is
-// called because we re-use it over and over
-// until the codeclassfield is released.
+/**
+ * This type of textblock is special
+ * we DON'T release it when resetTextBlocks is
+ * called because we re-use it over and over
+ * until the codeclassfield is released.
+ */
void CodeAccessorMethod::release ()
{
// do nothing
}
-// ok, a method so the parent can force it to release
+/**
+ * A method so the parent code classfield can force code block to release.
+ */
void CodeAccessorMethod::forceRelease ()
{
- if(m_parentclassfield)
+ if (m_parentclassfield) {
m_parentclassfield->disconnect(this);
+ }
CodeMethodBlock::release();
}
@@ -165,8 +172,7 @@
CodeMethodBlock::setAttributesFromObject(obj);
CodeAccessorMethod * mb = dynamic_cast<CodeAccessorMethod*>(obj);
- if(mb)
- {
+ if (mb) {
m_parentclassfield->disconnect(this); // always disconnect
initFields(mb->getParentClassField());
--- branches/work/soc-umbrello/umbrello/codeaccessormethod.h #1257948:1257949
@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2003 thomas *
+ * copyright (C) 2003 Brian Thomas <thomas at mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2011 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -31,14 +31,7 @@
// "LIST" is to retrive the entire list of items in a multiple-valued field
enum AccessorType {GET=0, SET, ADD, REMOVE, LIST};
- /**
- * Constructors
- */
CodeAccessorMethod ( CodeClassField * field );
-
- /**
- * Empty Destructor
- */
virtual ~CodeAccessorMethod ( );
CodeClassField * getParentClassField ( );
@@ -47,9 +40,6 @@
void setType ( AccessorType type);
- /**
- * Utility method to get the value of the parent object of the parent classifield.
- */
// virtual UMLObject * getParentObject();
bool parentIsAttribute();
@@ -57,7 +47,6 @@
virtual void updateContent() = 0;
virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
-
virtual void loadFromXMI ( QDomElement & root );
virtual void setAttributesFromObject (TextBlock * obj);
@@ -72,7 +61,6 @@
virtual void updateMethodDeclaration() = 0;
- // a method so the parent code classfield can force code block to release
void forceRelease ();
private:
--- branches/work/soc-umbrello/umbrello/codegenerators/codegenerator.cpp #1257948:1257949
@@ -38,8 +38,9 @@
// qt includes
#include <QtCore/QDateTime>
+#include <QtCore/QDir>
+#include <QtCore/QPointer>
#include <QtCore/QRegExp>
-#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
@@ -508,16 +509,17 @@
}
int suffix;
- OverwriteDialogue overwriteDialog( name, outputDirectory.absolutePath(),
+ QPointer<OverwriteDialogue> overwriteDialog =
+ new OverwriteDialogue(name, outputDirectory.absolutePath(),
m_applyToAllRemaining, kapp->activeWindow() );
switch (pol->getOverwritePolicy()) { //if it exists, check the OverwritePolicy we should use
case CodeGenerationPolicy::Ok: //ok to overwrite file
filename = name + extension;
break;
case CodeGenerationPolicy::Ask: //ask if we can overwrite
- switch(overwriteDialog.exec()) {
+ switch(overwriteDialog->exec()) {
case KDialog::Yes: //overwrite file
- if ( overwriteDialog.applyToAllRemaining() ) {
+ if ( overwriteDialog->applyToAllRemaining() ) {
pol->setOverwritePolicy(CodeGenerationPolicy::Ok);
filename = name + extension;
}
@@ -533,7 +535,7 @@
break;
suffix++;
}
- if ( overwriteDialog.applyToAllRemaining() ) {
+ if ( overwriteDialog->applyToAllRemaining() ) {
pol->setOverwritePolicy(CodeGenerationPolicy::Never);
}
else {
@@ -541,12 +543,13 @@
}
break;
case KDialog::Cancel: //don't output anything
- if ( overwriteDialog.applyToAllRemaining() ) {
+ if ( overwriteDialog->applyToAllRemaining() ) {
pol->setOverwritePolicy(CodeGenerationPolicy::Cancel);
}
else {
m_applyToAllRemaining = false;
}
+ delete overwriteDialog;
return QString();
break;
}
@@ -563,10 +566,12 @@
}
break;
case CodeGenerationPolicy::Cancel: //don't output anything
+ delete overwriteDialog;
return QString();
break;
}
+ delete overwriteDialog;
return filename;
}
--- branches/work/soc-umbrello/umbrello/codegenerators/simplecodegenerator.cpp #1257948:1257949
@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas at mail630.gsfc.nasa.gov> *
- * copyright (C) 2004-2010 *
+ * copyright (C) 2004-2011 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -33,8 +33,9 @@
// qt includes
#include <QtCore/QDateTime>
+#include <QtCore/QDir>
+#include <QtCore/QPointer>
#include <QtCore/QRegExp>
-#include <QtCore/QDir>
// system includes
#include <cstdlib> //to get the user name
@@ -164,15 +165,16 @@
}
int suffix;
- OverwriteDialogue overwriteDialogue( filename, outputDir.absolutePath(),
+ QPointer<OverwriteDialogue> overwriteDialogue =
+ new OverwriteDialogue(filename, outputDir.absolutePath(),
m_applyToAllRemaining, kapp->activeWindow() );
switch(commonPolicy->getOverwritePolicy()) { //if it exists, check the OverwritePolicy we should use
case CodeGenerationPolicy::Ok: //ok to overwrite file
break;
case CodeGenerationPolicy::Ask: //ask if we can overwrite
- switch(overwriteDialogue.exec()) {
+ switch(overwriteDialogue->exec()) {
case KDialog::Yes: //overwrite file
- if ( overwriteDialogue.applyToAllRemaining() ) {
+ if ( overwriteDialogue->applyToAllRemaining() ) {
commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Ok);
} else {
m_applyToAllRemaining = false;
@@ -186,19 +188,20 @@
break;
suffix++;
}
- if ( overwriteDialogue.applyToAllRemaining() ) {
+ if ( overwriteDialogue->applyToAllRemaining() ) {
commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Never);
} else {
m_applyToAllRemaining = false;
}
break;
case KDialog::Cancel: //don't output anything
- if ( overwriteDialogue.applyToAllRemaining() ) {
+ if ( overwriteDialogue->applyToAllRemaining() ) {
commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Cancel);
} else {
m_applyToAllRemaining = false;
}
- return NULL;
+ delete overwriteDialogue;
+ return QString();
break;
}
@@ -213,11 +216,13 @@
}
break;
case CodeGenerationPolicy::Cancel: //don't output anything
- return NULL;
+ delete overwriteDialogue;
+ return QString();
break;
}
m_fileMap.insert(concept, filename);
+ delete overwriteDialogue;
return filename;
}
--- branches/work/soc-umbrello/umbrello/codeviewerstate.h #1257948:1257949
@@ -1,19 +1,18 @@
/***************************************************************************
- * *
* 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) 2004-2007 *
+ * copyright (C) 2004-2011 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
#ifndef CODEVIEWERSTATE_H
#define CODEVIEWERSTATE_H
-#include <qcolor.h>
-#include <qfont.h>
+#include <QtGui/QColor>
+#include <QtGui/QFont>
namespace Settings {
More information about the umbrello-devel
mailing list