1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test_getopt.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_testshl2.hxx"
42 // #define UNDER_WINDOWS_DEBUGGING
43 // Nice feature, to debug under windows, install msdev locally and use DebugBreak() to stop a new process at a point you want.
44 #ifdef UNDER_WINDOWS_DEBUGGING
45 #include <tools/presys.h>
47 #include <tools/postsys.h>
49 #define VCL_NEED_BASETSD
51 #endif /* UNDER_WINDOWS_DEBUGGING */
56 #include <rtl/string.hxx>
58 #include "filehelper.hxx"
61 // #include <osl/time.h>
65 // -----------------------------------------------------------------------------
68 * display usage screen
74 "USAGE: testshl shlname [-boom][-verbose][-log][-his][-msg]\n" );
78 // ----------------------------------- Main -----------------------------------
79 #if (defined UNX) || (defined OS2)
80 int main( int argc
, char* argv
[] )
82 int _cdecl
main( int argc
, char* argv
[] )
86 static char const* optionSet
[] = {
87 "-boom, stop near error position, exception only",
88 "-mode=s, the output mode, emacs, xml, old. Default is -mode old",
89 "-logPath=s, destination path for logging",
90 "-tc=s@, name(s) of testcase(s) to generate",
91 "-h:s, display help or help on option",
96 GetOpt
opt( argv
, optionSet
);
98 // someone indicates that he needs help
99 if ( opt
.hasOpt( "-h" ) || opt
.hasOpt( "-help" ) )
105 // get path for logging stuff..
108 if ( opt
.hasOpt( "-logPth" ))
110 logPth
= opt
.getOpt( "-logPth" );
114 if ( ! opt
.getParams().empty() ) {
115 param
= opt
.getFirstParam();
117 std::cout
<< "all non '-' Parameter values" << std::endl
;
119 vector
<rtl::OString
>& aVec
= opt
.getParams();
120 for(vector
<rtl::OString
>::const_iterator it
= aVec
.begin();
124 std::cout
<< (*it
).getStr() << std::endl
;
128 if ( opt
.hasOpt("-tc"))
130 std::cout
<< "Parameter -tc" << std::endl
;
131 vector
<rtl::OString
>& aVec
= opt
.getOptVec( "-tc" );
133 for(vector
<rtl::OString
>::const_iterator it
= aVec
.begin();
137 std::cout
<< (*it
).getStr() << std::endl
;