summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/cppwriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'umbrello/umbrello/codegenerators/cppwriter.cpp')
-rw-r--r--umbrello/umbrello/codegenerators/cppwriter.cpp256
1 files changed, 128 insertions, 128 deletions
diff --git a/umbrello/umbrello/codegenerators/cppwriter.cpp b/umbrello/umbrello/codegenerators/cppwriter.cpp
index b24c12b0..ab2b8fcb 100644
--- a/umbrello/umbrello/codegenerators/cppwriter.cpp
+++ b/umbrello/umbrello/codegenerators/cppwriter.cpp
@@ -19,9 +19,9 @@
// own header
#include "cppwriter.h"
// qt/kde includes
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
#include <kdebug.h>
// app includes
#include "classifierinfo.h"
@@ -50,7 +50,7 @@ CppWriter::CppWriter()
// and "%ITEMCLASS%", if needed, where the class of the item is declared.
VECTOR_METHOD_APPEND = "%VARNAME%.push_back(add_object);"; // for std::vector
VECTOR_METHOD_REMOVE = "int i, size = %VARNAME%.size();\nfor ( i = 0; i < size; i++) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == remove_object) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"; // for std::vector
- VECTOR_METHOD_INIT = QString(); // nothing to be done
+ VECTOR_METHOD_INIT = TQString(); // nothing to be done
/*
VECTOR_METHOD_APPEND = "%VARNAME%.append(&add_object);"; // Qt lib implementation
VECTOR_METHOD_REMOVE = "%VARNAME%.removeRef(&remove_object);"; // Qt lib implementation
@@ -82,10 +82,10 @@ void CppWriter::writeClass(UMLClassifier *c)
return;
}
- QFile fileh, filecpp;
+ TQFile fileh, filecpp;
// find an appropriate name for our file
- QString fileName = findFileName(c, ".h");
+ TQString fileName = findFileName(c, ".h");
if (fileName.isEmpty()) {
emit codeGenerated(c, false);
return;
@@ -113,7 +113,7 @@ void CppWriter::writeClass(UMLClassifier *c)
need_impl = false;
}
if (need_impl) {
- fileName.replace( QRegExp(".h$"), ".cpp");
+ fileName.replace( TQRegExp(".h$"), ".cpp");
if( !openFile(filecpp, fileName)) {
emit codeGenerated(c, false);
return;
@@ -130,24 +130,24 @@ void CppWriter::writeClass(UMLClassifier *c)
}
-void CppWriter::writeHeaderFile (UMLClassifier *c, QFile &fileh) {
+void CppWriter::writeHeaderFile (UMLClassifier *c, TQFile &fileh) {
// open stream for writing
- QTextStream h (&fileh);
+ TQTextStream h (&fileh);
// up the indent level to one
m_indentLevel = 1;
// write header blurb
- QString str = getHeadingFile(".h");
+ TQString str = getHeadingFile(".h");
if(!str.isEmpty()) {
- str.replace(QRegExp("%filename%"),m_classifierInfo->fileName + ".h");
- str.replace(QRegExp("%filepath%"),fileh.name());
+ str.replace(TQRegExp("%filename%"),m_classifierInfo->fileName + ".h");
+ str.replace(TQRegExp("%filepath%"),fileh.name());
h << str<< m_endl;
}
// Write the hash define stuff to prevent multiple parsing/inclusion of header
- QString hashDefine = m_classifierInfo->className.upper().simplifyWhiteSpace().replace(QRegExp(" "), "_");
+ TQString hashDefine = m_classifierInfo->className.upper().simplifyWhiteSpace().replace(TQRegExp(" "), "_");
writeBlankLine(h);
h << "#ifndef "<< hashDefine + "_H" << m_endl;
h << "#define "<< hashDefine + "_H" << m_endl;
@@ -159,7 +159,7 @@ void CppWriter::writeHeaderFile (UMLClassifier *c, QFile &fileh) {
}
-void CppWriter::writeHeaderAccessorMethodDecl(UMLClassifier *c, Uml::Visibility permitScope, QTextStream &stream)
+void CppWriter::writeHeaderAccessorMethodDecl(UMLClassifier *c, Uml::Visibility permitScope, TQTextStream &stream)
{
// attributes
@@ -180,7 +180,7 @@ void CppWriter::writeHeaderAccessorMethodDecl(UMLClassifier *c, Uml::Visibility
}
-void CppWriter::writeHeaderFieldDecl(UMLClassifier *c, Uml::Visibility permitScope, QTextStream &stream)
+void CppWriter::writeHeaderFieldDecl(UMLClassifier *c, Uml::Visibility permitScope, TQTextStream &stream)
{
// attributes
writeAttributeDecls(permitScope, true, stream); // write static attributes first
@@ -194,20 +194,20 @@ void CppWriter::writeHeaderFieldDecl(UMLClassifier *c, Uml::Visibility permitSco
}
-void CppWriter::writeSourceFile (UMLClassifier *c, QFile &filecpp ) {
+void CppWriter::writeSourceFile (UMLClassifier *c, TQFile &filecpp ) {
// open stream for writing
- QTextStream cpp (&filecpp);
+ TQTextStream cpp (&filecpp);
// set the starting indentation at zero
m_indentLevel = 0;
//try to find a heading file (license, coments, etc)
- QString str;
+ TQString str;
str = getHeadingFile(".cpp");
if(!str.isEmpty()) {
- str.replace(QRegExp("%filename%"),m_classifierInfo->fileName + ".cpp");
- str.replace(QRegExp("%filepath%"),filecpp.name());
+ str.replace(TQRegExp("%filename%"),m_classifierInfo->fileName + ".cpp");
+ str.replace(TQRegExp("%filepath%"),filecpp.name());
cpp << str << m_endl;
}
@@ -233,7 +233,7 @@ void CppWriter::writeSourceFile (UMLClassifier *c, QFile &filecpp ) {
//
// write comment for section IF needed
- QString indent = getIndent();
+ TQString indent = getIndent();
if (forceDoc() || m_classifierInfo->hasAccessorMethods || m_classifierInfo->hasOperationMethods)
{
@@ -323,11 +323,11 @@ void CppWriter::writeSourceFile (UMLClassifier *c, QFile &filecpp ) {
}
-void CppWriter::writeClassDecl(UMLClassifier *c, QTextStream &cpp)
+void CppWriter::writeClassDecl(UMLClassifier *c, TQTextStream &cpp)
{
UMLClassifierList superclasses = m_classifierInfo->superclasses;
for(UMLClassifier *classifier = superclasses.first(); classifier ;classifier = superclasses.next()) {
- QString headerName = findFileName(classifier, ".h");
+ TQString headerName = findFileName(classifier, ".h");
if (!headerName.isEmpty()) {
cpp << "#include \"" << headerName << "\"" << m_endl;
}
@@ -386,7 +386,7 @@ void CppWriter::writeClassDecl(UMLClassifier *c, QTextStream &cpp)
uint i = 0;
cpp << "enum " << m_classifierInfo->className << " {" << m_endl;
for (UMLClassifierListItem *lit = litList.first(); lit; lit = litList.next()) {
- QString enumLiteral = cleanName(lit->getName());
+ TQString enumLiteral = cleanName(lit->getName());
cpp << getIndent() << enumLiteral;
if (++i < litList.count())
cpp << ",";
@@ -403,8 +403,8 @@ void CppWriter::writeClassDecl(UMLClassifier *c, QTextStream &cpp)
if (template_params.count()) {
cpp << "template<";
for (UMLTemplate *t = template_params.first(); t; ) {
- QString formalName = t->getName();
- QString typeName = t->getTypeName();
+ TQString formalName = t->getName();
+ TQString typeName = t->getTypeName();
cpp << typeName << " " << formalName;
if ((t = template_params.next()) != NULL)
cpp << ", ";
@@ -471,7 +471,7 @@ void CppWriter::writeClassDecl(UMLClassifier *c, QTextStream &cpp)
}
-void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStatic, QTextStream &stream )
+void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStatic, TQTextStream &stream )
{
if(m_classifierInfo->isInterface)
@@ -506,8 +506,8 @@ void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStati
//write documentation
if(forceDoc() || list->count() > 0)
{
- QString strVis = Codegen_Utils::capitalizeFirstLetter(visibility.toString());
- QString strStatic = writeStatic ? "Static ":"";
+ TQString strVis = Codegen_Utils::capitalizeFirstLetter(visibility.toString());
+ TQString strStatic = writeStatic ? "Static ":"";
writeComment(strStatic + strVis + " attributes",getIndent(), stream);
writeComment(" ",getIndent(), stream);
writeBlankLine(stream);
@@ -517,7 +517,7 @@ void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStati
// write attrib declarations now
bool isFirstAttrib = true;
- QString documentation;
+ TQString documentation;
for(UMLAttribute *at=list->first(); at; at=list->next())
{
@@ -531,10 +531,10 @@ void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStati
isFirstAttrib = false;
- QString varName = getAttributeVariableName(at);
+ TQString varName = getAttributeVariableName(at);
- QString staticValue = at->getStatic() ? "static " : "";
- QString typeName = fixTypeName(at->getTypeName());
+ TQString staticValue = at->getStatic() ? "static " : "";
+ TQString typeName = fixTypeName(at->getTypeName());
if(!documentation.isEmpty())
writeComment(documentation, getIndent(), stream);
stream << getIndent() << staticValue << typeName << " " << varName << ";" << m_endl;
@@ -550,7 +550,7 @@ void CppWriter::writeAttributeDecls (Uml::Visibility visibility, bool writeStati
}
-void CppWriter::writeHeaderAttributeAccessorMethods (Uml::Visibility visibility, bool writeStatic, QTextStream &stream )
+void CppWriter::writeHeaderAttributeAccessorMethods (Uml::Visibility visibility, bool writeStatic, TQTextStream &stream )
{
// check the current policy about generate accessors as public
UMLAttributeList * list;
@@ -596,7 +596,7 @@ void CppWriter::writeHeaderAttributeAccessorMethods (Uml::Visibility visibility,
void CppWriter::writeAttributeMethods(UMLAttributeList *attribs,
Uml::Visibility visibility, bool isHeaderMethod,
bool isStatic,
- bool writeMethodBody, QTextStream &stream)
+ bool writeMethodBody, TQTextStream &stream)
{
if (!policyExt()->getAutoGenerateAccessors())
@@ -604,8 +604,8 @@ void CppWriter::writeAttributeMethods(UMLAttributeList *attribs,
if (forceDoc() || attribs->count() > 0)
{
- QString strVis = Codegen_Utils::capitalizeFirstLetter(visibility.toString());
- QString strStatic = (isStatic ? " static" : "");
+ TQString strVis = Codegen_Utils::capitalizeFirstLetter(visibility.toString());
+ TQString strStatic = (isStatic ? " static" : "");
writeBlankLine(stream);
writeComment(strVis + strStatic + " attribute accessor methods",getIndent(),stream);
writeComment(" ",getIndent(), stream);
@@ -620,8 +620,8 @@ void CppWriter::writeAttributeMethods(UMLAttributeList *attribs,
for(at=attribs->first(); at; at=attribs->next())
{
- QString varName = getAttributeVariableName(at);
- QString methodBaseName = cleanName(at->getName());
+ TQString varName = getAttributeVariableName(at);
+ TQString methodBaseName = cleanName(at->getName());
// force capitalizing the field name, this is silly,
// from what I can tell, this IS the default behavior for
@@ -636,14 +636,14 @@ void CppWriter::writeAttributeMethods(UMLAttributeList *attribs,
}
-void CppWriter::writeComment(const QString &comment, const QString &myIndent, QTextStream &cpp)
+void CppWriter::writeComment(const TQString &comment, const TQString &myIndent, TQTextStream &cpp)
{
// in the case we have several line comment..
// NOTE: this part of the method has the problem of adopting UNIX newline,
// need to resolve for using with MAC/WinDoze eventually I assume
- if (comment.contains(QRegExp("\n"))) {
+ if (comment.contains(TQRegExp("\n"))) {
- QStringList lines = QStringList::split( "\n", comment);
+ TQStringList lines = TQStringList::split( "\n", comment);
for(uint i= 0; i < lines.count(); i++)
{
cpp << myIndent << "// " << lines[i] << m_endl;
@@ -655,10 +655,10 @@ void CppWriter::writeComment(const QString &comment, const QString &myIndent, QT
}
}
-void CppWriter::writeDocumentation(QString header, QString body, QString end, QTextStream &cpp)
+void CppWriter::writeDocumentation(TQString header, TQString body, TQString end, TQTextStream &cpp)
{
writeBlankLine(cpp);
- QString indent = getIndent();
+ TQString indent = getIndent();
cpp << indent << "/**" << m_endl;
if (!header.isEmpty())
@@ -667,14 +667,14 @@ void CppWriter::writeDocumentation(QString header, QString body, QString end, QT
cpp << formatDoc(body, indent + " * ");
if (!end.isEmpty())
{
- QStringList lines = QStringList::split( "\n", end);
+ TQStringList lines = TQStringList::split( "\n", end);
for(uint i= 0; i < lines.count(); i++)
cpp << formatDoc(lines[i], indent + " * ");
}
cpp << indent << " */" << m_endl;
}
-void CppWriter::writeAssociationDecls(UMLAssociationList associations, Uml::Visibility permitScope, Uml::IDType id, QTextStream &h)
+void CppWriter::writeAssociationDecls(UMLAssociationList associations, Uml::Visibility permitScope, Uml::IDType id, TQTextStream &h)
{
if( forceSections() || !associations.isEmpty() )
@@ -699,14 +699,14 @@ void CppWriter::writeAssociationDecls(UMLAssociationList associations, Uml::Visi
if (printRoleB && a->getVisibility(Uml::B) == permitScope)
{
- QString fieldClassName = cleanName(getUMLObjectName(a->getObject(Uml::B)));
+ TQString fieldClassName = cleanName(getUMLObjectName(a->getObject(Uml::B)));
writeAssociationRoleDecl(fieldClassName, a->getRoleName(Uml::B), a->getMulti(Uml::B), a->getRoleDoc(Uml::B), h);
}
// print RoleA decl
if (printRoleA && a->getVisibility(Uml::A) == permitScope)
{
- QString fieldClassName = cleanName(getUMLObjectName(a->getObject(Uml::A)));
+ TQString fieldClassName = cleanName(getUMLObjectName(a->getObject(Uml::A)));
writeAssociationRoleDecl(fieldClassName, a->getRoleName(Uml::A), a->getMulti(Uml::A), a->getRoleDoc(Uml::A), h);
}
@@ -717,15 +717,15 @@ void CppWriter::writeAssociationDecls(UMLAssociationList associations, Uml::Visi
}
}
-void CppWriter::writeAssociationRoleDecl(QString fieldClassName, QString roleName, QString multi,
- QString doc, QTextStream &stream)
+void CppWriter::writeAssociationRoleDecl(TQString fieldClassName, TQString roleName, TQString multi,
+ TQString doc, TQTextStream &stream)
{
// ONLY write out IF there is a rolename given
// otherwise its not meant to be declared in the code
if (roleName.isEmpty())
return;
- QString indent = getIndent();
+ TQString indent = getIndent();
// always put space between this and prior decl, if any
writeBlankLine(stream);
@@ -736,14 +736,14 @@ void CppWriter::writeAssociationRoleDecl(QString fieldClassName, QString roleNam
// declare the association based on whether it is this a single variable
// or a List (Vector). One day this will be done correctly with special
// multiplicity object that we don't have to figure out what it means via regex.
- if(multi.isEmpty() || multi.contains(QRegExp("^[01]$")))
+ if(multi.isEmpty() || multi.contains(TQRegExp("^[01]$")))
{
- QString fieldVarName = "m_" + roleName.lower();
+ TQString fieldVarName = "m_" + roleName.lower();
// record this for later consideration of initialization IF the
// multi value requires 1 of these objects
if(ObjectFieldVariables.findIndex(fieldVarName) == -1 &&
- multi.contains(QRegExp("^1$"))
+ multi.contains(TQRegExp("^1$"))
)
{
// ugh. UGLY. Storing variable name and its class in pairs.
@@ -755,7 +755,7 @@ void CppWriter::writeAssociationRoleDecl(QString fieldClassName, QString roleNam
}
else
{
- QString fieldVarName = "m_" + roleName.lower() + "Vector";
+ TQString fieldVarName = "m_" + roleName.lower() + "Vector";
// record unique occurrences for later when we want to check
// for initialization of this vector
@@ -773,7 +773,7 @@ void CppWriter::writeAssociationMethods (UMLAssociationList associations,
bool isHeaderMethod,
bool writeMethodBody,
bool writePointerVar,
- Uml::IDType myID, QTextStream &stream)
+ Uml::IDType myID, TQTextStream &stream)
{
if( forceSections() || !associations.isEmpty() )
{
@@ -786,7 +786,7 @@ void CppWriter::writeAssociationMethods (UMLAssociationList associations,
{
// only write out IF there is a rolename given
if(!a->getRoleName(Uml::B).isEmpty()) {
- QString fieldClassName = getUMLObjectName(a->getObject(Uml::B)) + (writePointerVar ? " *":"");
+ TQString fieldClassName = getUMLObjectName(a->getObject(Uml::B)) + (writePointerVar ? " *":"");
writeAssociationRoleMethod(fieldClassName,
isHeaderMethod,
writeMethodBody,
@@ -800,7 +800,7 @@ void CppWriter::writeAssociationMethods (UMLAssociationList associations,
{
// only write out IF there is a rolename given
if(!a->getRoleName(Uml::A).isEmpty()) {
- QString fieldClassName = getUMLObjectName(a->getObject(Uml::A)) + (writePointerVar ? " *":"");
+ TQString fieldClassName = getUMLObjectName(a->getObject(Uml::A)) + (writePointerVar ? " *":"");
writeAssociationRoleMethod(fieldClassName,
isHeaderMethod,
writeMethodBody,
@@ -816,39 +816,39 @@ void CppWriter::writeAssociationMethods (UMLAssociationList associations,
}
}
-void CppWriter::writeAssociationRoleMethod (const QString &fieldClassName,
+void CppWriter::writeAssociationRoleMethod (const TQString &fieldClassName,
bool isHeaderMethod,
bool writeMethodBody,
- const QString &roleName, const QString &multi,
- const QString &description, Uml::Changeability_Type change,
- QTextStream &stream)
+ const TQString &roleName, const TQString &multi,
+ const TQString &description, Uml::Changeability_Type change,
+ TQTextStream &stream)
{
- if(multi.isEmpty() || multi.contains(QRegExp("^[01]$")))
+ if(multi.isEmpty() || multi.contains(TQRegExp("^[01]$")))
{
- QString fieldVarName = "m_" + roleName.lower();
+ TQString fieldVarName = "m_" + roleName.lower();
writeSingleAttributeAccessorMethods(fieldClassName, fieldVarName, roleName,
description, change, isHeaderMethod, false, writeMethodBody, stream);
}
else
{
- QString fieldVarName = "m_" + roleName.lower() + "Vector";
+ TQString fieldVarName = "m_" + roleName.lower() + "Vector";
writeVectorAttributeAccessorMethods(fieldClassName, fieldVarName, roleName,
description, change, isHeaderMethod, writeMethodBody, stream);
}
}
void CppWriter::writeVectorAttributeAccessorMethods (
- const QString &fieldClassName, const QString &fieldVarName,
- const QString &fieldName, const QString &description,
+ const TQString &fieldClassName, const TQString &fieldVarName,
+ const TQString &fieldName, const TQString &description,
Uml::Changeability_Type changeType,
bool isHeaderMethod,
bool writeMethodBody,
- QTextStream &stream)
+ TQTextStream &stream)
{
- QString className = fixTypeName(fieldClassName);
- QString fldName = Codegen_Utils::capitalizeFirstLetter(fieldName);
- QString indent = getIndent();
+ TQString className = fixTypeName(fieldClassName);
+ TQString fldName = Codegen_Utils::capitalizeFirstLetter(fieldName);
+ TQString indent = getIndent();
// ONLY IF changeability is NOT Frozen
if (changeType != Uml::chg_Frozen)
@@ -859,10 +859,10 @@ void CppWriter::writeVectorAttributeAccessorMethods (
stream << m_classifierInfo->className << "::";
stream << "add" << fldName << " ( " << className << " add_object )";
if (writeMethodBody) {
- QString method = VECTOR_METHOD_APPEND;
- method.replace(QRegExp("%VARNAME%"),fieldVarName);
- method.replace(QRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
- method.replace(QRegExp("%ITEMCLASS%"),className);
+ TQString method = VECTOR_METHOD_APPEND;
+ method.replace(TQRegExp("%VARNAME%"),fieldVarName);
+ method.replace(TQRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
+ method.replace(TQRegExp("%ITEMCLASS%"),className);
stream << indent << " {" << m_endl;
m_indentLevel++;
printTextAsSeparateLinesWithIndent(method,getIndent(),stream);
@@ -882,10 +882,10 @@ void CppWriter::writeVectorAttributeAccessorMethods (
stream << m_classifierInfo->className << "::";
stream << "remove" << fldName << " ( " << className << " remove_object )";
if (writeMethodBody) {
- QString method = VECTOR_METHOD_REMOVE;
- method.replace(QRegExp("%VARNAME%"),fieldVarName);
- method.replace(QRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
- method.replace(QRegExp("%ITEMCLASS%"),className);
+ TQString method = VECTOR_METHOD_REMOVE;
+ method.replace(TQRegExp("%VARNAME%"),fieldVarName);
+ method.replace(TQRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
+ method.replace(TQRegExp("%ITEMCLASS%"),className);
stream << indent << " {" << m_endl;
m_indentLevel++;
printTextAsSeparateLinesWithIndent(method,getIndent(),stream);
@@ -896,7 +896,7 @@ void CppWriter::writeVectorAttributeAccessorMethods (
}
// always allow getting the list of stuff
- QString returnVarName = policyExt()->getVectorClassName() + '<' + className + '>';
+ TQString returnVarName = policyExt()->getVectorClassName() + '<' + className + '>';
writeDocumentation("Get the list of " + fldName + " objects held by " + fieldVarName,
description,
"@return " + returnVarName + " list of " + fldName + " objects held by " + fieldVarName,
@@ -918,22 +918,22 @@ void CppWriter::writeVectorAttributeAccessorMethods (
void CppWriter::writeSingleAttributeAccessorMethods(
- const QString& fieldClassName, const QString& fieldVarName,
- const QString& fieldName, const QString &description,
+ const TQString& fieldClassName, const TQString& fieldVarName,
+ const TQString& fieldName, const TQString &description,
Uml::Changeability_Type change,
bool isHeaderMethod,
bool isStatic,
bool writeMethodBody,
- QTextStream &stream)
+ TQTextStream &stream)
{
// DON'T write this IF its a source method AND writeMethodBody is "false"
if(!isHeaderMethod && !writeMethodBody)
return;
- QString className = fixTypeName(fieldClassName);
- QString fldName = Codegen_Utils::capitalizeFirstLetter(fieldName);
- QString indent = getIndent();
+ TQString className = fixTypeName(fieldClassName);
+ TQString fldName = Codegen_Utils::capitalizeFirstLetter(fieldName);
+ TQString indent = getIndent();
// set method
if (change == Uml::chg_Changeable && !isStatic) {
@@ -979,7 +979,7 @@ void CppWriter::writeSingleAttributeAccessorMethods(
}
// one day, this should print out non-empty constructor operations too.
-void CppWriter::writeConstructorDecls(QTextStream &stream)
+void CppWriter::writeConstructorDecls(TQTextStream &stream)
{
const bool generateEmptyConstructors =
UMLApp::app()->getCommonPolicy()->getAutoGenerateConstructors();
@@ -1000,22 +1000,22 @@ void CppWriter::writeConstructorDecls(QTextStream &stream)
writeBlankLine(stream);
}
-void CppWriter::writeInitAttibuteDecl (QTextStream &stream)
+void CppWriter::writeInitAttibuteDecl (TQTextStream &stream)
{
if (UMLApp::app()->getCommonPolicy()->getAutoGenerateConstructors() &&
m_classifierInfo->hasAttributes)
stream << getIndent() << "void initAttributes ( ) ;" << m_endl;
}
-void CppWriter::writeInitAttibuteMethod (QTextStream &stream)
+void CppWriter::writeInitAttibuteMethod (TQTextStream &stream)
{
// only need to do this under certain conditions
if (!UMLApp::app()->getCommonPolicy()->getAutoGenerateConstructors() ||
!m_classifierInfo->hasAttributes)
return;
- QString className = m_classifierInfo->className;
- QString indent = getIndent();
+ TQString className = m_classifierInfo->className;
+ TQString indent = getIndent();
stream << indent << "void " << className << "::" << "initAttributes ( ) {" << m_endl;
@@ -1024,31 +1024,31 @@ void CppWriter::writeInitAttibuteMethod (QTextStream &stream)
UMLAttributeList atl = m_classifierInfo->getAttList();
for(UMLAttribute *at = atl.first(); at ; at = atl.next()) {
if(!at->getInitialValue().isEmpty()) {
- QString varName = getAttributeVariableName(at);
+ TQString varName = getAttributeVariableName(at);
stream << getIndent() << varName << " = " << at->getInitialValue() << ";" << m_endl;
}
}
// Now initialize the association related fields (e.g. vectors)
if (!VECTOR_METHOD_INIT.isEmpty()) {
- QStringList::Iterator it;
+ TQStringList::Iterator it;
for( it = VectorFieldVariables.begin(); it != VectorFieldVariables.end(); ++it ) {
- QString fieldVarName = *it;
- QString method = VECTOR_METHOD_INIT;
- method.replace(QRegExp("%VARNAME%"),fieldVarName);
- method.replace(QRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
+ TQString fieldVarName = *it;
+ TQString method = VECTOR_METHOD_INIT;
+ method.replace(TQRegExp("%VARNAME%"),fieldVarName);
+ method.replace(TQRegExp("%VECTORTYPENAME%"), policyExt()->getVectorClassName());
stream << getIndent() << method << m_endl;
}
}
if (!OBJECT_METHOD_INIT.isEmpty()) {
- QStringList::Iterator it;
+ TQStringList::Iterator it;
for( it = ObjectFieldVariables.begin(); it != ObjectFieldVariables.end(); ++it ) {
- QString fieldVarName = *it;
+ TQString fieldVarName = *it;
it++;
- QString fieldClassName = *it;
- QString method = OBJECT_METHOD_INIT;
- method.replace(QRegExp("%VARNAME%"),fieldVarName);
- method.replace(QRegExp("%ITEMCLASS%"),fieldClassName);
+ TQString fieldClassName = *it;
+ TQString method = OBJECT_METHOD_INIT;
+ method.replace(TQRegExp("%VARNAME%"),fieldVarName);
+ method.replace(TQRegExp("%ITEMCLASS%"),fieldClassName);
stream << getIndent() << method << m_endl;
}
}
@@ -1063,7 +1063,7 @@ void CppWriter::writeInitAttibuteMethod (QTextStream &stream)
}
// one day, this should print out non-empty constructor operations too.
-void CppWriter::writeConstructorMethods(QTextStream &stream)
+void CppWriter::writeConstructorMethods(TQTextStream &stream)
{
const bool generateEmptyConstructors =
UMLApp::app()->getCommonPolicy()->getAutoGenerateConstructors();
@@ -1076,9 +1076,9 @@ void CppWriter::writeConstructorMethods(QTextStream &stream)
if (!generateEmptyConstructors)
return;
- QString className = m_classifierInfo->className;
+ TQString className = m_classifierInfo->className;
// empty constructor
- QString indent = getIndent();
+ TQString indent = getIndent();
stream << indent << className << "::" << className << " ( ) {" << m_endl;
if(m_classifierInfo->hasAttributes)
stream << indent << indent << "initAttributes();" << m_endl;
@@ -1092,7 +1092,7 @@ void CppWriter::writeConstructorMethods(QTextStream &stream)
// IF the type is "string" we need to declare it as
// the Java Object "String" (there is no string primative in Java).
-QString CppWriter::fixTypeName(const QString &string)
+TQString CppWriter::fixTypeName(const TQString &string)
{
if (string.isEmpty())
return "void";
@@ -1102,7 +1102,7 @@ QString CppWriter::fixTypeName(const QString &string)
}
void CppWriter::writeOperations(UMLClassifier *c, bool isHeaderMethod,
- Uml::Visibility permitScope, QTextStream &cpp) {
+ Uml::Visibility permitScope, TQTextStream &cpp) {
UMLOperationList oplist;
@@ -1128,16 +1128,16 @@ void CppWriter::writeOperations(UMLClassifier *c, bool isHeaderMethod,
// write operation in either header or
// a source file
-void CppWriter::writeOperations(UMLOperationList &oplist, bool isHeaderMethod, QTextStream &cpp) {
- QString className = m_classifierInfo->className;
+void CppWriter::writeOperations(UMLOperationList &oplist, bool isHeaderMethod, TQTextStream &cpp) {
+ TQString className = m_classifierInfo->className;
const bool generateEmptyConstructors =
UMLApp::app()->getCommonPolicy()->getAutoGenerateConstructors();
// generate method decl for each operation given
for (UMLOperation *op = oplist.first(); op; op = oplist.next()) {
- QString returnStr; // buffer for documentation
- QString methodReturnType;
+ TQString returnStr; // buffer for documentation
+ TQString methodReturnType;
UMLAttributeList atl = op->getParmList(); // method parameters
if (op->isConstructorOperation()) {
@@ -1152,7 +1152,7 @@ void CppWriter::writeOperations(UMLOperationList &oplist, bool isHeaderMethod, Q
returnStr += "@return " + methodReturnType + '\n';
}
- QString str;
+ TQString str;
if (op->getAbstract() || m_classifierInfo->isInterface) {
if (isHeaderMethod) {
// declare abstract method as 'virtual'
@@ -1175,10 +1175,10 @@ void CppWriter::writeOperations(UMLOperationList &oplist, bool isHeaderMethod, Q
// generate parameters
uint j = 0;
for (UMLAttribute *at = atl.first(); at; at = atl.next(), j++) {
- QString typeName = fixTypeName(at->getTypeName());
- QString atName = cleanName(at->getName());
+ TQString typeName = fixTypeName(at->getTypeName());
+ TQString atName = cleanName(at->getName());
str += typeName + ' ' + atName;
- const QString initVal = at->getInitialValue();
+ const TQString initVal = at->getInitialValue();
if (! initVal.isEmpty())
str += " = " + initVal;
if (j < atl.count() - 1)
@@ -1207,7 +1207,7 @@ void CppWriter::writeOperations(UMLOperationList &oplist, bool isHeaderMethod, Q
// of an association have roles we need to have forward declaration of
// the other class...but only IF its not THIS class (as could happen
// in self-association relationship).
-void CppWriter::printAssociationIncludeDecl (UMLAssociationList list, Uml::IDType myId, QTextStream &stream)
+void CppWriter::printAssociationIncludeDecl (UMLAssociationList list, Uml::IDType myId, TQTextStream &stream)
{
for (UMLAssociation *a = list.first(); a; a = list.next()) {
@@ -1233,9 +1233,9 @@ void CppWriter::printAssociationIncludeDecl (UMLAssociationList list, Uml::IDTyp
}
}
-QString CppWriter::fixInitialStringDeclValue(const QString &value, const QString &type)
+TQString CppWriter::fixInitialStringDeclValue(const TQString &value, const TQString &type)
{
- QString val = value;
+ TQString val = value;
// check for strings only
if (!val.isEmpty() && type == policyExt()->getStringClassName()) {
if (!val.startsWith("\""))
@@ -1247,37 +1247,37 @@ QString CppWriter::fixInitialStringDeclValue(const QString &value, const QString
}
// methods like this _shouldn't_ be needed IF we properly did things thruought the code.
-QString CppWriter::getUMLObjectName(UMLObject *obj)
+TQString CppWriter::getUMLObjectName(UMLObject *obj)
{
- return(obj!=0)?obj->getName():QString("NULL");
+ return(obj!=0)?obj->getName():TQString("NULL");
}
-void CppWriter::writeBlankLine(QTextStream &stream)
+void CppWriter::writeBlankLine(TQTextStream &stream)
{
stream << m_endl;
}
-void CppWriter::printTextAsSeparateLinesWithIndent (const QString &text, const QString &indent, QTextStream &stream)
+void CppWriter::printTextAsSeparateLinesWithIndent (const TQString &text, const TQString &indent, TQTextStream &stream)
{
if(text.isEmpty())
return;
- QStringList lines = QStringList::split( "\n", text);
+ TQStringList lines = TQStringList::split( "\n", text);
for(uint i= 0; i < lines.count(); i++)
stream << indent << lines[i] << m_endl;
}
-QString CppWriter::getAttributeVariableName (UMLAttribute *at)
+TQString CppWriter::getAttributeVariableName (UMLAttribute *at)
{
- QString fieldName = "m_" + cleanName(at->getName());
+ TQString fieldName = "m_" + cleanName(at->getName());
return fieldName;
}
-QStringList CppWriter::defaultDatatypes() {
+TQStringList CppWriter::defaultDatatypes() {
return Codegen_Utils::cppDatatypes();
}
-const QStringList CppWriter::reservedKeywords() const {
+const TQStringList CppWriter::reservedKeywords() const {
return Codegen_Utils::reservedCppKeywords();
}