[Uml-devel] branches/KDE/3.5/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri May 25 21:54:35 UTC 2007
SVN commit 668297 by okellogg:
writeAttributes(): New. Write attribute documentation, name, and visibility
in a Python comment section.
BUG:145916
M +1 -0 ChangeLog
M +18 -1 umbrello/codegenerators/pythonwriter.cpp
M +9 -0 umbrello/codegenerators/pythonwriter.h
--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #668296:668297
@@ -3,6 +3,7 @@
* Bugs/wishes from http://bugs.kde.org:
* Unstable saves and loads, class names become dirty (145709)
* Crash on deleting class in list view (145762)
+* Class attribute documentation not generated for python (145916)
* Python code generator does not wrap lines properly (145918)
Version 1.5.7
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #668296:668297
@@ -30,6 +30,7 @@
#include "../association.h"
#include "../attribute.h"
#include "../classifier.h"
+#include "../attribute.h"
#include "../operation.h"
#include "../umlnamespace.h"
@@ -143,6 +144,9 @@
m_bNeedPass = false;
}
+ // attributes
+ writeAttributes(c->getAttributeList(), h);
+
//operations
writeOperations(c,h);
@@ -161,8 +165,21 @@
////////////////////////////////////////////////////////////////////////////////////
// Helper Methods
-void PythonWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
+void PythonWriter::writeAttributes(UMLAttributeList atList, QTextStream &py) {
+ if (!forceDoc() || atList.count() == 0)
+ return;
+ py << m_indentation << "\"\"\" ATTRIBUTES" << m_endl << m_endl;
+ for (UMLAttribute *at = atList.first(); at; at = atList.next()) {
+ py << formatDoc(at->getDoc(), m_indentation + ' ') << m_endl;
+ Uml::Visibility vis = at->getVisibility();
+ py << m_indentation << cleanName(at->getName()) << " ("
+ << vis.toString() << ")" << m_endl << m_endl ;
+ } // end for
+ py << m_indentation << "\"\"\"" << m_endl << m_endl;
+}
+void PythonWriter::writeOperations(UMLClassifier *c, QTextStream &h) {
+
//Lists to store operations sorted by scope
UMLOperationList oppub,opprot,oppriv;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.h #668296:668297
@@ -20,6 +20,7 @@
#define PYTHONWRITER_H
#include "simplecodegenerator.h"
+#include "../umlattributelist.h"
#include "../umloperationlist.h"
enum Access {PRIVATE, PUBLIC, PROTECTED};
@@ -54,6 +55,14 @@
private:
/**
+ * write all attributes for a given class
+ *
+ * @param c the concept we are generating code for
+ * @param py output stream for the header file
+ */
+ void writeAttributes(UMLAttributeList atList, QTextStream &py);
+
+ /**
* write all operations for a given class
*
* @param c the concept we are generating code for
More information about the umbrello-devel
mailing list