xref: /AOO42X/main/unodevtools/source/skeletonmaker/skeletonmaker.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #include <iostream>
28*cdf0e10cSrcweir 
29*cdf0e10cSrcweir #include "sal/main.h"
30*cdf0e10cSrcweir #include "rtl/process.h"
31*cdf0e10cSrcweir #include "rtl/ustrbuf.hxx"
32*cdf0e10cSrcweir #include "unodevtools/typemanager.hxx"
33*cdf0e10cSrcweir #include "unodevtools/options.hxx"
34*cdf0e10cSrcweir #include "skeletonjava.hxx"
35*cdf0e10cSrcweir #include "skeletoncpp.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir using namespace ::rtl;
40*cdf0e10cSrcweir using namespace ::skeletonmaker;
41*cdf0e10cSrcweir using namespace ::unodevtools;
42*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace {
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir static const char usageText[] =
47*cdf0e10cSrcweir "\n sub-commands:\n"
48*cdf0e10cSrcweir "    dump        dump declarations on stdout (e.g. constructors, methods, type\n"
49*cdf0e10cSrcweir "                mapping for properties) or complete method bodies with\n"
50*cdf0e10cSrcweir "                method forwarding.\n"
51*cdf0e10cSrcweir "    component   generates language specific code skeleton files using the\n"
52*cdf0e10cSrcweir "                implementation name as the file and class name\n"
53*cdf0e10cSrcweir "    calc-add-in generates a language specific code skeleton for a calc add-in\n"
54*cdf0e10cSrcweir "                using the implementation name as the file and class name. A \n"
55*cdf0e10cSrcweir "                service type is necessary, referencing an interface which defines\n"
56*cdf0e10cSrcweir "                the new add-in functions.\n"
57*cdf0e10cSrcweir "    add-on      generates a language specific code skeleton for an add-on compnent\n"
58*cdf0e10cSrcweir "                using the implementation name as the file and class name. The protocol\n"
59*cdf0e10cSrcweir "                name(s) and the corresponding command(s) have to be specified with the\n"
60*cdf0e10cSrcweir "                '-p' option.\n"
61*cdf0e10cSrcweir "\n options:\n"
62*cdf0e10cSrcweir "    -env:INIFILENAME=<url> url specifies a URL to an UNO ini|rc file of an\n"
63*cdf0e10cSrcweir "                           existing UNO environment (URE, office installation).\n"
64*cdf0e10cSrcweir "    -env:UNO_TYPES=<url>   url specifies a binary type library file. It can be\n"
65*cdf0e10cSrcweir "                           a space separated list of urls.\n"
66*cdf0e10cSrcweir "    -a, --all              list all interface methods, not only the direct\n"
67*cdf0e10cSrcweir "                           ones\n"
68*cdf0e10cSrcweir "    --(java4|java5|cpp)    select the target language\n"
69*cdf0e10cSrcweir "                           --java4 generate output for Java 1.4 or earlier\n"
70*cdf0e10cSrcweir "                           --java5 generate output for Java 1.5 or later (is \n"
71*cdf0e10cSrcweir "                                   currently the default)\n"
72*cdf0e10cSrcweir "                           --cpp   generate output for C++\n"
73*cdf0e10cSrcweir "    -sn, --shortnames      using namespace abbreviation 'css:': for\n"
74*cdf0e10cSrcweir "                           '::com::sun::star::', only valid for sub-command\n"
75*cdf0e10cSrcweir "                           'dump' and target language 'cpp'. It is default for the\n"
76*cdf0e10cSrcweir "                           sub-command 'component'.\n"
77*cdf0e10cSrcweir "    --propertysetmixin     the generated skeleton implements the cppu::PropertySetMixin\n"
78*cdf0e10cSrcweir "                           helper if a referenced new style service specifies an\n"
79*cdf0e10cSrcweir "                           interface which provides attributes (directly or inherited).\n"
80*cdf0e10cSrcweir "    -lh --licenseheader    generates a default OpenOffice.org LGPL license\n"
81*cdf0e10cSrcweir "                           header at the beginning of a component source file.\n"
82*cdf0e10cSrcweir "                           This option is taken into account in 'component' mode\n"
83*cdf0e10cSrcweir "                           only and if -o is unequal 'stdout'.\n"
84*cdf0e10cSrcweir "    -bc                    specifies that the generated calc add-in is backward\n"
85*cdf0e10cSrcweir "    --backward-compatible  compatible to older office versions and implement the\n"
86*cdf0e10cSrcweir "                           former required add-in interfaces where the implementation\n"
87*cdf0e10cSrcweir "                           is mapped on the new add-in configuration. In this case\n"
88*cdf0e10cSrcweir "                           the config schema needs to be bundled with the extension\n"
89*cdf0e10cSrcweir "                           add-in as well. Default is a minimal add-in component\n"
90*cdf0e10cSrcweir "                           skeleton based on the configuration coming with the\n"
91*cdf0e10cSrcweir "                           office since OO.org 2.0.4.\n"
92*cdf0e10cSrcweir "    -o <path>              path specifies an existing directory where the\n"
93*cdf0e10cSrcweir "                           output files are generated to, only valid for\n"
94*cdf0e10cSrcweir "                           sub-command 'component'. If path=stdout the generated\n"
95*cdf0e10cSrcweir "                           code is generated on standard out instead of a file.\n"
96*cdf0e10cSrcweir "    -l <file>              specifies a binary type library (can be used more\n"
97*cdf0e10cSrcweir "                           than once). The type library is integrated as an\n"
98*cdf0e10cSrcweir "                           additional type provider in the bootstrapped type\n"
99*cdf0e10cSrcweir "                           system.\n"
100*cdf0e10cSrcweir "    -n <name>              specifies an implementation name for the component\n"
101*cdf0e10cSrcweir "                           (used as classname, filename and package|namespace\n"
102*cdf0e10cSrcweir "                           name). In 'dump' mode it is used as classname (e.g.\n"
103*cdf0e10cSrcweir "                           \"MyBase::\", C++ only) to generate method bodies not\n"
104*cdf0e10cSrcweir "                           inline.\n"
105*cdf0e10cSrcweir "    -d <name>              specifies a base classname or a delegator.\n"
106*cdf0e10cSrcweir "                           In 'dump' mode it is used as a delegator to forward\n"
107*cdf0e10cSrcweir "                           methods. It can be used as '<name>::' for base\n"
108*cdf0e10cSrcweir "                           forwarding, or '<name>->|.' for composition.\n"
109*cdf0e10cSrcweir "                           Using \"_\" means that a default bodies with default\n"
110*cdf0e10cSrcweir "                           return values are dumped.\n"
111*cdf0e10cSrcweir "    -t <name>              specifies an UNOIDL type name, e.g.\n"
112*cdf0e10cSrcweir "                           com.sun.star.text.XText (can be used more than once)\n"
113*cdf0e10cSrcweir "    -p <protocol:cmd(s)>   specifies an add-on protocol name and the corresponding\n"
114*cdf0e10cSrcweir "                           command names, where the commands are a ',' separated list\n"
115*cdf0e10cSrcweir "                           of unique commands. This option is only valid for add-ons.\n"
116*cdf0e10cSrcweir "    -V, --version          print version number and exit\n"
117*cdf0e10cSrcweir "    -h, --help             print this help and exit\n\n";
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir void printUsageAndExit(const char* programname, const char* version)
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     std::cerr
122*cdf0e10cSrcweir         << "\n using: " << programname
123*cdf0e10cSrcweir         << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n"
124*cdf0e10cSrcweir         << "            dump [<options>] -t <type> ...\n"
125*cdf0e10cSrcweir         << "        " << programname
126*cdf0e10cSrcweir         << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n"
127*cdf0e10cSrcweir         << "            component [<options>] -n <name> -t <type> ...\n"
128*cdf0e10cSrcweir         << "        " << programname
129*cdf0e10cSrcweir         << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n"
130*cdf0e10cSrcweir         << "            calc-add-in [<options>] -n <name> -t <add-in_service>\n"
131*cdf0e10cSrcweir         << "        " << programname
132*cdf0e10cSrcweir         << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n"
133*cdf0e10cSrcweir         << "            add-on [<options>] -n <name> -p <protocol_name:command,...>\n"
134*cdf0e10cSrcweir         << "        " << programname << " -V, --version\n"
135*cdf0e10cSrcweir         << "        " << programname << " -h, --help\n"
136*cdf0e10cSrcweir         << usageText
137*cdf0e10cSrcweir         << programname << " Version " << version << "\n\n";
138*cdf0e10cSrcweir }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/)
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir     const char* version = "0.4";
145*cdf0e10cSrcweir     const char* programname = "uno-skeletonmaker";
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     if ( argc <= 1 ) {
148*cdf0e10cSrcweir         printUsageAndExit(programname, version);
149*cdf0e10cSrcweir         exit(EXIT_FAILURE);
150*cdf0e10cSrcweir     }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     ProgramOptions options;
153*cdf0e10cSrcweir     std::vector< OUString > registries;
154*cdf0e10cSrcweir     std::vector< OString > types;
155*cdf0e10cSrcweir     OString delegate;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     try {
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     sal_Int32 nPos = 0;
160*cdf0e10cSrcweir     sal_Int32 nCount = (sal_Int32)rtl_getAppCommandArgCount();
161*cdf0e10cSrcweir     OUString arg, sOption;
162*cdf0e10cSrcweir     sal_Bool bOption=sal_False;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir     // check command
165*cdf0e10cSrcweir     rtl_getAppCommandArg(nPos++, &arg.pData);
166*cdf0e10cSrcweir     if ( arg.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("dump"))) ) {
167*cdf0e10cSrcweir         options.dump = true;
168*cdf0e10cSrcweir     } else if ( arg.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("component"))) ) {
169*cdf0e10cSrcweir         options.dump = false;
170*cdf0e10cSrcweir         options.shortnames = true;
171*cdf0e10cSrcweir     } else if ( arg.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("calc-add-in"))) ) {
172*cdf0e10cSrcweir         options.dump = false;
173*cdf0e10cSrcweir         options.shortnames = true;
174*cdf0e10cSrcweir         options.componenttype = 2;
175*cdf0e10cSrcweir     } else if ( arg.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("add-on"))) ) {
176*cdf0e10cSrcweir         options.dump = false;
177*cdf0e10cSrcweir         options.shortnames = true;
178*cdf0e10cSrcweir         options.componenttype = 3;
179*cdf0e10cSrcweir     } else if ( readOption( &bOption, "h", &nPos, arg) ||
180*cdf0e10cSrcweir                 readOption( &bOption, "help", &nPos, arg) ) {
181*cdf0e10cSrcweir         printUsageAndExit(programname, version);
182*cdf0e10cSrcweir         exit(EXIT_SUCCESS);
183*cdf0e10cSrcweir     } else if ( readOption( &bOption, "V", &nPos, arg) ||
184*cdf0e10cSrcweir                 readOption( &bOption, "version", &nPos, arg) ) {
185*cdf0e10cSrcweir         std::cerr << "\n Sun Microsystems (R) " << programname
186*cdf0e10cSrcweir                   << " Version " << version << "\n\n";
187*cdf0e10cSrcweir         exit(EXIT_SUCCESS);
188*cdf0e10cSrcweir     } else {
189*cdf0e10cSrcweir         std::cerr
190*cdf0e10cSrcweir             << "ERROR: unexpected command \""
191*cdf0e10cSrcweir             << OUStringToOString(arg, RTL_TEXTENCODING_UTF8).getStr()
192*cdf0e10cSrcweir             << "\"!\n";
193*cdf0e10cSrcweir         printUsageAndExit(programname, version);
194*cdf0e10cSrcweir         exit(EXIT_FAILURE);
195*cdf0e10cSrcweir     }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     // read up to arguments
198*cdf0e10cSrcweir     while ( nPos < nCount )
199*cdf0e10cSrcweir     {
200*cdf0e10cSrcweir         rtl_getAppCommandArg(nPos, &arg.pData);
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir         if ( readOption( &bOption, "a", &nPos, arg) ||
203*cdf0e10cSrcweir              readOption( &bOption, "all", &nPos, arg) ) {
204*cdf0e10cSrcweir             options.all = true;
205*cdf0e10cSrcweir             continue;
206*cdf0e10cSrcweir         }
207*cdf0e10cSrcweir         if ( readOption( &bOption, "java4", &nPos, arg) ) {
208*cdf0e10cSrcweir             options.java5 = false;
209*cdf0e10cSrcweir             options.language = 1;
210*cdf0e10cSrcweir             continue;
211*cdf0e10cSrcweir         }
212*cdf0e10cSrcweir         if ( readOption( &bOption, "java5", &nPos, arg) ) {
213*cdf0e10cSrcweir             options.java5 = true;
214*cdf0e10cSrcweir             options.language = 1;
215*cdf0e10cSrcweir             continue;
216*cdf0e10cSrcweir         }
217*cdf0e10cSrcweir         if ( readOption( &bOption, "cpp", &nPos, arg) ) {
218*cdf0e10cSrcweir             options.java5 = false;
219*cdf0e10cSrcweir             options.language = 2;
220*cdf0e10cSrcweir             continue;
221*cdf0e10cSrcweir         }
222*cdf0e10cSrcweir         if ( readOption( &bOption, "sn", &nPos, arg) ||
223*cdf0e10cSrcweir              readOption( &bOption, "shortnames", &nPos, arg) ) {
224*cdf0e10cSrcweir             options.shortnames = true;
225*cdf0e10cSrcweir             continue;
226*cdf0e10cSrcweir         }
227*cdf0e10cSrcweir         if ( readOption( &bOption, "lh", &nPos, arg) ||
228*cdf0e10cSrcweir              readOption( &bOption, "licenseheader", &nPos, arg) ) {
229*cdf0e10cSrcweir             options.license = true;
230*cdf0e10cSrcweir             continue;
231*cdf0e10cSrcweir         }
232*cdf0e10cSrcweir         if ( readOption( &bOption, "bc", &nPos, arg) ||
233*cdf0e10cSrcweir              readOption( &bOption, "backward-compatible", &nPos, arg) ) {
234*cdf0e10cSrcweir             options.backwardcompatible = true;
235*cdf0e10cSrcweir             continue;
236*cdf0e10cSrcweir         }
237*cdf0e10cSrcweir         if ( readOption( &bOption, "propertysetmixin", &nPos, arg) ) {
238*cdf0e10cSrcweir             options.supportpropertysetmixin = true;
239*cdf0e10cSrcweir             continue;
240*cdf0e10cSrcweir         }
241*cdf0e10cSrcweir         if ( readOption( &sOption, "d", &nPos, arg) ) {
242*cdf0e10cSrcweir             delegate = OUStringToOString(sOption, RTL_TEXTENCODING_UTF8);
243*cdf0e10cSrcweir             continue;
244*cdf0e10cSrcweir         }
245*cdf0e10cSrcweir         if ( readOption( &sOption, "n", &nPos, arg) ) {
246*cdf0e10cSrcweir             options.implname = OUStringToOString(sOption, RTL_TEXTENCODING_UTF8);
247*cdf0e10cSrcweir             continue;
248*cdf0e10cSrcweir         }
249*cdf0e10cSrcweir         if ( readOption( &sOption, "o", &nPos, arg) ) {
250*cdf0e10cSrcweir             options.outputpath = OUStringToOString(sOption, RTL_TEXTENCODING_UTF8);
251*cdf0e10cSrcweir             continue;
252*cdf0e10cSrcweir         }
253*cdf0e10cSrcweir         if ( readOption( &sOption, "l", &nPos, arg) ) {
254*cdf0e10cSrcweir             registries.push_back(sOption);
255*cdf0e10cSrcweir             continue;
256*cdf0e10cSrcweir         }
257*cdf0e10cSrcweir         if ( readOption( &sOption, "t", &nPos, arg) ) {
258*cdf0e10cSrcweir             types.push_back(OUStringToOString(sOption, RTL_TEXTENCODING_UTF8));
259*cdf0e10cSrcweir             continue;
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir         if ( readOption( &sOption, "p", &nPos, arg) ) {
262*cdf0e10cSrcweir             OString sTmp(OUStringToOString(sOption, RTL_TEXTENCODING_UTF8));
263*cdf0e10cSrcweir             sal_Int32 nIndex= sTmp.indexOf(':');
264*cdf0e10cSrcweir             OString sPrt = sTmp.copy(0, nIndex+1);
265*cdf0e10cSrcweir             OString sCmds = sTmp.copy(nIndex+1);
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir             nIndex = 0;
268*cdf0e10cSrcweir             std::vector< OString > vCmds;
269*cdf0e10cSrcweir             do {
270*cdf0e10cSrcweir                 OString sCmd = sCmds.getToken( 0, ',', nIndex );
271*cdf0e10cSrcweir                 vCmds.push_back(sCmd);
272*cdf0e10cSrcweir             } while ( nIndex >= 0 );
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir             options.protocolCmdMap.insert(ProtocolCmdMap::value_type(sPrt, vCmds));
275*cdf0e10cSrcweir             continue;
276*cdf0e10cSrcweir         }
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir         // else illegal argument
280*cdf0e10cSrcweir         OUStringBuffer buf( 64 );
281*cdf0e10cSrcweir         buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("unexpected parameter \""));
282*cdf0e10cSrcweir         buf.append(arg);
283*cdf0e10cSrcweir         buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("\"!"));
284*cdf0e10cSrcweir         throw RuntimeException(buf.makeStringAndClear(),
285*cdf0e10cSrcweir                                Reference< XInterface >());
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir     if ( types.empty() && options.componenttype != 3) {
289*cdf0e10cSrcweir         std::cerr
290*cdf0e10cSrcweir             << ("\nError: no type is specified, use the -T option at least once\n");
291*cdf0e10cSrcweir         printUsageAndExit(programname, version);
292*cdf0e10cSrcweir         exit(EXIT_FAILURE);
293*cdf0e10cSrcweir     }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     UnoTypeManager manager;
296*cdf0e10cSrcweir     if ( !manager.init(registries) ) {
297*cdf0e10cSrcweir         std::cerr
298*cdf0e10cSrcweir             << ("\nError: Using the binary type libraries failed, check the -L"
299*cdf0e10cSrcweir                 " options\n");
300*cdf0e10cSrcweir         exit(EXIT_FAILURE);
301*cdf0e10cSrcweir     }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir     if ( options.dump ) {
304*cdf0e10cSrcweir         std::vector< OString >::const_iterator iter = types.begin();
305*cdf0e10cSrcweir         while (iter != types.end()) {
306*cdf0e10cSrcweir             std::cout << "\n/***************************************************"
307*cdf0e10cSrcweir                 "*****************************/\n";
308*cdf0e10cSrcweir             switch (options.language )
309*cdf0e10cSrcweir             {
310*cdf0e10cSrcweir             case 1: //Java
311*cdf0e10cSrcweir                 java::generateDocumentation(std::cout, options, manager,
312*cdf0e10cSrcweir                                             *iter, delegate);
313*cdf0e10cSrcweir                 break;
314*cdf0e10cSrcweir             case 2: //C++
315*cdf0e10cSrcweir                 cpp::generateDocumentation(std::cout, options, manager,
316*cdf0e10cSrcweir                                            *iter, delegate);
317*cdf0e10cSrcweir                 break;
318*cdf0e10cSrcweir             default:
319*cdf0e10cSrcweir                 OSL_ASSERT(false);
320*cdf0e10cSrcweir                 break;
321*cdf0e10cSrcweir             }
322*cdf0e10cSrcweir             ++iter;
323*cdf0e10cSrcweir         }
324*cdf0e10cSrcweir     } else {
325*cdf0e10cSrcweir         switch ( options.language )
326*cdf0e10cSrcweir         {
327*cdf0e10cSrcweir         case 1: //Java
328*cdf0e10cSrcweir             java::generateSkeleton(options, manager, types, delegate);
329*cdf0e10cSrcweir             break;
330*cdf0e10cSrcweir         case 2: //C++
331*cdf0e10cSrcweir             cpp::generateSkeleton(options, manager, types, delegate);
332*cdf0e10cSrcweir             break;
333*cdf0e10cSrcweir         default:
334*cdf0e10cSrcweir             OSL_ASSERT(false);
335*cdf0e10cSrcweir             break;
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir     }
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     } catch (CannotDumpException & e) {
340*cdf0e10cSrcweir         std::cout.flush();
341*cdf0e10cSrcweir         std::cerr << "\nError: " << e.m_message << std::endl;
342*cdf0e10cSrcweir     } catch(Exception& e) {
343*cdf0e10cSrcweir         std::cout.flush();
344*cdf0e10cSrcweir         std::cerr
345*cdf0e10cSrcweir             << "\nError: "
346*cdf0e10cSrcweir             << OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()
347*cdf0e10cSrcweir             << std::endl;
348*cdf0e10cSrcweir     }
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir     return 0;
351*cdf0e10cSrcweir }
352