summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/rubywriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'umbrello/umbrello/codegenerators/rubywriter.cpp')
-rw-r--r--umbrello/umbrello/codegenerators/rubywriter.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/umbrello/umbrello/codegenerators/rubywriter.cpp b/umbrello/umbrello/codegenerators/rubywriter.cpp
index aa9a5271..571634a5 100644
--- a/umbrello/umbrello/codegenerators/rubywriter.cpp
+++ b/umbrello/umbrello/codegenerators/rubywriter.cpp
@@ -21,9 +21,9 @@
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
#include "classifierinfo.h"
#include "../umldoc.h"
@@ -45,25 +45,25 @@ void RubyWriter::writeClass(UMLClassifier *c) {
return;
}
- QString classname = cleanName(c->getName());
+ TQString classname = cleanName(c->getName());
UMLClassifierList superclasses = c->getSuperClasses();
UMLAssociationList aggregations = c->getAggregations();
UMLAssociationList compositions = c->getCompositions();
//find an appropriate name for our file
- QString fileName = findFileName(c, ".rb");
+ TQString fileName = findFileName(c, ".rb");
if (fileName.isEmpty()) {
emit codeGenerated(c, false);
return;
}
- QFile fileh;
+ TQFile fileh;
if( !openFile(fileh, fileName) ) {
emit codeGenerated(c, false);
return;
}
- QTextStream h(&fileh);
+ TQTextStream h(&fileh);
// preparations
classifierInfo = new ClassifierInfo(c);
@@ -76,18 +76,18 @@ void RubyWriter::writeClass(UMLClassifier *c) {
//try to find a heading file (license, coments, etc)
- QString str;
+ TQString str;
str = getHeadingFile(".rb");
if(!str.isEmpty()) {
- str.replace(QRegExp("%filename%"), fileName);
- str.replace(QRegExp("%filepath%"), fileh.name());
+ str.replace(TQRegExp("%filename%"), fileName);
+ str.replace(TQRegExp("%filepath%"), fileh.name());
h<<str<<m_endl;
}
if(forceDoc() || !c->getDoc().isEmpty()) {
- QString docStr = c->getDoc();
- docStr.replace(QRegExp("\\n"), "\n# ");
+ TQString docStr = c->getDoc();
+ docStr.replace(TQRegExp("\\n"), "\n# ");
docStr.replace("@ref ", "");
docStr.replace("@see", "_See_");
docStr.replace("@short", "_Summary_");
@@ -144,31 +144,31 @@ void RubyWriter::writeClass(UMLClassifier *c) {
////////////////////////////////////////////////////////////////////////////////////
// Helper Methods
-QString RubyWriter::cppToRubyType(const QString &typeStr) {
- QString type = cleanName(typeStr);
+TQString RubyWriter::cppToRubyType(const TQString &typeStr) {
+ TQString type = cleanName(typeStr);
type.replace("const ", "");
- type.replace(QRegExp("[*&\\s]"), "");
- type.replace(QRegExp("[<>]"), "_");
- type.replace("QStringList", "Array");
- type.replace("QString", "String");
+ type.replace(TQRegExp("[*&\\s]"), "");
+ type.replace(TQRegExp("[<>]"), "_");
+ type.replace("TQStringList", "Array");
+ type.replace("TQString", "String");
type.replace("bool", "true|false");
- type.replace(QRegExp("^(uint|int|ushort|short|ulong|long)$"), "Integer");
- type.replace(QRegExp("^(float|double)$"), "Float");
- type.replace(QRegExp("^Q(?=[A-Z])"), "Qt::");
- type.replace(QRegExp("^K(?!(DE|Parts|IO)"), "KDE::");
+ type.replace(TQRegExp("^(uint|int|ushort|short|ulong|long)$"), "Integer");
+ type.replace(TQRegExp("^(float|double)$"), "Float");
+ type.replace(TQRegExp("^Q(?=[A-Z])"), "Qt::");
+ type.replace(TQRegExp("^K(?!(DE|Parts|IO)"), "KDE::");
return type;
}
-QString RubyWriter::cppToRubyName(const QString &nameStr) {
- QString name = cleanName(nameStr);
- name.replace(QRegExp("^m_"), "");
- name.replace(QRegExp("^[pbn](?=[A-Z])"), "");
+TQString RubyWriter::cppToRubyName(const TQString &nameStr) {
+ TQString name = cleanName(nameStr);
+ name.replace(TQRegExp("^m_"), "");
+ name.replace(TQRegExp("^[pbn](?=[A-Z])"), "");
name = name.mid(0, 1).lower() + name.mid(1);
return name;
}
-void RubyWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
+void RubyWriter::writeOperations(UMLClassifier *c,TQTextStream &h) {
//Lists to store operations sorted by scope
UMLOperationList oppub,opprot,oppriv;
@@ -195,7 +195,7 @@ void RubyWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
}
}
- QString classname(cleanName(c->getName()));
+ TQString classname(cleanName(c->getName()));
//write operations to file
if(forceSections() || !oppub.isEmpty()) {
@@ -212,8 +212,8 @@ void RubyWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
}
-void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opList,
- Uml::Visibility permitScope, QTextStream &h)
+void RubyWriter::writeOperations(const TQString &classname, UMLOperationList &opList,
+ Uml::Visibility permitScope, TQTextStream &h)
{
UMLOperation *op;
UMLAttribute *at;
@@ -233,8 +233,8 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
}
for (op=opList.first(); op ; op=opList.next()) {
- QString methodName = cleanName(op->getName());
- QStringList commentedParams;
+ TQString methodName = cleanName(op->getName());
+ TQStringList commentedParams;
// Skip destructors, and operator methods which
// can't be defined in ruby
@@ -265,25 +265,25 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
if (writeDoc) {
h << m_indentation << "#" << m_endl;
- QString docStr = op->getDoc();
+ TQString docStr = op->getDoc();
- docStr.replace(QRegExp("[\\n\\r]+ *"), m_endl);
- docStr.replace(QRegExp("[\\n\\r]+\\t*"), m_endl);
+ docStr.replace(TQRegExp("[\\n\\r]+ *"), m_endl);
+ docStr.replace(TQRegExp("[\\n\\r]+\\t*"), m_endl);
docStr.replace(" m_", " ");
- docStr.replace(QRegExp("\\s[npb](?=[A-Z])"), " ");
- QRegExp re_params("@param (\\w)(\\w*)");
+ docStr.replace(TQRegExp("\\s[npb](?=[A-Z])"), " ");
+ TQRegExp re_params("@param (\\w)(\\w*)");
int pos = re_params.search(docStr);
while (pos != -1) {
docStr.replace( re_params.cap(0),
- QString("@param _") + re_params.cap(1).lower() + re_params.cap(2) + '_' );
+ TQString("@param _") + re_params.cap(1).lower() + re_params.cap(2) + '_' );
commentedParams.append(re_params.cap(1).lower() + re_params.cap(2));
pos += re_params.matchedLength() + 3;
pos = re_params.search(docStr, pos);
}
- docStr.replace("\n", QString("\n") + m_indentation + "# ");
+ docStr.replace("\n", TQString("\n") + m_indentation + "# ");
// Write parameter documentation
for (at = atl.first(); at ; at = atl.next()) {
@@ -294,7 +294,7 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
if (at->getDoc().isEmpty()) {
docStr += (' ' + cppToRubyType(at->getTypeName()));
} else {
- docStr += (' ' + at->getDoc().replace(QRegExp("[\\n\\r]+[\\t ]*"), m_endl + " "));
+ docStr += (' ' + at->getDoc().replace(TQRegExp("[\\n\\r]+[\\t ]*"), m_endl + " "));
}
}
}
@@ -308,7 +308,7 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
// item starting with '# *', then indent the text with
// three spaces, '# ', to line up with the list item.
pos = docStr.find("# *");
- QRegExp re_linestart("# (?!\\*)");
+ TQRegExp re_linestart("# (?!\\*)");
pos = re_linestart.search(docStr, pos);
while (pos > 0) {
docStr.insert(pos + 1, " ");
@@ -319,7 +319,7 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
h << m_indentation << "# "<< docStr << m_endl;
- QString typeStr = cppToRubyType(op->getTypeName());
+ TQString typeStr = cppToRubyType(op->getTypeName());
if (!typeStr.isEmpty() && typeStr != "void" && docStr.contains("_returns_") == 0) {
h << m_indentation << "# * _returns_ " << typeStr << m_endl;
}
@@ -329,15 +329,15 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
int j=0;
for (at = atl.first(); at; at = atl.next(), j++) {
- QString nameStr = cppToRubyName(at->getName());
+ TQString nameStr = cppToRubyName(at->getName());
if (j > 0) {
h << ", " << nameStr;
} else {
h << nameStr;
}
h << (!(at->getInitialValue().isEmpty()) ?
- (QString(" = ") + cppToRubyType(at->getInitialValue())) :
- QString(""));
+ (TQString(" = ") + cppToRubyType(at->getInitialValue())) :
+ TQString(""));
}
h <<")" << m_endl;
@@ -353,7 +353,7 @@ void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opL
// this is for writing file attribute methods
//
void RubyWriter::writeAttributeMethods(UMLAttributeList *attribs,
- Uml::Visibility visibility, QTextStream &stream)
+ Uml::Visibility visibility, TQTextStream &stream)
{
// return now if NO attributes to work on
if (attribs->count() == 0 || visibility == Uml::Visibility::Private)
@@ -362,7 +362,7 @@ void RubyWriter::writeAttributeMethods(UMLAttributeList *attribs,
UMLAttribute *at;
for(at=attribs->first(); at; at=attribs->next())
{
- QString varName = cppToRubyName(cleanName(at->getName()));
+ TQString varName = cppToRubyName(cleanName(at->getName()));
writeSingleAttributeAccessorMethods(varName, at->getDoc(), stream);
}
@@ -370,14 +370,14 @@ void RubyWriter::writeAttributeMethods(UMLAttributeList *attribs,
}
void RubyWriter::writeSingleAttributeAccessorMethods(
- const QString &fieldName,
- const QString &descr,
- QTextStream &h)
+ const TQString &fieldName,
+ const TQString &descr,
+ TQTextStream &h)
{
- QString description = descr;
- description.replace(QRegExp("m_[npb](?=[A-Z])"), "");
+ TQString description = descr;
+ description.replace(TQRegExp("m_[npb](?=[A-Z])"), "");
description.replace("m_", "");
- description.replace("\n", QString("\n") + m_indentation + "# ");
+ description.replace("\n", TQString("\n") + m_indentation + "# ");
if (!description.isEmpty()) {
h << m_indentation << "# " << description << m_endl;
@@ -395,9 +395,9 @@ Uml::Programming_Language RubyWriter::getLanguage() {
return Uml::pl_Ruby;
}
-const QStringList RubyWriter::reservedKeywords() const {
+const TQStringList RubyWriter::reservedKeywords() const {
- static QStringList keywords;
+ static TQStringList keywords;
if (keywords.isEmpty()) {
keywords << "__FILE__"