~kubuntu-members/perlkde/4.11

« back to all changes in this revision

Viewing changes to qthelp/src/QtHelp4.xs

  • Committer: Arno Rehn
  • Date: 2011-01-06 17:49:41 UTC
  • Revision ID: git-v1:ada9e4b459cf6fabd0f3b9b164387469cb19d9bc
A patch by Ian Monroe and myself to modularize the repository.
See README.MODULARIZATION for details.

svn path=/trunk/KDE/kdebindings/perl/; revision=1212365

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          QtHelp4.xs  -  QtHelp perl extension
3
 
                             -------------------
4
 
    begin                : 10-12-2010
5
 
    copyright            : (C) 2010 by Chris Burel
6
 
    email                : chrisburel@gmail.com
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
 
18
 
#include <QHash>
19
 
#include <QList>
20
 
 
21
 
// Perl headers
22
 
extern "C" {
23
 
#include "EXTERN.h"
24
 
#include "perl.h"
25
 
#include "XSUB.h"
26
 
#include "ppport.h"
27
 
}
28
 
 
29
 
#include <smoke/qt/qthelp_smoke.h>
30
 
 
31
 
#include <smokeperl.h>
32
 
#include <handlers.h>
33
 
 
34
 
extern QList<Smoke*> smokeList;
35
 
 
36
 
const char*
37
 
resolve_classname_qthelp(smokeperl_object * o)
38
 
{
39
 
    return perlqt_modules[o->smoke].binding->className(o->classId);
40
 
}
41
 
 
42
 
extern TypeHandler QtHelp4_handlers[];
43
 
 
44
 
static PerlQt4::Binding bindingqthelp;
45
 
 
46
 
MODULE = QtHelp4            PACKAGE = QtHelp4::_internal
47
 
 
48
 
PROTOTYPES: DISABLE
49
 
 
50
 
SV*
51
 
getClassList()
52
 
    CODE:
53
 
        AV* classList = newAV();
54
 
        for (int i = 1; i <= qthelp_Smoke->numClasses; i++) {
55
 
            if (qthelp_Smoke->classes[i].className && !qthelp_Smoke->classes[i].external)
56
 
                av_push(classList, newSVpv(qthelp_Smoke->classes[i].className, 0));
57
 
        }
58
 
        RETVAL = newRV_noinc((SV*)classList);
59
 
    OUTPUT:
60
 
        RETVAL
61
 
 
62
 
SV*
63
 
getEnumList()
64
 
    CODE:
65
 
        AV *av = newAV();
66
 
        for(int i = 1; i < qthelp_Smoke->numTypes; i++) {
67
 
            Smoke::Type curType = qthelp_Smoke->types[i];
68
 
            if( (curType.flags & Smoke::tf_elem) == Smoke::t_enum )
69
 
                av_push(av, newSVpv(curType.name, 0));
70
 
        }
71
 
        RETVAL = newRV_noinc((SV*)av);
72
 
    OUTPUT:
73
 
        RETVAL
74
 
 
75
 
MODULE = QtHelp4            PACKAGE = QtHelp4
76
 
 
77
 
PROTOTYPES: ENABLE
78
 
 
79
 
BOOT:
80
 
    init_qthelp_Smoke();
81
 
    smokeList << qthelp_Smoke;
82
 
 
83
 
    bindingqthelp = PerlQt4::Binding(qthelp_Smoke);
84
 
 
85
 
    PerlQt4Module module = { "PerlQtHelp4", resolve_classname_qthelp, 0, &bindingqthelp  };
86
 
    perlqt_modules[qthelp_Smoke] = module;
87
 
 
88
 
    install_handlers(QtHelp4_handlers);