aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMax Waterman <david.waterman@nokia.com>2010-08-21 20:17:14 +0300
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-08-25 13:00:24 +0300
commit2dc7024f62ca6e5f90bff1d4dc34aa818da2abd8 (patch)
treeec5d45e055b651cee69535dfba230110815a376d /tools
parent58963e535d06779827eed6dc3682ddb166cf5356 (diff)
Changes: fixes to the documentation feature of m-servicefwgen
RevBy: Holger Schröder Details: Changes as a result of making meego service interfaces documentation work.
Diffstat (limited to 'tools')
-rw-r--r--tools/m-servicefwgen.d/m-servicefwgen.cpp109
1 files changed, 69 insertions, 40 deletions
diff --git a/tools/m-servicefwgen.d/m-servicefwgen.cpp b/tools/m-servicefwgen.d/m-servicefwgen.cpp
index 76030ec7..18292a33 100644
--- a/tools/m-servicefwgen.d/m-servicefwgen.cpp
+++ b/tools/m-servicefwgen.d/m-servicefwgen.cpp
@@ -415,7 +415,7 @@ QString getDoxygenFromXml( const QString& xml, int indentCount )
int errorLine;
int errorColumn;
- QHash<const QString, QString> xmlTokens;
+ QHash<const QString, QStringList> xmlTokens;
doc.setContent(xml, true, &errorStr, &errorLine, &errorColumn);
@@ -424,7 +424,9 @@ QString getDoxygenFromXml( const QString& xml, int indentCount )
el = el.firstChildElement( "arg" );
while ( ! el.isNull() ) {
- xmlTokens.insert( el.attribute( "tag" ), el.text() );
+ QString attribute = el.attribute( "tag" );
+ QString text = el.text();
+ xmlTokens[ attribute ] << text;
el = el.nextSiblingElement( "arg" );
}
@@ -438,7 +440,7 @@ QString getDoxygenFromXml( const QString& xml, int indentCount )
QTextStream s( &result );
QStringList doxTokens;
- doxTokens << "class" << "brief" << "details" << "state" << "ingroup";
+ doxTokens << "class" << "brief" << "param" << "return" << "details" << "state" << "ingroup";
s << "\n" << indent << "/**\n";
@@ -449,18 +451,20 @@ QString getDoxygenFromXml( const QString& xml, int indentCount )
if ( !xmlTokens.value( dT ).isEmpty() ) {
hasDoc = true;
- QString longLine = "@" + dT + " " + xmlTokens.value( dT );
+ foreach( const QString xT, xmlTokens[dT]) {
+ QString longLine = "@" + dT + " " + xT;
- while ( !longLine.isEmpty() ) {
- int pos = longLine.indexOf( ' ', 60 - indentCount );
+ while ( !longLine.isEmpty() ) {
+ int pos = longLine.indexOf( ' ', 60 - indentCount );
- if ( pos == -1 ) {
- pos = longLine.length();
- }
+ if ( pos == -1 ) {
+ pos = longLine.length();
+ }
- QString line = longLine.left( pos );
- longLine = longLine.mid( pos );
- s << indent << " * " << line << "\n";
+ QString line = longLine.left( pos );
+ longLine = longLine.mid( pos );
+ s << indent << " * " << line << "\n";
+ }
}
}
}
@@ -516,7 +520,7 @@ QString Worker::botBitH()
public:\n\
/*!\n\
* @brief Constructs a base interface\n\
- * @param preferredService, define the preferred service provider. Leave\n\
+ * @param preferredService the preferred service provider. Leave\n\
* empty if no preferred provider. In most cases, this should be left\n\
* empty.\n\
* @param parent Parent object\n\
@@ -664,6 +668,7 @@ void Worker::preprocessXML()
}
QDomElement el = node.toElement();
+
el = el.firstChildElement( "interface" );
// try to save and drop <doc> child of <interface>
@@ -688,38 +693,44 @@ void Worker::preprocessXML()
}
}
- // walk over the methods
- el = el.firstChildElement( "method" );
+ QDomElement start = el;
- while ( ! el.isNull() ) {
- // now handle chainTask and asyncTask for this method
- if ( el.attribute( "chainTask" ) == "true" ) {
- el.setAttribute( "name", el.attribute( "name" ) + chainTag() );
- setNeedsMApplication( true );
- }
+ // walk over the methods and signals
+ foreach( const QString methSig, QStringList() << "signal" << "method" ) {
+ el = start.firstChildElement( methSig );
- if ( el.attribute( "asyncTask" ) == "true" ) {
- el.setAttribute( "name", el.attribute( "name" ) + asyncTag() );
- setNeedsMApplication( true );
- }
+ while ( ! el.isNull() ) {
+ // now handle chainTask and asyncTask for this method
+ if ( el.attribute( "chainTask" ) == "true" ) {
+ el.setAttribute( "name", el.attribute( "name" ) + chainTag() );
+ setNeedsMApplication( true );
+ }
- // handle doc
- if ( ! el.firstChildElement( "doc" ).isNull() ) {
- QString string;
- QTextStream stream( &string );
- el.firstChildElement( "doc" ).save( stream, 4 );
+ if ( el.attribute( "asyncTask" ) == "true" ) {
+ el.setAttribute( "name", el.attribute( "name" ) + asyncTag() );
+ setNeedsMApplication( true );
+ }
- ++docTagNo;
- setMethodDoc( docTagNo, string );
+ // handle doc
+ if ( ! el.firstChildElement( "doc" ).isNull() ) {
+ QString name = el.attribute( "name" );
+ QString string;
+ QTextStream stream( &string );
+ el.firstChildElement( "doc" ).save( stream, 4 );
- // mangle doc tag into class name
- el.setAttribute( "name", el.attribute( "name" ) + docTag() + QString::number(docTagNo) );
+ ++docTagNo;
+ setMethodDoc( docTagNo, string );
- el.removeChild( el.firstChildElement( "doc" ) );
- }
+ // mangle doc tag into class name
+ el.setAttribute( "name", name + docTag() + QString::number(docTagNo) );
+ el.removeChild( el.firstChildElement( "doc" ) );
+ }
+
+
+ el = el.nextSiblingElement( methSig );
+ }
- el = el.nextSiblingElement( "method" );
}
outFile.write( qPrintable( doc.toString( 4 ) ) );
@@ -1235,7 +1246,7 @@ void processProxyHeaderFile()
wrapperHeaderStream << w.middleBitH();
} else if (line.contains( "Command line was:")) {
// do nothing - the replacement for this line is output by the above
- } else if ( line.contains( w.docTag() ) ) {
+ } else if ( line.contains( w.docTag() ) && !inSignalSection ) {
// we have to handle doxygen doc here.
// we have three cases:
// - class documentation
@@ -1273,7 +1284,25 @@ void processProxyHeaderFile()
if (atEndOfSignalSection) {
inSignalSection = false;
} else {
- ifSignals.append(line);
+ QString lineWithDoc = "";
+ // method docs
+ QRegExp rx( w.docTag() + "(\\d+)" );
+
+ // do the match
+ if ( rx.indexIn( line ) != -1) {
+ int id = rx.cap( 1 ).toInt();
+
+ if ( id > 0 ) {
+ lineWithDoc = w.mangledMethodDoc( id );
+ }
+ }
+
+ // remove docTag with possible number suffix
+ w.removeDocTag( line );
+
+ lineWithDoc += line;
+
+ ifSignals.append(lineWithDoc);
}
} else {
if (line.contains("Q_SIGNALS:")) {
@@ -1370,7 +1399,7 @@ void processProxyHeaderFile()
} // ! proxyHeaderStream.atEnd()
- w.setAllSignals( ifSignals.join("") );
+ w.setAllSignals( ifSignals.join("\n") );
w.createConnectSignalCommands( ifSignals );
wrapperCppStream << w.botBitC() << endl;