1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_UTIL_HXX
20 #define INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_UTIL_HXX
22 #include <rtl/ustring.hxx>
23 #include <rtl/bootstrap.hxx>
25 #include <vendorbase.hxx>
31 std::vector
<OUString
> getVectorFromCharArray(char const * const * ar
, int size
);
33 /* The function uses the relative paths, such as "bin/java.exe" and the provided
34 path to derive the home directory. The home directory is then used as
35 argument to getJREInfoByPath. For example usBinDir is
36 file:///c:/j2sdk/jre/bin then file:///c:/j2sdk/jre would be derived.
38 void addJREInfoFromBinPath(
40 std::vector
<rtl::Reference
<VendorBase
>> & allInfos
,
41 std::vector
<rtl::Reference
<VendorBase
>> & addedInfos
);
42 inline OUString
getDirFromFile(const OUString
& usFilePath
);
43 void addJavaInfosFromPath(
44 std::vector
<rtl::Reference
<VendorBase
>> & allInfos
,
45 std::vector
<rtl::Reference
<VendorBase
>> & addedInfos
);
47 /* Returns a VendorBase object if JAVA_HOME environment variable points
50 void addJavaInfoFromJavaHome(
51 std::vector
<rtl::Reference
<VendorBase
>> & allInfos
,
52 std::vector
<rtl::Reference
<VendorBase
>> & addedInfos
);
54 void addJavaInfosDirScan(
55 std::vector
<rtl::Reference
<VendorBase
>> & allInfos
,
56 std::vector
<rtl::Reference
<VendorBase
>> & addedInfos
);
58 bool makeDriveLetterSame(OUString
* fileURL
);
62 Used to find a JavaInfo::Impl object in a std::vector<Impl*> which has a member usJavaHome
63 as the specified string in the constructor.
68 explicit InfoFindSame(const OUString
& sJavaHome
):sJava(sJavaHome
){}
70 bool operator () (const rtl::Reference
<VendorBase
> & aVendorInfo
)
72 return aVendorInfo
->getHome() == sJava
;
76 struct SameOrSubDirJREMap
79 explicit SameOrSubDirJREMap(const OUString
& s
):s1(s
){
82 bool operator () (const std::pair
<const OUString
, rtl::Reference
<VendorBase
> > & s2
)
87 sSub
= s2
.first
+ "/";
95 /* Creates a VendorBase object if a JRE could be found at the specified path.
97 This depends if there is a JRE at all and if it is from a vendor that
98 is supported by this plugin.
100 rtl::Reference
<VendorBase
> getJREInfoByPath(const OUString
& path
);
102 std::vector
<rtl::Reference
<VendorBase
> > addAllJREInfos(
103 bool checkJavaHomeAndPath
, std::vector
<rtl::Reference
<VendorBase
>> & infos
);
106 const OUString
& exePath
,
107 #ifdef JVM_ONE_PATH_CHECK
108 const OUString
& homePath
,
110 std::vector
<std::pair
<OUString
, OUString
> >& props
,
113 void bubbleSortVersion(std::vector
<rtl::Reference
<VendorBase
> >& vec
);
115 rtl::Bootstrap
* getBootstrap();
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */