LCOV - code coverage report
Current view: top level - jvmfwk/source - fwkutil.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 7 7 100.0 %
Date: 2014-04-14 Functions: 1 1 100.0 %
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_FWKUTIL_HXX
      20             : #define INCLUDED_JVMFWK_FWKUTIL_HXX
      21             : 
      22             : #include <config_features.h>
      23             : #include <config_folders.h>
      24             : 
      25             : #include "sal/config.h"
      26             : #include "osl/mutex.hxx"
      27             : #include "rtl/bootstrap.hxx"
      28             : #include "rtl/instance.hxx"
      29             : #include "rtl/ustrbuf.hxx"
      30             : #include "rtl/byteseq.hxx"
      31             : #include "osl/thread.hxx"
      32             : #if OSL_DEBUG_LEVEL >=2
      33             : #include <stdio.h>
      34             : #endif
      35             : 
      36             : 
      37             : namespace jfw
      38             : {
      39             : 
      40             : /** Returns the file URL of the directory where the framework library
      41             :     (this library) resides.
      42             : */
      43             : OUString getLibraryLocation();
      44             : 
      45             : /** provides a bootstrap class which already knows the values from the
      46             :     jvmfkwrc file.
      47             : */
      48             : struct Bootstrap :
      49             :     public ::rtl::StaticWithInit< const rtl::Bootstrap *, Bootstrap > {
      50       42505 :         const rtl::Bootstrap * operator () () {
      51       42505 :             OUStringBuffer buf(256);
      52       42505 :             buf.append(getLibraryLocation());
      53             : #if HAVE_FEATURE_MACOSX_MACLIKE_APP_STRUCTURE
      54             :             // For some reason the jvmfwk3rc file is traditionally in
      55             :             // "ure/lib", i.e.  in LIBO_URE_ETC_FOLDER
      56             :             buf.appendAscii( "/../" LIBO_URE_ETC_FOLDER );
      57             : #endif
      58       42505 :             buf.appendAscii(SAL_CONFIGFILE("/jvmfwk3"));
      59       85010 :             OUString sIni = buf.makeStringAndClear();
      60       42505 :             ::rtl::Bootstrap *  bootstrap = new ::rtl::Bootstrap(sIni);
      61             : #if OSL_DEBUG_LEVEL >=2
      62             :         OString o = OUStringToOString( sIni , osl_getThreadTextEncoding() );
      63             :         fprintf(stderr, "[Java framework] Using configuration file %s\n" , o.getStr() );
      64             : #endif
      65       85010 :         return bootstrap;
      66             :     }
      67             : };
      68             : 
      69             : struct FwkMutex: public ::rtl::Static<osl::Mutex, FwkMutex> {};
      70             : 
      71             : rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData);
      72             : rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data);
      73             : 
      74             : OUString getPlatform();
      75             : 
      76             : 
      77             : OUString getDirFromFile(const OUString& usFilePath);
      78             : 
      79             : /** Returns the file URL of the folder where the executable resides.
      80             :  */
      81             : OUString getExecutableDirectory();
      82             : /** Locates the plugin library and returns the file URL.
      83             : 
      84             :     First tries to locate plugin relative to baseUrl (if relative);
      85             :     vnd.sun.star.expand URLs are supported.  If that fails, tries to
      86             :     locate plugin relative to the executable.  If that fails, and plugin
      87             :     contains no slashes, tries to locate plugin in a platform-specific way
      88             :     (e.g., LD_LIBRARY_PATH).
      89             : 
      90             :     @param baseUrl
      91             :     The base file URL relative to which the plugin argument is interpreted.
      92             : 
      93             :     @param plugin
      94             :     The argument is an absolute or relative URL or just the name of the plugin.
      95             :  */
      96             : OUString findPlugin(
      97             :     const OUString & baseUrl, const OUString & plugin);
      98             : 
      99             : 
     100             : enum FileStatus
     101             : {
     102             :     FILE_OK,
     103             :     FILE_DOES_NOT_EXIST,
     104             :     FILE_INVALID
     105             : };
     106             : 
     107             : /** checks if the URL is a file.
     108             : 
     109             :     If it is a link to a file than
     110             :     it is resolved. Assuming that the argument
     111             :     represents a relative URL then FILE_INVALID
     112             :     is returned.
     113             : 
     114             : 
     115             :     @return
     116             :     one of the values of FileStatus.
     117             : 
     118             :     @exception
     119             :     Errors occurred during determining if the file exists
     120             :  */
     121             : FileStatus checkFileURL(const OUString & path);
     122             : 
     123             : bool isAccessibilitySupportDesired();
     124             : 
     125             : OUString buildClassPathFromDirectory(const OUString & relPath);
     126             : 
     127             : OUString retrieveClassPath( OUString const & macro );
     128             : }
     129             : #endif
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10