diff options
Diffstat (limited to 'kexi/plugins/macros/lib/metamethod.cpp')
-rw-r--r-- | kexi/plugins/macros/lib/metamethod.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/kexi/plugins/macros/lib/metamethod.cpp b/kexi/plugins/macros/lib/metamethod.cpp index 8aa4dc54..979202e8 100644 --- a/kexi/plugins/macros/lib/metamethod.cpp +++ b/kexi/plugins/macros/lib/metamethod.cpp @@ -23,12 +23,12 @@ #include "variable.h" #include "exception.h" -#include <qobject.h> -#include <qmetaobject.h> +#include <tqobject.h> +#include <tqmetaobject.h> -// to access the Qt3 QUObject API. -#include <private/qucom_p.h> -#include <private/qucomextra_p.h> +// to access the TQt3 TQUObject API. +#include <private/tqucom_p.h> +#include <private/tqucomextra_p.h> #include <kdebug.h> @@ -47,17 +47,17 @@ namespace KoMacro { /** * The signature this @a MetaMethod has. */ - QString signature; + TQString signature; /** * The signature tagname this @a MetaMethod has. */ - QString signaturetag; + TQString signaturetag; /** * The signature arguments this @a MetaMethod has. */ - QString signaturearguments; + TQString signaturearguments; /** * Cached signature arguments parsed into a list @@ -81,7 +81,7 @@ namespace KoMacro { } -MetaMethod::MetaMethod(const QString& signature, Type type, KSharedPtr<MetaObject> object) +MetaMethod::MetaMethod(const TQString& signature, Type type, KSharedPtr<MetaObject> object) : KShared() , d( new Private() ) // create the private d-pointer instance. { @@ -89,39 +89,39 @@ MetaMethod::MetaMethod(const QString& signature, Type type, KSharedPtr<MetaObjec d->object = object; d->type = type; - int startpos = d->signature.find("("); - int endpos = d->signature.findRev(")"); + int startpos = d->signature.tqfind("("); + int endpos = d->signature.tqfindRev(")"); if(startpos < 0 || startpos > endpos) { - throw Exception(QString("Invalid signature \"%1\"").arg(d->signature)); + throw Exception(TQString("Invalid signature \"%1\"").tqarg(d->signature)); } d->signaturetag = d->signature.left(startpos).stripWhiteSpace(); if(d->signaturetag.isEmpty()) { - throw Exception(QString("Invalid tagname in signature \"%1\"").arg(d->signature)); + throw Exception(TQString("Invalid tagname in signature \"%1\"").tqarg(d->signature)); } d->signaturearguments = d->signature.mid(startpos + 1, endpos - startpos - 1).stripWhiteSpace(); do { - int commapos = d->signaturearguments.find(","); - int starttemplatepos = d->signaturearguments.find("<"); + int commapos = d->signaturearguments.tqfind(","); + int starttemplatepos = d->signaturearguments.tqfind("<"); if(starttemplatepos >= 0 && (commapos < 0 || starttemplatepos < commapos)) { - int endtemplatepos = d->signaturearguments.find(">", starttemplatepos); + int endtemplatepos = d->signaturearguments.tqfind(">", starttemplatepos); if(endtemplatepos <= 0) { - throw Exception(QString("No closing template-definiton in signature \"%1\"").arg(d->signature)); + throw Exception(TQString("No closing template-definiton in signature \"%1\"").tqarg(d->signature)); } - commapos = d->signaturearguments.find(",", endtemplatepos); + commapos = d->signaturearguments.tqfind(",", endtemplatepos); } if(commapos > 0) { - QString s = d->signaturearguments.left(commapos).stripWhiteSpace(); + TQString s = d->signaturearguments.left(commapos).stripWhiteSpace(); if(! s.isEmpty()) { d->arguments.append( new MetaParameter(s) ); } d->signaturearguments = d->signaturearguments.right(d->signaturearguments.length() - commapos - 1); } else { - QString s = d->signaturearguments.stripWhiteSpace(); + TQString s = d->signaturearguments.stripWhiteSpace(); if(! s.isEmpty()) { d->arguments.append( new MetaParameter(s) ); } @@ -140,17 +140,17 @@ KSharedPtr<MetaObject> const MetaMethod::object() const return d->object; } -const QString MetaMethod::signature() const +const TQString MetaMethod::signature() const { return d->signature; } -const QString MetaMethod::signatureTag() const +const TQString MetaMethod::signatureTag() const { return d->signaturetag; } -const QString MetaMethod::signatureArguments() const +const TQString MetaMethod::signatureArguments() const { return d->signaturearguments; } @@ -165,71 +165,71 @@ MetaParameter::List MetaMethod::arguments() const return d->arguments; } -QUObject* MetaMethod::toQUObject(Variable::List arguments) +TQUObject* MetaMethod::toTQUObject(Variable::List arguments) { uint argsize = d->arguments.size(); if(arguments.size() <= argsize) { - throw Exception(QString("To less arguments for slot with siganture \"%1\"").arg(d->signature)); + throw Exception(TQString("To less arguments for slot with siganture \"%1\"").tqarg(d->signature)); } - // The first item in the QUObject-array is for the returnvalue + // The first item in the TQUObject-array is for the returnvalue // while everything >=1 are the passed parameters. - QUObject* uo = new QUObject[ argsize + 1 ]; + TQUObject* uo = new TQUObject[ argsize + 1 ]; - uo[0] = QUObject(); // empty placeholder for the returnvalue. + uo[0] = TQUObject(); // empty placeholder for the returnvalue. for(uint i = 0; i < argsize; i++) { KSharedPtr<MetaParameter> metaargument = d->arguments[i]; KSharedPtr<Variable> variable = arguments[i + 1]; if ( !variable ) { - throw Exception(QString("Variable is undefined !")); + throw Exception(TQString("Variable is undefined !")); } if(metaargument->type() != variable->type()) { - throw Exception(QString("Wrong variable type in method \"%1\". Expected \"%2\" but got \"%3\"").arg(d->signature).arg(metaargument->type()).arg(variable->type())); + throw Exception(TQString("Wrong variable type in method \"%1\". Expected \"%2\" but got \"%3\"").tqarg(d->signature).tqarg(metaargument->type()).tqarg(variable->type())); } switch(metaargument->type()) { case Variable::TypeNone: { kdDebug() << "Variable::TypeNone" << endl; - uo[i + 1] = QUObject(); + uo[i + 1] = TQUObject(); } break; case Variable::TypeVariant: { kdDebug() << "Variable::TypeVariant" << endl; - const QVariant variant = variable->variant(); + const TQVariant variant = variable->variant(); switch(metaargument->variantType()) { - case QVariant::String: { - const QString s = variant.toString(); - static_QUType_QString.set( &(uo[i + 1]), s ); + case TQVariant::String: { + const TQString s = variant.toString(); + static_TQUType_TQString.set( &(uo[i + 1]), s ); } break; - case QVariant::Int: { + case TQVariant::Int: { const int j = variant.toInt(); - static_QUType_int.set( &(uo[i + 1]), j ); + static_TQUType_int.set( &(uo[i + 1]), j ); } break; - case QVariant::Bool: { + case TQVariant::Bool: { const bool b = variant.toBool(); - static_QUType_bool.set( &(uo[i + 1]), b ); + static_TQUType_bool.set( &(uo[i + 1]), b ); } break; - case QVariant::Double: { + case TQVariant::Double: { const double d = variant.toDouble(); - static_QUType_double.set( &(uo[i + 1]), d ); + static_TQUType_double.set( &(uo[i + 1]), d ); } break; - case QVariant::Invalid: { - static_QUType_QVariant.set( &(uo[i + 1]), variant ); + case TQVariant::Invalid: { + static_TQUType_TQVariant.set( &(uo[i + 1]), variant ); } /*FIXME - static_QUType_charstar - static_QUType_ptr.get(uo); QObject *qobj = (QObject *)(ptr); + static_TQUType_charstar + static_TQUType_ptr.get(uo); TQObject *qobj = (TQObject *)(ptr); */ default: { - throw Exception(QString("Invalid parameter !!!!!!!!!!!!!!!!!!!!!!!")); + throw Exception(TQString("Invalid parameter !!!!!!!!!!!!!!!!!!!!!!!")); } break; } } break; @@ -237,15 +237,15 @@ QUObject* MetaMethod::toQUObject(Variable::List arguments) case Variable::TypeObject: { kdDebug() << "Variable::TypeObject" << endl; - const QObject* obj = arguments[i + 1]->object(); + const TQObject* obj = arguments[i + 1]->object(); if(! obj) { //FIXME: move check to MetaParameter?! - throw Exception(QString("No QObject !")); + throw Exception(TQString("No TQObject !")); } - static_QUType_ptr.set( &(uo[i + 1]), obj ); + static_TQUType_ptr.set( &(uo[i + 1]), obj ); } break; default: { - throw Exception(QString("Invalid variable type")); + throw Exception(TQString("Invalid variable type")); } break; } @@ -254,43 +254,43 @@ QUObject* MetaMethod::toQUObject(Variable::List arguments) return uo; } -KSharedPtr<Variable> MetaMethod::toVariable(QUObject* uo) +KSharedPtr<Variable> MetaMethod::toVariable(TQUObject* uo) { - const QString desc( uo->type->desc() ); + const TQString desc( uo->type->desc() ); if(desc == "null") { return new Variable(); } - if(desc == "QString") { - const QString s = static_QUType_QString.get(uo); + if(desc == TQSTRING_OBJECT_NAME_STRING) { + const TQString s = static_TQUType_TQString.get(uo); return new Variable(s); } if(desc == "int") { - const int j = static_QUType_int.get(uo); + const int j = static_TQUType_int.get(uo); return new Variable(j); } if(desc == "bool") { - const bool b = static_QUType_bool.get(uo); + const bool b = static_TQUType_bool.get(uo); return new Variable(b); } if(desc == "double") { - const double d = static_QUType_double.get(uo); + const double d = static_TQUType_double.get(uo); return new Variable(d); } - if(desc == "QVariant") { - QVariant v = static_QUType_QVariant.get(uo); + if(desc == "TQVariant") { + TQVariant v = static_TQUType_TQVariant.get(uo); return new Variable(v); } - throw Exception(QString("Invalid parameter '%1'").arg(desc)); + throw Exception(TQString("Invalid parameter '%1'").tqarg(desc)); } -Variable::List MetaMethod::toVariableList(QUObject* uo) +Variable::List MetaMethod::toVariableList(TQUObject* uo) { Variable::List list; @@ -311,12 +311,12 @@ KSharedPtr<Variable> MetaMethod::invoke(Variable::List arguments) throw Exception("MetaObject is undefined."); } - QObject* obj = d->object->object(); + TQObject* obj = d->object->object(); KSharedPtr<Variable> returnvalue; - QUObject* qu = 0; + TQUObject* qu = 0; try { - qu = toQUObject(arguments); + qu = toTQUObject(arguments); switch( d->type ) { case Signal: { @@ -334,7 +334,7 @@ KSharedPtr<Variable> MetaMethod::invoke(Variable::List arguments) returnvalue = toVariable( &qu[0] ); } catch(Exception& e) { - delete [] qu; // free the QUObject array and + delete [] qu; // free the TQUObject array and kdDebug() << "EXCEPTION in KoMacro::MetaMethod::invoke(Variable::List)" << endl; throw Exception(e); // re-throw exception } |