[Uml-devel] branches/KDE/3.5/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Aug 25 17:18:52 UTC 2006
SVN commit 577139 by okellogg:
Patch from Clarke Brunsdon at
http://www.nullfs.com/umbrello_php5_generator_realization_stub.patch
adds stub-methods for all interfaces a class implements.
M +1 -0 THANKS
M +41 -8 umbrello/codegenerators/php5writer.cpp
M +1 -1 umbrello/codegenerators/php5writer.h
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #577138:577139
@@ -20,6 +20,7 @@
Zoltan Bartko <bartko.zoltan @pobox.sk>
Luis De la Parra Blum <lparrab @gmx.net>
Raymond Bosman <bosman @hetnet.nl>
+Clarke Brunsdon <clarke @vossoc.org>
Ben Burton <bab @debian.org>
Albert Cervera <albertca @jazzfree.com>
Albert Astals Cid <tsdgeos @terra.es>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/php5writer.cpp #577138:577139
@@ -3153,6 +3153,7 @@
UMLOperationList oppub,opprot,oppriv;
bool isInterface = c->isInterface();
+ bool generateErrorStub = false;
oppub.setAutoDelete(false);
opprot.setAutoDelete(false);
@@ -3181,21 +3182,47 @@
//write operations to file
if(forceSections() || !oppub.isEmpty()) {
php << m_endl;
- writeOperations(classname,oppub,php,isInterface);
+ writeOperations(classname,oppub,php,isInterface,generateErrorStub);
}
if(forceSections() || !opprot.isEmpty()) {
php << m_endl;
- writeOperations(classname,opprot,php,isInterface);
+ writeOperations(classname,opprot,php,isInterface,generateErrorStub);
}
if(forceSections() || !oppriv.isEmpty()) {
php << m_endl;
- writeOperations(classname,oppriv,php,isInterface);
+ writeOperations(classname,oppriv,php,isInterface,generateErrorStub);
}
+
+
+ // build an oplist for all of the realized operations
+ UMLOperationList opreal;
+ opreal.setAutoDelete(false);
+
+ // go through each of the realizations, taking each op
+ UMLAssociationList realizations = c->getRealizations();
+ UMLAssociation *a;
+
+ if( !realizations.isEmpty()) {
+ for (a = realizations.first(); a; a = realizations.next()) {
+
+ // we know its a classifier if its in the list
+ UMLClassifier *real = (UMLClassifier*)a->getObject(Uml::B);
+
+ UMLOperationList opl(real->getOpList());
+ for(UMLOperation *op = opl.first(); op ; op = opl.next()) {
+ opreal.append(op);
+ }
+ }
+ }
+
+ // write out all the realizations operations
+ writeOperations(classname,opreal,php,false,true);
+
}
-void Php5Writer::writeOperations(QString /* classname */, UMLOperationList &opList, QTextStream &php, bool isInterface = false) {
+void Php5Writer::writeOperations(QString /* classname */, UMLOperationList &opList, QTextStream &php, bool isInterface = false, bool generateErrorStub = false) {
UMLOperation *op;
UMLAttributeList *atl;
UMLAttribute *at;
@@ -3216,7 +3243,7 @@
{
if(forceDoc() || !at->getDoc().isEmpty()) {
php <<m_indentation << " * @param " + at->getTypeName() + " " + cleanName(at->getName());
- php << " " + formatDoc(at->getDoc(),"");
+ php << " " + formatDoc(at->getDoc(),"") << m_endl;
}
}//end for : write parameter documentation
php << m_indentation << " * @return " << op->getTypeName() << m_endl;
@@ -3266,10 +3293,16 @@
<< ((j < i-1)?", ":"");
}
php <<" )";
- if(!isInterface && !op->getAbstract())
- php << " {" << m_endl << m_indentation << m_indentation << m_endl << m_indentation << "} // end of member function " + cleanName(op->getName()) + m_endl;
- else
+ if(!isInterface && !op->getAbstract()) {
+ php << " {" << m_endl << m_indentation << m_indentation;
+ if(generateErrorStub) {
+ php << "trigger_error(\"Implement \" . __FUNCTION__);";
+ }
+ php << m_endl << m_indentation << "} // end of member function " + cleanName(op->getName()) + m_endl;
+ }
+ else {
php << ";" + m_endl;
+ }
php << m_endl;
}//end for
}
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/php5writer.h #577138:577139
@@ -75,7 +75,7 @@
* @param interface indicates if the operation is an interface member
*/
void writeOperations(QString classname, UMLOperationList &opList,
- QTextStream &php, bool interface);
+ QTextStream &php, bool interface, bool generateErrorStub);
/** write all the attributes of a class
* @param c the class we are generating code for
More information about the umbrello-devel
mailing list