lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / jvmfwk / plugins / sunmajor / pluginlib / util.hxx
blob02ee2a4f62bad9a0d9840db3d74c3357f087b2e4
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 .
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>
24 #include <vector>
25 #include <vendorbase.hxx>
27 namespace jfw_plugin
30 class VendorBase;
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(
39 const OUString& path,
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
48 to a JRE.
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);
61 /* for std::find_if
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.
65 struct InfoFindSame
67 OUString sJava;
68 explicit InfoFindSame(const OUString& sJavaHome):sJava(sJavaHome){}
70 bool operator () (const rtl::Reference<VendorBase> & aVendorInfo)
72 return aVendorInfo->getHome() == sJava;
76 struct SameOrSubDirJREMap
78 OUString s1;
79 explicit SameOrSubDirJREMap(const OUString& s):s1(s){
82 bool operator () (const std::pair<const OUString, rtl::Reference<VendorBase> > & s2)
84 if (s1 == s2.first)
85 return true;
86 OUString sSub;
87 sSub = s2.first + "/";
88 if (s1.match(sSub))
89 return true;
90 return false;
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);
105 bool getJavaProps(
106 const OUString & exePath,
107 #ifdef JVM_ONE_PATH_CHECK
108 const OUString & homePath,
109 #endif
110 std::vector<std::pair<OUString, OUString> >& props,
111 bool * bProcessRun);
113 void bubbleSortVersion(std::vector<rtl::Reference<VendorBase> >& vec);
115 rtl::Bootstrap* getBootstrap();
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */