[Kde-bindings] KDE/kdebindings/ruby/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Tue Jul 21 09:41:14 UTC 2009
SVN commit 1000416 by rdale:
* Revert a commit made by 'divide' some time ago. It was a hack to allow
primitive types to be passed as arguments where the expected arg type
was a Qt::Variant. However, it subverts the 'munged method name' scheme
of fast overloaded method resolution because for every method argument of
type '#' (a class), it adds another of type '$' (a primitive type). So
with that scheme we might as well have only two of the munged method
types instead of three. Sometime we need to add support for C++ implicit
constructors in resolving overloaded methods at runtime, but that is a
really hard problem. In the meantime I think it is best to add support
for implicitely converting args to Qt::Variants on a case by case basis,
such as was done for the QtDBus and Plasma Data Engine apis.
CCMAIL: kde-bindings at kde.org
M +13 -0 ChangeLog
M +1 -0 src/Qt.cpp
M +1 -13 src/lib/Qt/qtruby4.rb
M +0 -9 src/marshall_basetypes.h
--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #1000415:1000416
@@ -1,3 +1,16 @@
+2009-07-21 Richard Dale <richard.j.dale at gmail.com>
+ * Revert a commit made by 'divide' some time ago. It was a hack to allow
+ primitive types to be passed as arguments where the expected arg type
+ was a Qt::Variant. However, it subverts the 'munged method name' scheme
+ of fast overloaded method resolution because for every method argument of
+ type '#' (a class), it adds another of type '$' (a primitive type). So
+ with that scheme we might as well have only two of the munged method
+ types instead of three. Sometime we need to add support for C++ implicit
+ constructors in resolving overloaded methods at runtime, but that is a
+ really hard problem. In the meantime I think it is best to add support
+ for implicitely converting args to Qt::Variants on a case by case basis,
+ such as was done for the QtDBus and Plasma Data Engine apis.
+
2009-06-23 Richard Dale <richard.j.dale at gmail.com>
* In smokeruby_mark() layouts owned by QWidgets or QGraphicsWidgets are
now marked. Items owned by QLayouts or QGraphicsLayouts are also marked.
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #1000415:1000416
@@ -128,6 +128,7 @@
void
free_smokeruby_object(smokeruby_object * o)
{
+ o->ptr = 0;
xfree(o);
return;
}
--- trunk/KDE/kdebindings/ruby/qtruby/src/lib/Qt/qtruby4.rb #1000415:1000416
@@ -2469,13 +2469,6 @@
def Internal.checkarg(argtype, typename)
puts " #{typename} (#{argtype})" if debug_level >= DebugLevel::High
- if typename =~ /^(const )?QVariant&?$/ && !(typename =~ /QList/)
- if argtype == "QVariant"
- return 2
- else
- return 0
- end
- end
if argtype == 'i'
if typename =~ /^int&?$|^signed int&?$|^signed$|^qint32&?$/
return 3
@@ -2636,12 +2629,7 @@
elsif arg.kind_of? Array or arg.kind_of? Hash
methods.collect! { |meth| meth << '?' }
else
- temp = []
- methods.collect! do |meth|
- temp << meth + '#'
- meth << '$'
- end
- methods.concat(temp)
+ methods.collect! { |meth| meth << '$' }
end
end
--- trunk/KDE/kdebindings/ruby/qtruby/src/marshall_basetypes.h #1000415:1000416
@@ -90,15 +90,6 @@
{
VALUE v = *(m->var());
- if (TYPE(v) != T_DATA) {
- if (QByteArray(m->type().name()).contains("QVariant"))
- v = rb_funcall(qvariant_class, rb_intern("new"), 1, v);
- else if (v != Qnil) {
- rb_raise(rb_eArgError, "Invalid type, expecting %s\n", m->type().name());
- return;
- }
- }
-
if (v == Qnil) {
m->item().s_class = 0;
return;
More information about the Kde-bindings
mailing list