0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the documentation of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
/*!
|
|
43 |
\page activeqt-dumpcpp.html
|
|
44 |
\title The dumpcpp Tool (ActiveQt)
|
|
45 |
|
|
46 |
\ingroup activeqt-tools
|
|
47 |
|
|
48 |
\keyword dumpcpp
|
|
49 |
|
|
50 |
The \c dumpcpp tool generates a C++ namespace for a type library.
|
|
51 |
|
|
52 |
To generate a C++ namespace for a type library, call \c dumpcpp with the following
|
|
53 |
command line parameters:
|
|
54 |
|
|
55 |
\table
|
|
56 |
\header
|
|
57 |
\i Option
|
|
58 |
\i Result
|
|
59 |
\row
|
|
60 |
\i input
|
|
61 |
\i Generate documentation for \e input. \e input can specify a type library file or a type
|
|
62 |
library ID, or a CLSID or ProgID for an object
|
|
63 |
\row
|
|
64 |
\i -o file
|
|
65 |
\i Writes the class declaration to \e {file}.h and meta object infomation to \e {file}.cpp
|
|
66 |
\row
|
|
67 |
\i -n namespace
|
|
68 |
\i Generate a C++ namespace \e namespace
|
|
69 |
\row
|
|
70 |
\i -nometaobject
|
|
71 |
\i Do not generate a .cpp file with the meta object information.
|
|
72 |
The meta object is then generated in runtime.
|
|
73 |
\row
|
|
74 |
\i -getfile libid
|
|
75 |
\i Print the filename for the typelibrary \e libid to stdout
|
|
76 |
\row
|
|
77 |
\i -compat
|
|
78 |
\i Generate namespace with dynamicCall-compatible API
|
|
79 |
\row
|
|
80 |
\i -v
|
|
81 |
\i Print version information
|
|
82 |
\row
|
|
83 |
\i -h
|
|
84 |
\i Print help
|
|
85 |
\endtable
|
|
86 |
|
|
87 |
\c dumpcpp can be integrated into the \c qmake build system. In your .pro file, list the type
|
|
88 |
libraries you want to use in the TYPELIBS variable:
|
|
89 |
|
|
90 |
\snippet examples/activeqt/qutlook/qutlook.pro 0
|
|
91 |
|
|
92 |
The generated namespace will declare all enumerations, as well as one QAxObject subclass
|
|
93 |
for each \c coclass and \c interface declared in the type library. coclasses marked with
|
|
94 |
the \c control attribute will be wrapped by a QAxWidget subclass.
|
|
95 |
|
|
96 |
Those classes that wrap creatable coclasses (i.e. coclasses that are not marked
|
|
97 |
as \c noncreatable) have a default constructor; this is typically a single class
|
|
98 |
of type \c Application.
|
|
99 |
|
|
100 |
\snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 0
|
|
101 |
|
|
102 |
All other classes can only be created by passing an IDispatch interface pointer
|
|
103 |
to the constructor; those classes should however not be created explicitly.
|
|
104 |
Instead, use the appropriate API of already created objects.
|
|
105 |
|
|
106 |
\snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 1
|
|
107 |
|
|
108 |
All coclass wrappers also have one constructors taking an interface wrapper class
|
|
109 |
for each interface implemented.
|
|
110 |
|
|
111 |
\snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 2
|
|
112 |
|
|
113 |
You have to create coclasses to be able to connect to signals of the subobject.
|
|
114 |
Note that the constructor deletes the interface object, so the following will
|
|
115 |
cause a segmentation fault:
|
|
116 |
|
|
117 |
\snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 3
|
|
118 |
|
|
119 |
If the return type is of a coclass or interface type declared in another type
|
|
120 |
library you have to include the namespace header for that other type library
|
|
121 |
before including the header for the namespace you want to use (both header have
|
|
122 |
to be generated with this tool).
|
|
123 |
|
|
124 |
By default, methods and property returning subobjects will use the type as in
|
|
125 |
the type library. The caller of the function is responsible for deleting or
|
|
126 |
reparenting the object returned. If the \c -compat switch is set, properties
|
|
127 |
and method returning a COM object have the return type \c IDispatch*, and
|
|
128 |
the namespace will not declare wrapper classes for interfaces.
|
|
129 |
|
|
130 |
In this case, create the correct wrapper class explicitly:
|
|
131 |
|
|
132 |
\snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 4
|
|
133 |
|
|
134 |
You can of course use the IDispatch* returned directly, in which case you have to
|
|
135 |
call \c Release() when finished with the interface.
|
|
136 |
|
|
137 |
All classes in the namespace are tagged with a macro that allows you to export
|
|
138 |
or import them from a DLL. To do that, declare the macro to expand to
|
|
139 |
\c __declspec(dllimport/export) before including the header file.
|
|
140 |
|
|
141 |
To build the tool you must first build the QAxContainer library.
|
|
142 |
Then run your make tool in \c tools/dumpcpp.
|
|
143 |
*/
|