[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Mar 22 23:06:51 UTC 2007


SVN commit 645575 by okellogg:

small cleanings

 M  +8 -4      classifiercodedocument.cpp  
 M  +1 -1      codegenerators/cppsourcecodedocument.cpp  
 M  +4 -3      codegenobjectwithtextblocks.cpp  
 M  +1 -1      codeoperation.cpp  
 M  +2 -1      hierarchicalcodeblock.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifiercodedocument.cpp #645574:645575
@@ -264,16 +264,20 @@
 /**
  * @param       op
  */
-void ClassifierCodeDocument::addOperation (UMLClassifierListItem * op ) {
-
-    QString tag = CodeOperation::findTag((UMLOperation*)op);
+void ClassifierCodeDocument::addOperation (UMLClassifierListItem * o) {
+    UMLOperation *op = dynamic_cast<UMLOperation*>(o);
+    if (op == NULL) {
+        kError() << "ClassifierCodeDocument::addOperation: arg is not a UMLOperation"
+            << endl;
+    }
+    QString tag = CodeOperation::findTag(op);
     CodeOperation * codeOp = dynamic_cast<CodeOperation*>(findTextBlockByTag(tag, true));
     bool createdNew = false;
 
     // create the block, if it doesn't already exist
     if(!codeOp)
     {
-        codeOp = CodeGenFactory::newCodeOperation(this, (UMLOperation*)op);
+        codeOp = CodeGenFactory::newCodeOperation(this, op);
         createdNew = true;
     }
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppsourcecodedocument.cpp #645574:645575
@@ -109,7 +109,7 @@
 // based on the parent classifier object.
 // For any situation in which this is called, we are either building the code
 // document up, or replacing/regenerating the existing auto-generated parts. As
-// such, we will want to insert everything we resonablely will want
+// such, we will want to insert everything we reasonably will want
 // during creation. We can set various parts of the document (esp. the
 // comments) to appear or not, as needed.
 void CPPSourceCodeDocument::updateContent( )
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenobjectwithtextblocks.cpp #645574:645575
@@ -155,7 +155,8 @@
         {
             HierarchicalCodeBlock * hb = dynamic_cast<HierarchicalCodeBlock*>(tb);
             if(hb) {
-                CodeGenObjectWithTextBlocks * obj = ((CodeGenObjectWithTextBlocks*)hb)->findParentObjectForTaggedTextBlock(tag);
+                CodeGenObjectWithTextBlocks* cgowtb = dynamic_cast<CodeGenObjectWithTextBlocks*>(hb);
+                CodeGenObjectWithTextBlocks * obj = cgowtb->findParentObjectForTaggedTextBlock(tag);
                 if(obj)
                     return obj;
             }
@@ -179,7 +180,7 @@
 HierarchicalCodeBlock * CodeGenObjectWithTextBlocks::getHierarchicalCodeBlock ( const QString &tag, const QString &comment, int indentLevel ) {
 
     // now actually declare the fields
-    HierarchicalCodeBlock * codeBlock = (HierarchicalCodeBlock*) findTextBlockByTag(tag);
+    HierarchicalCodeBlock * codeBlock = dynamic_cast<HierarchicalCodeBlock*>(findTextBlockByTag(tag));
     if (!codeBlock) {
         codeBlock = newHierarchicalCodeBlock();
         codeBlock->setTag(tag);
@@ -211,7 +212,7 @@
 CodeBlockWithComments * CodeGenObjectWithTextBlocks::getCodeBlockWithComments ( const QString &tag, const QString &comment, int indentLevel ) {
 
     // now actually declare the fields
-    CodeBlockWithComments * codeBlock = (CodeBlockWithComments *) findTextBlockByTag(tag);
+    CodeBlockWithComments * codeBlock = dynamic_cast<CodeBlockWithComments*>(findTextBlockByTag(tag));
     if (!codeBlock) {
         codeBlock = newCodeBlockWithComments();
         codeBlock->setTag(tag);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeoperation.cpp #645574:645575
@@ -75,7 +75,7 @@
  * Get the parent UMLOperation of this codeoperation.
  */
 UMLOperation * CodeOperation::getParentOperation( ) {
-    return (UMLOperation*) getParentObject();
+    return dynamic_cast<UMLOperation*>(getParentObject());
 }
 
 // Other methods
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/hierarchicalcodeblock.cpp #645574:645575
@@ -297,7 +297,8 @@
     {
         setStartText(hb->getStartText());
         setEndText(hb->getEndText());
-        CodeGenObjectWithTextBlocks::setAttributesFromObject((CodeGenObjectWithTextBlocks*)obj);
+        CodeGenObjectWithTextBlocks *cgowtb = dynamic_cast<CodeGenObjectWithTextBlocks*>(obj);
+        CodeGenObjectWithTextBlocks::setAttributesFromObject(cgowtb);
     }
 
 }




More information about the umbrello-devel mailing list