summaryrefslogtreecommitdiffstats
path: root/src/activeqt/doc/src/activeqt-dumpcpp.qdoc
blob: 11ae6525376741ad0951012b7ac220c351720ce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page activeqt-dumpcpp.html
    \title The dumpcpp Tool (ActiveQt)

    \ingroup activeqt-tools

    \keyword dumpcpp

    The \c dumpcpp tool generates a C++ namespace for a type library.

    To generate a C++ namespace for a type library, call \c dumpcpp with the
    following command-line parameters:

    \table
    \header
    \li Option
    \li Result
    \row
    \li input
    \li Generate documentation for \e input. \e input can specify a type library file or a type
    library ID, or a CLSID or ProgID for an object
    \row
    \li -o file
    \li Writes the class declaration to \e {file}.h and meta object information to \e {file}.cpp
    \row
    \li -n namespace
    \li Generate a C++ namespace \e namespace
    \row
    \li -nometaobject
    \li Do not generate a .cpp file with the meta object information.
    The meta object is then generated in runtime.
    \row
    \li -getfile libid
    \li Print the filename for the typelibrary \e libid to stdout
    \row
    \li -compat
    \li Generate namespace with dynamicCall-compatible API
    \row
    \li -v
    \li Print version information
    \row
    \li -h
    \li Print help
    \endtable

    \c dumpcpp can be integrated into the \c qmake build system. In your .pro
    file, list the type libraries you want to use in the TYPELIBS variable:

    \snippet activeqt/qutlook/qutlook.pro 0

    The generated namespace will declare all enumerations, as well as one QAxObject subclass
    for each \c coclass and \c interface declared in the type library. coclasses marked with
    the \c control attribute will be wrapped by a QAxWidget subclass.

    Those classes that wrap creatable coclasses  (i.e. coclasses that are not marked
    as \c noncreatable) have a default constructor; this is typically a single class
    of type \c Application.

    \snippet doc_src_activeqt-dumpcpp.cpp 0

    All other classes can only be created by passing an IDispatch interface pointer
    to the constructor; those classes should however not be created explicitly.
    Instead, use the appropriate API of already created objects.

    \snippet doc_src_activeqt-dumpcpp.cpp 1

    All coclass wrappers also have one constructors taking an interface wrapper class
    for each interface implemented.

    \snippet doc_src_activeqt-dumpcpp.cpp 2

    You have to create coclasses to be able to connect to signals of the subobject.
    Note that the constructor deletes the interface object, so the following will
    cause a segmentation fault:

    \snippet doc_src_activeqt-dumpcpp.cpp 3

    If the return type is of a coclass or interface type declared in another
    type library you have to include the namespace header for that other type
    library before including the header for the namespace you want to use
    (both header have to be generated with this tool).

    By default, methods and property returning subobjects will use the type as in
    the type library. The caller of the function is responsible for deleting or
    reparenting the object returned. If the \c -compat switch is set, properties
    and method returning a COM object have the return type \c IDispatch*, and
    the namespace will not declare wrapper classes for interfaces.

    In this case, create the correct wrapper class explicitly:

    \snippet doc_src_activeqt-dumpcpp.cpp 4

    You can of course use the IDispatch* returned directly, in which case you have to
    call \c Release() when finished with the interface.

    All classes in the namespace are tagged with a macro that allows you to export
    or import them from a DLL. To do that, declare the macro to expand to
    \c __declspec(dllimport/export) before including the header file.

    To build the tool you must first build the QAxContainer library.
    Then run your make tool in \c tools/dumpcpp.
*/