LCOV - code coverage report
Current view: top level - jvmfwk/plugins/sunmajor/pluginlib - util.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 15 53.3 %
Date: 2015-06-13 12:38:46 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_UTIL_HXX
      20             : #define INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_UTIL_HXX
      21             : 
      22             : #include "rtl/ustring.hxx"
      23             : #include "rtl/bootstrap.hxx"
      24             : #include <vector>
      25             : #include "vendorbase.hxx"
      26             : 
      27             : namespace jfw_plugin
      28             : {
      29             : 
      30             : class VendorBase;
      31             : std::vector<OUString> getVectorFromCharArray(char const * const * ar, int size);
      32             : 
      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.
      37             :  */
      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);
      46             : 
      47             : /* Returns a VendorBase object if JAVA_HOME environment variable points
      48             :    to a JRE.
      49             :  */
      50             : void addJavaInfoFromJavaHome(
      51             :     std::vector<rtl::Reference<VendorBase>> & allInfos,
      52             :     std::vector<rtl::Reference<VendorBase>> & addedInfos);
      53             : 
      54             : void addJavaInfosDirScan(
      55             :     std::vector<rtl::Reference<VendorBase>> & allInfos,
      56             :     std::vector<rtl::Reference<VendorBase>> & addedInfos);
      57             : 
      58             : bool makeDriveLetterSame(OUString * fileURL);
      59             : 
      60             : 
      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.
      64             : */
      65          12 : struct InfoFindSame
      66             : {
      67             :     OUString sJava;
      68           4 :     InfoFindSame(const OUString& sJavaHome):sJava(sJavaHome){}
      69             : 
      70           0 :     bool operator () (const rtl::Reference<VendorBase> & aVendorInfo)
      71             :     {
      72           0 :         return aVendorInfo->getHome().equals(sJava);
      73             :     }
      74             : };
      75             : 
      76         450 : struct SameOrSubDirJREMap
      77             : {
      78             :     OUString s1;
      79         150 :     SameOrSubDirJREMap(const OUString& s):s1(s){
      80         150 :     }
      81             : 
      82          73 :     bool operator () (const std::pair<const OUString, rtl::Reference<VendorBase> > & s2)
      83             :     {
      84          73 :         if (s1 == s2.first)
      85          73 :             return true;
      86           0 :         OUString sSub;
      87           0 :         sSub = s2.first + "/";
      88           0 :         if (s1.match(sSub))
      89           0 :             return true;
      90           0 :         return false;
      91             :     }
      92             : };
      93             : 
      94             : 
      95             : /* Creates a VendorBase object if a JRE could be found at the specified path.
      96             : 
      97             :    This depends if there is a JRE at all and if it is from a vendor that
      98             :    is supported by this plugin.
      99             :  */
     100             : rtl::Reference<VendorBase> getJREInfoByPath(const OUString& path);
     101             : 
     102             : std::vector<rtl::Reference<VendorBase> > addAllJREInfos(
     103             :     bool checkJavaHomeAndPath, std::vector<rtl::Reference<VendorBase>> & infos);
     104             : 
     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);
     112             : 
     113             : void bubbleSortVersion(std::vector<rtl::Reference<VendorBase> >& vec);
     114             : 
     115             : rtl::Bootstrap* getBootstrap();
     116             : }
     117             : 
     118             : #endif
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11