summaryrefslogtreecommitdiffstats
path: root/lib/kross/ruby
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kross/ruby
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kross/ruby')
-rw-r--r--lib/kross/ruby/rubyextension.cpp92
-rw-r--r--lib/kross/ruby/rubyextension.h42
-rw-r--r--lib/kross/ruby/rubyinterpreter.cpp14
-rw-r--r--lib/kross/ruby/rubymodule.cpp8
-rw-r--r--lib/kross/ruby/rubymodule.h4
-rw-r--r--lib/kross/ruby/rubyscript.cpp16
-rw-r--r--lib/kross/ruby/rubyscript.h8
7 files changed, 92 insertions, 92 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);
}
diff --git a/lib/kross/ruby/rubyextension.h b/lib/kross/ruby/rubyextension.h
index 74041048..f6287961 100644
--- a/lib/kross/ruby/rubyextension.h
+++ b/lib/kross/ruby/rubyextension.h
@@ -102,40 +102,40 @@ class RubyExtension{
*/
static Kross::Api::Object::Ptr toObject(VALUE value);
/**
- * Converts a QString to a VALUE. If
- * the QString isNull() then a "" will
+ * Converts a TQString to a VALUE. If
+ * the TQString isNull() then a "" will
* be returned.
- * \param s The QString to convert.
- * \return The converted QString.
+ * \param s The TQString to convert.
+ * \return The converted TQString.
*/
- static VALUE toVALUE(const QString& s);
+ static VALUE toVALUE(const TQString& s);
/**
- * Converts a QStringList to a VALUE.
- * \param list The QStringList to convert.
- * \return The converted QStringList.
+ * Converts a TQStringList to a VALUE.
+ * \param list The TQStringList to convert.
+ * \return The converted TQStringList.
*/
- static VALUE toVALUE(QStringList list);
+ static VALUE toVALUE(TQStringList list);
/**
- * Converts a QMap to a VALUE.
- * \param map The QMap to convert.
- * \return The converted QMap.
+ * Converts a TQMap to a VALUE.
+ * \param map The TQMap to convert.
+ * \return The converted TQMap.
*/
- static VALUE toVALUE(QMap<QString, QVariant> map);
+ static VALUE toVALUE(TQMap<TQString, TQVariant> map);
/**
- * Converts a QValueList to a VALUE.
- * \param list The QValueList to convert.
- * \return The converted QValueList.
+ * Converts a TQValueList to a VALUE.
+ * \param list The TQValueList to convert.
+ * \return The converted TQValueList.
*/
- static VALUE toVALUE(QValueList<QVariant> list);
+ static VALUE toVALUE(TQValueList<TQVariant> list);
/**
- * Converts a QVariant to a VALUE.
- * \param variant The QVariant to convert.
- * \return The converted QVariant.
+ * Converts a TQVariant to a VALUE.
+ * \param variant The TQVariant to convert.
+ * \return The converted TQVariant.
*/
- static VALUE toVALUE(const QVariant& variant);
+ static VALUE toVALUE(const TQVariant& variant);
/**
* Converts a \a Kross::Api::Object to a VALUE.
diff --git a/lib/kross/ruby/rubyinterpreter.cpp b/lib/kross/ruby/rubyinterpreter.cpp
index 805ae722..d1fbec01 100644
--- a/lib/kross/ruby/rubyinterpreter.cpp
+++ b/lib/kross/ruby/rubyinterpreter.cpp
@@ -20,7 +20,7 @@
#include <map>
-#include <qregexp.h>
+#include <tqregexp.h>
#include <ksharedptr.h>
#include <api/exception.h>
@@ -61,7 +61,7 @@ extern "C"
namespace Kross {
namespace Ruby {
-typedef std::map<QString, VALUE> mStrVALUE;
+typedef std::map<TQString, VALUE> mStrVALUE;
typedef mStrVALUE::iterator mStrVALUE_it;
typedef mStrVALUE::const_iterator mStrVALUE_cit;
class RubyInterpreterPrivate {
@@ -119,11 +119,11 @@ VALUE RubyInterpreter::require (VALUE obj, VALUE name)
#ifdef KROSS_RUBY_INTERPRETER_DEBUG
krossdebug("RubyInterpreter::require(obj,name)");
#endif
- QString modname = StringValuePtr(name);
+ TQString modname = StringValuePtr(name);
if(modname.startsWith("kross")) {
- krossdebug( QString("RubyInterpreter::require() module=%1").arg(modname) );
- if( modname.find( QRegExp("[^a-zA-Z0-9\\_\\-]") ) >= 0 ) {
- krosswarning( QString("Denied import of Kross module '%1' cause of untrusted chars.").arg(modname) );
+ krossdebug( TQString("RubyInterpreter::require() module=%1").tqarg(modname) );
+ if( modname.tqfind( TQRegExp("[^a-zA-Z0-9\\_\\-]") ) >= 0 ) {
+ krosswarning( TQString("Denied import of Kross module '%1' cause of untrusted chars.").tqarg(modname) );
}
else {
Kross::Api::Module::Ptr module = Kross::Api::Manager::scriptManager()->loadModule(modname);
@@ -136,7 +136,7 @@ VALUE RubyInterpreter::require (VALUE obj, VALUE name)
// rb_define_variable( ("$" + modname).ascii(), & RubyInterpreter::d->m_modules.insert( mStrVALUE::value_type( modname, rm) ).first->second );
return Qtrue;
}
- krosswarning( QString("Loading of Kross module '%1' failed.").arg(modname) );
+ krosswarning( TQString("Loading of Kross module '%1' failed.").tqarg(modname) );
}
} else {
return rb_f_require(obj, name);
diff --git a/lib/kross/ruby/rubymodule.cpp b/lib/kross/ruby/rubymodule.cpp
index b002f24c..73012b89 100644
--- a/lib/kross/ruby/rubymodule.cpp
+++ b/lib/kross/ruby/rubymodule.cpp
@@ -33,11 +33,11 @@ class RubyModulePrivate {
};
-RubyModule::RubyModule(Kross::Api::Module::Ptr mod, QString modname) : d(new RubyModulePrivate)
+RubyModule::RubyModule(Kross::Api::Module::Ptr mod, TQString modname) : d(new RubyModulePrivate)
{
d->m_module = mod;
modname = modname.left(1).upper() + modname.right(modname.length() - 1 );
- krossdebug(QString("Module: %1").arg(modname));
+ krossdebug(TQString("Module: %1").tqarg(modname));
VALUE rmodule = rb_define_module(modname.ascii());
rb_define_module_function(rmodule,"method_missing", (VALUE (*)(...))RubyModule::method_missing, -1);
VALUE rm = RubyExtension::toVALUE( mod.data() );
@@ -51,8 +51,8 @@ RubyModule::~RubyModule()
VALUE RubyModule::method_missing(int argc, VALUE *argv, VALUE self)
{
#ifdef KROSS_RUBY_MODULE_DEBUG
- QString funcname = rb_id2name(SYM2ID(argv[0]));
- krossdebug(QString("Function %1 missing in a module").arg(funcname));
+ TQString funcname = rb_id2name(SYM2ID(argv[0]));
+ krossdebug(TQString("Function %1 missing in a module").tqarg(funcname));
#endif
VALUE rubyObjectModule = rb_funcall( self, rb_intern("const_get"), 1, ID2SYM(rb_intern("MODULEOBJ")) );
diff --git a/lib/kross/ruby/rubymodule.h b/lib/kross/ruby/rubymodule.h
index 0e4c278c..cf608722 100644
--- a/lib/kross/ruby/rubymodule.h
+++ b/lib/kross/ruby/rubymodule.h
@@ -22,7 +22,7 @@
#include <ruby.h>
-#include <qstring.h>
+#include <tqstring.h>
#include <api/object.h>
#include <api/module.h>
@@ -47,7 +47,7 @@ class RubyModule {
* wraps.
* @param modname The name the module will be published as.
*/
- RubyModule(Kross::Api::Module::Ptr mod, QString modname);
+ RubyModule(Kross::Api::Module::Ptr mod, TQString modname);
/**
* Destructor.
diff --git a/lib/kross/ruby/rubyscript.cpp b/lib/kross/ruby/rubyscript.cpp
index fa0ee1d0..dc0fbb16 100644
--- a/lib/kross/ruby/rubyscript.cpp
+++ b/lib/kross/ruby/rubyscript.cpp
@@ -41,10 +41,10 @@ class RubyScriptPrivate {
RubyScriptPrivate() : m_compile(0) { }
RNode* m_compile;
/// A list of functionnames.
- QStringList m_functions;
+ TQStringList m_functions;
/// A list of classnames.
- QStringList m_classes;
+ TQStringList m_classes;
};
RubyScript::RubyScript(Kross::Api::Interpreter* interpreter, Kross::Api::ScriptContainer* scriptcontainer)
@@ -87,7 +87,7 @@ void RubyScript::compile()
#ifdef KROSS_RUBY_SCRIPT_DEBUG
krossdebug("Compilation has failed");
#endif
- setException( new Kross::Api::Exception(QString("Failed to compile ruby code: %1").arg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error
+ setException( new Kross::Api::Exception(TQString("Failed to compile ruby code: %1").tqarg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error
d->m_compile = 0;
}
#ifdef KROSS_RUBY_SCRIPT_DEBUG
@@ -95,7 +95,7 @@ void RubyScript::compile()
#endif
}
-const QStringList& RubyScript::getFunctionNames()
+const TQStringList& RubyScript::getFunctionNames()
{
#ifdef KROSS_RUBY_SCRIPT_DEBUG
krossdebug("RubyScript::getFunctionNames()");
@@ -133,7 +133,7 @@ Kross::Api::Object::Ptr RubyScript::execute()
#endif
setException( RubyExtension::convertToException( ruby_errinfo ) );
} else {
- setException( new Kross::Api::Exception(QString("Failed to execute ruby code: %1").arg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error
+ setException( new Kross::Api::Exception(TQString("Failed to execute ruby code: %1").tqarg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error
}
}
@@ -144,7 +144,7 @@ Kross::Api::Object::Ptr RubyScript::execute()
return 0;
}
-Kross::Api::Object::Ptr RubyScript::callFunction(const QString& name, Kross::Api::List::Ptr args)
+Kross::Api::Object::Ptr RubyScript::callFunction(const TQString& name, Kross::Api::List::Ptr args)
{
Q_UNUSED(name)
Q_UNUSED(args)
@@ -160,7 +160,7 @@ Kross::Api::Object::Ptr RubyScript::callFunction(const QString& name, Kross::Api
return 0;
}
-const QStringList& RubyScript::getClassNames()
+const TQStringList& RubyScript::getClassNames()
{
#ifdef KROSS_RUBY_SCRIPT_DEBUG
krossdebug("RubyScript::getClassNames()");
@@ -172,7 +172,7 @@ const QStringList& RubyScript::getClassNames()
return d->m_classes;
}
-Kross::Api::Object::Ptr RubyScript::classInstance(const QString& name)
+Kross::Api::Object::Ptr RubyScript::classInstance(const TQString& name)
{
Q_UNUSED(name)
#ifdef KROSS_RUBY_SCRIPT_DEBUG
diff --git a/lib/kross/ruby/rubyscript.h b/lib/kross/ruby/rubyscript.h
index cc6eda43..6511e95a 100644
--- a/lib/kross/ruby/rubyscript.h
+++ b/lib/kross/ruby/rubyscript.h
@@ -57,7 +57,7 @@ class RubyScript : public Kross::Api::Script
* Return a list of callable functionnames this
* script spends.
*/
- virtual const QStringList& getFunctionNames();
+ virtual const TQStringList& getFunctionNames();
/**
* Execute the script.
@@ -67,17 +67,17 @@ class RubyScript : public Kross::Api::Script
/**
* Call a function.
*/
- virtual Kross::Api::Object::Ptr callFunction(const QString& name, Kross::Api::List::Ptr args);
+ virtual Kross::Api::Object::Ptr callFunction(const TQString& name, Kross::Api::List::Ptr args);
/**
* Return a list of class types this script supports.
*/
- virtual const QStringList& getClassNames();
+ virtual const TQStringList& getClassNames();
/**
* Create and return a new class instance.
*/
- virtual Kross::Api::Object::Ptr classInstance(const QString& name);
+ virtual Kross::Api::Object::Ptr classInstance(const TQString& name);
private: