LibreOffice Module desktop (master)  1
unopkg_shared.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
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 <osl/diagnose.h>
26 #include <unotools/resmgr.hxx>
27 #include <rtl/ustring.hxx>
28 #include <unotools/configmgr.hxx>
30 
31 #define APP_NAME "unopkg"
32 
33 namespace unopkg {
34 
35 struct OptionInfo
36 {
37  char const * m_name;
38  sal_uInt32 m_name_length;
41 };
42 
43 struct LockFileException : public css::uno::Exception
44 {
45  explicit LockFileException(OUString const & sMessage) :
46  css::uno::Exception(sMessage, css::uno::Reference< css::uno::XInterface > ()) {}
47 };
48 
49 
50 OUString toString( OptionInfo const * info );
51 
52 
53 OptionInfo const * getOptionInfo(
54  OptionInfo const * list,
55  OUString const & opt );
56 
57 
58 bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex );
59 
60 
61 bool readArgument(
62  OUString * pValue, OptionInfo const * option_info,
63  sal_uInt32 * pIndex );
64 
65 
66 inline bool readOption(
67  bool * flag, OptionInfo const * option_info, sal_uInt32 * pIndex )
68 {
69  if (isOption( option_info, pIndex )) {
70  OSL_ASSERT( flag != nullptr );
71  *flag = true;
72  return true;
73  }
74  return false;
75 }
76 
77 
81 bool isBootstrapVariable(sal_uInt32 * pIndex);
82 
83 OUString const & getExecutableDir();
84 
85 
86 OUString const & getProcessWorkingDir();
87 
88 
89 OUString makeAbsoluteFileUrl(
90  OUString const & sys_path, OUString const & base_url );
91 
92 
93 
94 
95 css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv(
96  css::uno::Reference<css::uno::XComponentContext> const & xContext,
97  bool option_force_overwrite,
98  bool option_verbose,
99  bool option_suppressLicense);
100 
101 void printf_packages(
102  std::vector<
103  css::uno::Reference<css::deployment::XPackage> > const & allExtensions,
104  std::vector<bool> const & vecUnaccepted,
105  css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
106  sal_Int32 level = 0 );
107 
108 
109 
110 
111 css::uno::Reference<css::uno::XComponentContext> getUNO(
112  bool verbose, bool shared, bool bGui,
113  css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
114 
115 }
116 
117 
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString const & getProcessWorkingDir()
Reference< XCommandEnvironment > createCmdEnv(Reference< XComponentContext > const &xContext, bool option_force_overwrite, bool option_verbose, bool option_suppress_license)
OptionInfo const * getOptionInfo(OptionInfo const *list, OUString const &opt)
Definition: unopkg_misc.cxx:72
void printf_packages(std::vector< Reference< deployment::XPackage > > const &allExtensions, std::vector< bool > const &vecUnaccepted, Reference< XCommandEnvironment > const &xCmdEnv, sal_Int32 level)
bool readOption(bool *flag, OptionInfo const *option_info, sal_uInt32 *pIndex)
Definition: unopkg_shared.h:66
OUString makeAbsoluteFileUrl(OUString const &sys_path, OUString const &base_url)
Reference
sal_uInt16 sal_Unicode
Reference< XComponentContext > getUNO(bool verbose, bool shared, bool bGui, Reference< XComponentContext > &out_localContext)
sal_Unicode m_short_option
Definition: unopkg_shared.h:39
bool isOption(OptionInfo const *option_info, sal_uInt32 *pIndex)
Definition: unopkg_misc.cxx:93
char const * m_name
Definition: unopkg_shared.h:37
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:1798
bool readArgument(OUString *pValue, OptionInfo const *option_info, sal_uInt32 *pIndex)
OUString const & getExecutableDir()
bool isBootstrapVariable(sal_uInt32 *pIndex)
checks if an argument is a bootstrap variable.
sal_uInt32 m_name_length
Definition: unopkg_shared.h:38
LockFileException(OUString const &sMessage)
Definition: unopkg_shared.h:45
OUString toString(OptionInfo const *info)
Definition: unopkg_misc.cxx:54