~kubuntu-members/korundum/4.11

« back to all changes in this revision

Viewing changes to qtwebkit/qtwebkit.cpp

  • Committer: Ian Monroe
  • Date: 2010-11-21 15:55:01 UTC
  • Revision ID: git-v1:c37670e4e3c59f5eb2ba112f5341a5e706217f6f
Split up Smoke into Qt and KDE directories. 
Move libsmoke stuff into the generator directory
Split up Ruby into qtruby and korundum directories

svn path=/trunk/KDE/kdebindings/ruby/; revision=1199320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <ruby.h>
2
 
 
3
 
#include <QHash>
4
 
#include <QList>
5
 
#include <QtDebug>
6
 
 
7
 
#include <smoke/qtwebkit_smoke.h>
8
 
 
9
 
#include <qtruby.h>
10
 
 
11
 
#include <iostream>
12
 
 
13
 
static VALUE getClassList(VALUE /*self*/)
14
 
{
15
 
    VALUE classList = rb_ary_new();
16
 
    for (int i = 1; i <= qtwebkit_Smoke->numClasses; i++) {
17
 
        if (qtwebkit_Smoke->classes[i].className && !qtwebkit_Smoke->classes[i].external) {
18
 
            rb_ary_push(classList, rb_str_new2(qtwebkit_Smoke->classes[i].className));
19
 
        }
20
 
    }
21
 
    return classList;
22
 
}
23
 
 
24
 
const char*
25
 
resolve_classname_qtwebkit(smokeruby_object * o)
26
 
{
27
 
    return qtruby_modules[o->smoke].binding->className(o->classId);
28
 
}
29
 
 
30
 
extern TypeHandler QtWebKit_handlers[];
31
 
 
32
 
extern "C" {
33
 
 
34
 
VALUE qtwebkit_module;
35
 
VALUE qtwebkit_internal_module;
36
 
 
37
 
static QtRuby::Binding binding;
38
 
 
39
 
Q_DECL_EXPORT void
40
 
Init_qtwebkit()
41
 
{
42
 
    init_qtwebkit_Smoke();
43
 
 
44
 
    binding = QtRuby::Binding(qtwebkit_Smoke);
45
 
 
46
 
    smokeList << qtwebkit_Smoke;
47
 
 
48
 
    QtRubyModule module = { "QtWebKit", resolve_classname_qtwebkit, 0, &binding };
49
 
    qtruby_modules[qtwebkit_Smoke] = module;
50
 
 
51
 
    install_handlers(QtWebKit_handlers);
52
 
 
53
 
    qtwebkit_module = rb_define_module("QtWebKit");
54
 
    qtwebkit_internal_module = rb_define_module_under(qtwebkit_module, "Internal");
55
 
 
56
 
    rb_define_singleton_method(qtwebkit_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);
57
 
 
58
 
    rb_require("qtwebkit/qtwebkit.rb");
59
 
    rb_funcall(qtwebkit_internal_module, rb_intern("init_all_classes"), 0);
60
 
}
61
 
 
62
 
}