diff options
Diffstat (limited to 'lib/kross/ruby/rubyextension.cpp')
-rw-r--r-- | lib/kross/ruby/rubyextension.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/lib/kross/ruby/rubyextension.cpp b/lib/kross/ruby/rubyextension.cpp index 2c022cee..c989976d 100644 --- a/lib/kross/ruby/rubyextension.cpp +++ b/lib/kross/ruby/rubyextension.cpp @@ -20,8 +20,8 @@ #include <st.h> -#include <qmap.h> -#include <qstring.h> +#include <tqmap.h> +#include <tqstring.h> #include "api/list.h" @@ -63,10 +63,10 @@ VALUE RubyExtension::method_missing(int argc, VALUE *argv, VALUE self) VALUE RubyExtension::call_method( Kross::Api::Object::Ptr object, int argc, VALUE *argv) { - QString funcname = rb_id2name(SYM2ID(argv[0])); - QValueList<Api::Object::Ptr> argsList; + TQString funcname = rb_id2name(SYM2ID(argv[0])); + TQValueList<Api::Object::Ptr> argsList; #ifdef KROSS_RUBY_EXTENSION_DEBUG - krossdebug(QString("Building arguments list for function: %1 there are %2 arguments.").arg(funcname).arg(argc-1)); + krossdebug(TQString("Building arguments list for function: %1 there are %2 arguments.").tqarg(funcname).tqarg(argc-1)); #endif for(int i = 1; i < argc; i++) { @@ -79,13 +79,13 @@ VALUE RubyExtension::call_method( Kross::Api::Object::Ptr object, int argc, VALU Kross::Api::Callable* callable = dynamic_cast<Kross::Api::Callable*>(object.data()); if(callable && callable->hasChild(funcname)) { #ifdef KROSS_RUBY_EXTENSION_DEBUG - krossdebug( QString("Kross::Ruby::RubyExtension::method_missing name='%1' is a child object of '%2'.").arg(funcname).arg(object->getName()) ); + krossdebug( TQString("Kross::Ruby::RubyExtension::method_missing name='%1' is a child object of '%2'.").tqarg(funcname).tqarg(object->getName()) ); #endif - result = callable->getChild(funcname)->call(QString::null, new Api::List(argsList)); + result = callable->getChild(funcname)->call(TQString(), new Api::List(argsList)); } else { #ifdef KROSS_RUBY_EXTENSION_DEBUG - krossdebug( QString("Kross::Ruby::RubyExtension::method_missing try to call function with name '%1' in object '%2'.").arg(funcname).arg(object->getName()) ); + krossdebug( TQString("Kross::Ruby::RubyExtension::method_missing try to call function with name '%1' in object '%2'.").tqarg(funcname).tqarg(object->getName()) ); #endif result = object->call(funcname, new Api::List(argsList)); } @@ -132,16 +132,16 @@ RubyExtension::~RubyExtension() delete d; } -typedef QMap<QString, Kross::Api::Object::Ptr> mStrObj; +typedef TQMap<TQString, Kross::Api::Object::Ptr> mStrObj; int RubyExtension::convertHash_i(VALUE key, VALUE value, VALUE vmap) { - QMap<QString, Kross::Api::Object::Ptr>* map; + TQMap<TQString, Kross::Api::Object::Ptr>* map; Data_Get_Struct(vmap, mStrObj, map); if (key != Qundef) { Kross::Api::Object::Ptr o = RubyExtension::toObject( value ); - if(o) map->replace(STR2CSTR(key), o); + if(o) map->tqreplace(STR2CSTR(key), o); } return ST_CONTINUE; } @@ -184,7 +184,7 @@ VALUE RubyExtension::convertFromException(Kross::Api::Exception::Ptr exc) Kross::Api::Object::Ptr RubyExtension::toObject(VALUE value) { #ifdef KROSS_RUBY_EXTENSION_DEBUG - krossdebug(QString("RubyExtension::toObject of type %1").arg(TYPE(value))); + krossdebug(TQString("RubyExtension::toObject of type %1").tqarg(TYPE(value))); #endif switch( TYPE( value ) ) { @@ -207,10 +207,10 @@ Kross::Api::Object::Ptr RubyExtension::toObject(VALUE value) case T_FLOAT: return new Kross::Api::Variant(NUM2DBL(value)); case T_STRING: - return new Kross::Api::Variant(QString(STR2CSTR(value))); + return new Kross::Api::Variant(TQString(STR2CSTR(value))); case T_ARRAY: { - QValueList<Kross::Api::Object::Ptr> l; + TQValueList<Kross::Api::Object::Ptr> l; for(int i = 0; i < RARRAY(value)->len; i++) { Kross::Api::Object::Ptr o = toObject( rb_ary_entry( value , i ) ); @@ -219,17 +219,17 @@ Kross::Api::Object::Ptr RubyExtension::toObject(VALUE value) return new Kross::Api::List(l); } case T_FIXNUM: - return new Kross::Api::Variant((Q_LLONG)FIX2INT(value)); + return new Kross::Api::Variant((TQ_LLONG)FIX2INT(value)); case T_HASH: { - QMap<QString, Kross::Api::Object::Ptr> map; + TQMap<TQString, Kross::Api::Object::Ptr> map; VALUE vmap = Data_Wrap_Struct(rb_cObject, 0,0, &map); rb_hash_foreach(value, (int (*)(...))convertHash_i, vmap); return new Kross::Api::Dict(map); } case T_BIGNUM: { - return new Kross::Api::Variant((Q_LLONG)NUM2LONG(value)); + return new Kross::Api::Variant((TQ_LLONG)NUM2LONG(value)); } case T_TRUE: { @@ -241,7 +241,7 @@ Kross::Api::Object::Ptr RubyExtension::toObject(VALUE value) } case T_SYMBOL: { - return new Kross::Api::Variant(QString(rb_id2name(SYM2ID(value)))); + return new Kross::Api::Variant(TQString(rb_id2name(SYM2ID(value)))); } case T_MATCH: case T_OBJECT: @@ -251,85 +251,85 @@ Kross::Api::Object::Ptr RubyExtension::toObject(VALUE value) case T_MODULE: case T_ICLASS: case T_CLASS: - krosswarning(QString("This ruby type '%1' cannot be converted to a Kross::Api::Object").arg(TYPE(value))); + krosswarning(TQString("This ruby type '%1' cannot be converted to a Kross::Api::Object").tqarg(TYPE(value))); default: case T_NIL: return 0; } } -VALUE RubyExtension::toVALUE(const QString& s) +VALUE RubyExtension::toVALUE(const TQString& s) { return s.isNull() ? rb_str_new2("") : rb_str_new2(s.latin1()); } -VALUE RubyExtension::toVALUE(QStringList list) +VALUE RubyExtension::toVALUE(TQStringList list) { VALUE l = rb_ary_new(); - for(QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) + for(TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) rb_ary_push(l, toVALUE(*it)); return l; } -VALUE RubyExtension::toVALUE(QMap<QString, QVariant> map) +VALUE RubyExtension::toVALUE(TQMap<TQString, TQVariant> map) { VALUE h = rb_hash_new(); - for(QMap<QString, QVariant>::Iterator it = map.begin(); it != map.end(); ++it) + for(TQMap<TQString, TQVariant>::Iterator it = map.begin(); it != map.end(); ++it) rb_hash_aset(h, toVALUE(it.key()), toVALUE(it.data()) ); return h; } -VALUE RubyExtension::toVALUE(QValueList<QVariant> list) +VALUE RubyExtension::toVALUE(TQValueList<TQVariant> list) { VALUE l = rb_ary_new(); - for(QValueList<QVariant>::Iterator it = list.begin(); it != list.end(); ++it) + for(TQValueList<TQVariant>::Iterator it = list.begin(); it != list.end(); ++it) rb_ary_push(l, toVALUE(*it)); return l; } -VALUE RubyExtension::toVALUE(const QVariant& variant) +VALUE RubyExtension::toVALUE(const TQVariant& variant) { switch(variant.type()) { - case QVariant::Invalid: + case TQVariant::Invalid: return Qnil; - case QVariant::Bool: + case TQVariant::Bool: return (variant.toBool()) ? Qtrue : Qfalse; - case QVariant::Int: + case TQVariant::Int: return INT2FIX(variant.toInt()); - case QVariant::UInt: + case TQVariant::UInt: return UINT2NUM(variant.toUInt()); - case QVariant::Double: + case TQVariant::Double: return rb_float_new(variant.toDouble()); - case QVariant::Date: - case QVariant::Time: - case QVariant::DateTime: - case QVariant::ByteArray: - case QVariant::BitArray: - case QVariant::CString: - case QVariant::String: + case TQVariant::Date: + case TQVariant::Time: + case TQVariant::DateTime: + case TQVariant::ByteArray: + case TQVariant::BitArray: + case TQVariant::CString: + case TQVariant::String: return toVALUE(variant.toString()); - case QVariant::StringList: + case TQVariant::StringList: return toVALUE(variant.toStringList()); - case QVariant::Map: + case TQVariant::Map: return toVALUE(variant.toMap()); - case QVariant::List: + case TQVariant::List: return toVALUE(variant.toList()); // To handle following both cases is a bit difficult // cause Python doesn't spend an easy possibility // for such large numbers (TODO maybe BigInt?). So, // we risk overflows here, but well... - case QVariant::LongLong: { + case TQVariant::LongLong: { return INT2NUM((long)variant.toLongLong()); } - case QVariant::ULongLong: + case TQVariant::ULongLong: return UINT2NUM((unsigned long)variant.toULongLong()); default: { - krosswarning( QString("Kross::Ruby::RubyExtension::toVALUE(QVariant) Not possible to convert the QVariant type '%1' to a VALUE.").arg(variant.typeName()) ); + krosswarning( TQString("Kross::Ruby::RubyExtension::toVALUE(TQVariant) Not possible to convert the TQVariant type '%1' to a VALUE.").tqarg(variant.typeName()) ); return Qundef; } } @@ -341,7 +341,7 @@ VALUE RubyExtension::toVALUE(Kross::Api::Object::Ptr object) return 0; } if(object->getClassName() == "Kross::Api::Variant") { - QVariant v = static_cast<Kross::Api::Variant*>( object.data() )->getValue(); + TQVariant v = static_cast<Kross::Api::Variant*>( object.data() )->getValue(); return toVALUE(v); } |