[Uml-devel] KDE/kdesdk/umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Sun Jan 6 12:58:33 UTC 2008
SVN commit 757906 by fischer:
fixing some compiler warnings
M +10 -35 codegenerators/cppcodecomment.cpp
M +15 -30 codegenerators/cppcodecomment.h
M +1 -1 codegenobjectwithtextblocks.h
M +40 -42 docgenerators/docbookgeneratorjob.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppcodecomment.cpp #757905:757906
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2004-2007 *
+ * copyright (C) 2004-2008 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -19,50 +19,28 @@
#include "cppcodecomment.h"
// qt/kde includes
-#include <qregexp.h>
+#include <QtCore/QRegExp>
-// Constructors/Destructors
-//
CPPCodeComment::CPPCodeComment ( CodeDocument * doc, const QString & text )
: CodeComment (doc, text)
{
+}
+CPPCodeComment::~CPPCodeComment ( )
+{
}
-CPPCodeComment::~CPPCodeComment ( ) { }
-
-//
-// Methods
-//
-
-
-// Accessor methods
-//
-
-
-// Public attribute accessor methods
-//
-
-// Other methods
-//
-
-/**
- * Save the XMI representation of this object
- */
-void CPPCodeComment::saveToXMI ( QDomDocument & doc, QDomElement & root ) {
+void CPPCodeComment::saveToXMI ( QDomDocument & doc, QDomElement & root )
+{
QDomElement blockElement = doc.createElement( "cppcodecomment" );
setAttributesOnNode(doc, blockElement); // as we added no additional fields to this class we may
// just use parent TextBlock method
root.appendChild( blockElement );
}
-/**
- * @return QString
- */
-QString CPPCodeComment::toString ( )
+QString CPPCodeComment::toString ( ) const
{
-
QString output = "";
// simple output method
@@ -76,17 +54,14 @@
return output;
}
-QString CPPCodeComment::getNewEditorLine ( int amount ) {
+QString CPPCodeComment::getNewEditorLine ( int amount )
+{
QString line = getIndentationString(amount) + "// ";
return line;
}
-/** UnFormat a long text string. Typically, this means removing
- * the indentaion (linePrefix) and/or newline chars from each line.
- */
QString CPPCodeComment::unformatText ( const QString & text , const QString & indent)
{
-
// remove leading or trailing comment stuff
QString mytext = TextBlock::unformatText(text, indent);
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppcodecomment.h #757905:757906
@@ -14,70 +14,55 @@
*/
-
#ifndef CPPCODECOMMENT_H
#define CPPCODECOMMENT_H
-#include <qstring.h>
+#include <QtCore/QString>
#include "../codecomment.h"
/**
- * class CPPCodeComment
- * A CPP code comment. There is only a single styles of comments:
- * these are simply started with double slash sequence and no terminating
- * characters
- */
-
+ * A CPP code comment. There is only a single styles of comments:
+ * these are simply started with double slash sequence and no terminating
+ * characters.
+ */
class CPPCodeComment : virtual public CodeComment
{
Q_OBJECT
public:
- // Constructors/Destructors
- //
-
-
/**
- * Constructors
+ * Constructors.
*/
explicit CPPCodeComment ( CodeDocument * doc, const QString & text = "");
/**
- * Empty Destructor
+ * Empty Destructor.
*/
virtual ~CPPCodeComment ( );
- // Public attributes
- //
-
-
- // other
-
/**
- * Save the XMI representation of this object
+ * Save the XMI representation of this object.
*/
virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
/**
* @return QString
*/
- QString toString ( );
+ QString toString ( ) const;
- /** UnFormat a long text string. Typically, this means removing
- * the indentaion (linePrefix) and/or newline chars from each line.
- */
+ /**
+ * UnFormat a long text string. Typically, this means removing
+ * the indentaion (linePrefix) and/or newline chars from each line.
+ */
virtual QString unformatText ( const QString & text, const QString & indent = "" );
- /** a special version here because we want to not only indent
+ /**
+ * A special version here because we want to not only indent
* the new line, but to add the "//" sequence as well.
*/
virtual QString getNewEditorLine ( int amount );
-protected:
-
-private:
-
};
#endif // CPPCODECOMMENT_H
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenobjectwithtextblocks.h #757905:757906
@@ -160,7 +160,7 @@
*/
virtual void setAttributesFromNode ( QDomElement & element);
- virtual void setAttributesFromObject (CodeGenObjectWithTextBlocks * obj);
+ /*virtual*/ void setAttributesFromObject (CodeGenObjectWithTextBlocks * obj);
/**
* In this vanilla version, we only load comments and codeblocks
--- trunk/KDE/kdesdk/umbrello/umbrello/docgenerators/docbookgeneratorjob.cpp #757905:757906
@@ -5,7 +5,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2007 *
+ * copyright (C) 2008 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -22,7 +22,7 @@
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
-#include <QTextOStream>
+#include <QtCore/QTextOStream>
#include <ktemporaryfile.h>
#include <kstandarddirs.h>
@@ -34,62 +34,60 @@
extern int xmlLoadExtDtdDefaultValue;
-DocbookGeneratorJob::DocbookGeneratorJob( QObject* parent ):
- QThread(parent) {
+DocbookGeneratorJob::DocbookGeneratorJob(QObject* parent):
+ QThread(parent)
+{
}
void DocbookGeneratorJob::run()
{
+ UMLApp* app = UMLApp::app();
+ UMLDoc* umlDoc = app->getDocument();
- UMLApp* app = UMLApp::app();
- UMLDoc* umlDoc = app->getDocument();
+ //write the XMI model in an in-memory char* string
+ QString xmi;
+ QTextOStream xmiStream(&xmi);
- //write the XMI model in an in-memory char* string
- QString xmi;
- QTextOStream xmiStream(&xmi);
+ KTemporaryFile file; // we need this tmp file if we are writing to a remote file
+ file.setAutoRemove(false);
- KTemporaryFile file; // we need this tmp file if we are writing to a remote file
- file.setAutoRemove(false);
+ // lets open the file for writing
+ if (!file.open()) {
+ uError() << "There was a problem saving file" << file.fileName();
+ return;
+ }
- // lets open the file for writing
- if( !file.open() ) {
- uError()<<"There was a problem saving file"<<file.fileName();
- return;
- }
+ umlDoc->saveToXMI(file); // save the xmi stuff to it
- umlDoc->saveToXMI(file); // save the xmi stuff to it
+ xsltStylesheetPtr cur = NULL;
+ xmlDocPtr doc, res;
- xsltStylesheetPtr cur = NULL;
- xmlDocPtr doc, res;
+ const char *params[16 + 1];
+ int nbparams = 0;
+ params[nbparams] = NULL;
- const char *params[16 + 1];
- int nbparams = 0;
- params[nbparams] = NULL;
+ QString xsltFile(KGlobal::dirs()->findResource("appdata", "xmi2docbook.xsl"));
- QString xsltFile(KGlobal::dirs()->findResource("appdata","xmi2docbook.xsl"));
+ xmlSubstituteEntitiesDefault(1);
+ xmlLoadExtDtdDefaultValue = 1;
+ cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.toLatin1().constData());
+ doc = xmlParseFile((const char*)(file.fileName().toUtf8()));
+ res = xsltApplyStylesheet(cur, doc, params);
- xmlSubstituteEntitiesDefault(1);
- xmlLoadExtDtdDefaultValue = 1;
- cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.latin1());
- doc = xmlParseFile((const char*)(file.fileName().toUtf8()));
- res = xsltApplyStylesheet(cur, doc, params);
+ KTemporaryFile tmpDocBook;
+ tmpDocBook.setAutoRemove(false);
+ tmpDocBook.open();
+ umlDoc->writeToStatusBar(i18n("Exporting to DocBook..."));
+ xsltSaveResultToFd(tmpDocBook.handle(), res, cur);
+ xsltFreeStylesheet(cur);
+ xmlFreeDoc(res);
+ xmlFreeDoc(doc);
- KTemporaryFile tmpDocBook;
- tmpDocBook.setAutoRemove(false);
- tmpDocBook.open();
+ xsltCleanupGlobals();
+ xmlCleanupParser();
- umlDoc->writeToStatusBar(i18n("Exporting to DocBook..."));
- xsltSaveResultToFd(tmpDocBook.handle(), res, cur);
- xsltFreeStylesheet(cur);
- xmlFreeDoc(res);
- xmlFreeDoc(doc);
-
- xsltCleanupGlobals();
- xmlCleanupParser();
-
- emit docbookGenerated(tmpDocBook.fileName());
-
+ emit docbookGenerated(tmpDocBook.fileName());
}
#include "docbookgeneratorjob.moc"
More information about the umbrello-devel
mailing list