bump product version to 5.0.4.1
[LibreOffice.git] / desktop / source / pkgchk / unopkg / unopkg_shared.h
blob26a047aada964d004ef149eed248b082b2f15f4e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "dp_misc.h"
21 #include <com/sun/star/uno/Exception.hpp>
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
24 #include <com/sun/star/deployment/XPackage.hpp>
25 #include <tools/resmgr.hxx>
26 #include <rtl/ustring.hxx>
27 #include <unotools/configmgr.hxx>
28 #include <i18nlangtag/languagetag.hxx>
30 #define APP_NAME "unopkg"
32 namespace unopkg {
34 struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr >
36 ResMgr * operator () () {
37 return ResMgr::CreateResMgr(
38 "deployment", LanguageTag( utl::ConfigManager::getLocale() ) );
42 struct OptionInfo
44 char const * m_name;
45 sal_uInt32 m_name_length;
46 sal_Unicode m_short_option;
47 bool m_has_argument;
50 struct LockFileException : public css::uno::Exception
52 LockFileException(OUString const & sMessage) :
53 css::uno::Exception(sMessage, css::uno::Reference< css::uno::XInterface > ()) {}
57 OUString toString( OptionInfo const * info );
60 OptionInfo const * getOptionInfo(
61 OptionInfo const * list,
62 OUString const & opt, sal_Unicode copt = '\0' );
65 bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex );
68 bool readArgument(
69 OUString * pValue, OptionInfo const * option_info,
70 sal_uInt32 * pIndex );
73 inline bool readOption(
74 bool * flag, OptionInfo const * option_info, sal_uInt32 * pIndex )
76 if (isOption( option_info, pIndex )) {
77 OSL_ASSERT( flag != 0 );
78 *flag = true;
79 return true;
81 return false;
85 /** checks if an argument is a bootstrap variable. These start with -env:. For example
86 -env:UNO_JAVA_JFW_USER_DATA=file:///d:/user
88 bool isBootstrapVariable(sal_uInt32 * pIndex);
90 OUString const & getExecutableDir();
93 OUString const & getProcessWorkingDir();
96 OUString makeAbsoluteFileUrl(
97 OUString const & sys_path, OUString const & base_url,
98 bool throw_exc = true );
103 css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv(
104 css::uno::Reference<css::uno::XComponentContext> const & xContext,
105 OUString const & logFile,
106 bool option_force_overwrite,
107 bool option_verbose,
108 bool option_suppressLicense);
110 void printf_packages(
111 ::std::vector<
112 css::uno::Reference<css::deployment::XPackage> > const & allExtensions,
113 ::std::vector<bool> const & vecUnaccepted,
114 css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
115 sal_Int32 level = 0 );
120 css::uno::Reference<css::uno::XComponentContext> getUNO(
121 bool verbose, bool shared, bool bGui,
122 css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */