[Kde-bindings] KDE/kdebindings/ruby/qtruby/src
Arno Rehn
kde at arnorehn.de
Wed Jul 28 00:01:41 UTC 2010
SVN commit 1155737 by arnorehn:
Revert "Choose the const/non-const version of a method based on whether the object"
Sorry for prematurely committing.
CCMAIL: kde-bindings at kde.org
M +0 -6 lib/Qt/qtruby4.rb
M +0 -11 marshall_basetypes.h
M +0 -4 marshall_types.h
M +51 -2 qtruby.cpp
--- trunk/KDE/kdebindings/ruby/qtruby/src/lib/Qt/qtruby4.rb #1155736:1155737
@@ -2727,13 +2727,7 @@
methodIds.each do
|id|
puts "matching => smoke: #{id.smoke} index: #{id.index}" if debug_level >= DebugLevel::High
-
- if this.frozen?
current_match = (isConstMethod(id) ? 1 : 0)
- else
- current_match = (isConstMethod(id) ? 0 : 1)
- end
-
(0...args.length).each do
|i|
current_match += checkarg(get_value_type(args[i]), get_arg_type_name(id, i))
--- trunk/KDE/kdebindings/ruby/qtruby/src/marshall_basetypes.h #1155736:1155737
@@ -10,9 +10,6 @@
#ifndef MARSHALL_BASETYPES_H
#define MARSHALL_BASETYPES_H
-#include "qtruby.h"
-#include "smokeruby.h"
-
template <class T> T* smoke_ptr(Marshall *m) { return (T*) m->item().s_voidp; }
template<> bool* smoke_ptr<bool>(Marshall *m) { return &m->item().s_bool; }
@@ -147,7 +144,6 @@
smokeruby_object * o = alloc_smokeruby_object(false, m->smoke(), m->type().classId(), p);
const char * classname = resolve_classname(o);
- bool freeze = false;
if (m->type().isConst() && m->type().isRef()) {
p = construct_copy( o );
if (do_debug & qtdb_gc) {
@@ -157,20 +153,13 @@
if (p) {
o->ptr = p;
o->allocated = true;
- } else {
- freeze = true;
}
- } else if (m->type().isConst() && m->type().isPtr()) {
- freeze = true;
}
obj = set_obj_info(classname, o);
if (do_debug & qtdb_gc) {
qWarning("allocating %s %p -> %p\n", classname, o->ptr, (void*)obj);
}
- if (freeze) {
- rb_obj_freeze(obj);
- }
/*
if(m->type().isStack()) {
--- trunk/KDE/kdebindings/ruby/qtruby/src/marshall_types.h #1155736:1155737
@@ -133,10 +133,6 @@
rb_raise(rb_eArgError, "%s is not a class method\n", _smoke->methodNames[method().name]);
}
- if (rb_obj_frozen_p(_target) && !(method().flags & Smoke::mf_const)) {
- rb_raise(rb_eRuntimeError, "%p (%s) is frozen, can't call non-const method '%s' on it\n", _o->ptr, classname(), _smoke->methodNames[method().name]);
- }
-
Smoke::ClassFn fn = _smoke->classes[method().classId].classFn;
void * ptr = 0;
--- trunk/KDE/kdebindings/ruby/qtruby/src/qtruby.cpp #1155736:1155737
@@ -40,8 +40,7 @@
#include <QtGui/qwidget.h>
#ifdef QT_QTDBUS
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusSignature>
+#include <QtDBus/qdbusargument.h>
#endif
#include <smoke/smoke.h>
@@ -618,6 +617,45 @@
return rb_str_new((const char *) bytes, image->bytesPerLine());
}
+#ifdef QT_QTDBUS
+static VALUE
+qdbusargument_endarraywrite(VALUE self)
+{
+ smokeruby_object *o = value_obj_info(self);
+ QDBusArgument * arg = (QDBusArgument *) o->ptr;
+ arg->endArray();
+ return self;
+}
+
+static VALUE
+qdbusargument_endmapwrite(VALUE self)
+{
+ smokeruby_object *o = value_obj_info(self);
+ QDBusArgument * arg = (QDBusArgument *) o->ptr;
+ arg->endMap();
+ return self;
+}
+
+static VALUE
+qdbusargument_endmapentrywrite(VALUE self)
+{
+ smokeruby_object *o = value_obj_info(self);
+ QDBusArgument * arg = (QDBusArgument *) o->ptr;
+ arg->endMapEntry();
+ return self;
+}
+
+static VALUE
+qdbusargument_endstructurewrite(VALUE self)
+{
+ smokeruby_object *o = value_obj_info(self);
+ QDBusArgument * arg = (QDBusArgument *) o->ptr;
+ arg->endStructure();
+ return self;
+}
+
+#endif
+
// The QtRuby runtime's overloaded method resolution mechanism can't currently
// distinguish between Ruby Arrays containing different sort of instances.
// Unfortunately Qt::Painter.drawLines() and Qt::Painter.drawRects() methods can
@@ -2242,6 +2280,17 @@
rb_define_method(klass, "mapping", (VALUE (*) (...)) qsignalmapper_mapping, -1);
rb_define_method(klass, "setMapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
rb_define_method(klass, "set_mapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
+#ifdef QT_QTDBUS
+ } else if (packageName == "Qt::DBusArgument") {
+ rb_define_method(klass, "endArrayWrite", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
+ rb_define_method(klass, "end_array_write", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
+ rb_define_method(klass, "endMapEntryWrite", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
+ rb_define_method(klass, "end_map_entry_write", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
+ rb_define_method(klass, "endMapWrite", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
+ rb_define_method(klass, "end_map_write", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
+ rb_define_method(klass, "endStructureWrite", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
+ rb_define_method(klass, "end_structure_write", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
+#endif
}
foreach(QtRubyModule m, qtruby_modules.values()) {
More information about the Kde-bindings
mailing list