[Uml-devel] kdesdk/umbrello/umbrello/codegenerators
Brian Thomas
thomas at mail630.gsfc.nasa.gov
Fri Nov 14 13:37:04 UTC 2003
CVS commit by thomas:
bug fix: editor was allowing editing of extra, blank line in operations which where in abstract classes/interfaces..strictly speaking these dont have bodies, and shouldnt be editable, except by changing the parent's fields
M +14 -1 cppheadercodeoperation.cpp 1.8
M +2 -0 cppheadercodeoperation.h 1.4
--- kdesdk/umbrello/umbrello/codegenerators/cppheadercodeoperation.h #1.3:1.4
@@ -42,4 +42,6 @@ public:
virtual ~CPPHeaderCodeOperation ( );
+ virtual int lastEditableLine();
+
protected:
--- kdesdk/umbrello/umbrello/codegenerators/cppheadercodeoperation.cpp #1.7:1.8
@@ -38,4 +38,5 @@ void CPPHeaderCodeOperation::updateMetho
{
+ bool isInterface = ((ClassifierCodeDocument*)getParentDocument())->parentIsInterface();
UMLOperation * o = getParentOperation();
@@ -68,7 +69,19 @@ void CPPHeaderCodeOperation::updateMetho
}
- QString startText = returnType + methodName + " ("+paramStr+");";
+ QString startText = returnType + methodName + " ("+paramStr+")";
+ if(isInterface || o->getAbstract()) // write as an abstract operation if explicitly stated OR if child of interface
+ startText += " = 0";
+ startText+=";";
setStartMethodText(startText);
+}
+
+int CPPHeaderCodeOperation::lastEditableLine() {
+ ClassifierCodeDocument * doc = (ClassifierCodeDocument*)getParentDocument();
+ UMLOperation * o = getParentOperation();
+ if(doc->parentIsInterface() || o->getAbstract())
+ return -1; // very last line is NOT editable as its a one-line declaration w/ no body in
+ // an interface.
+ return 0;
}
More information about the umbrello-devel
mailing list