LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/jvmaccess - classpath.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 1 0.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             : 
      20             : #ifndef INCLUDED_JVMACCESS_CLASSPATH_HXX
      21             : #define INCLUDED_JVMACCESS_CLASSPATH_HXX
      22             : 
      23             : #include "jvmaccessdllapi.h"
      24             : #include "sal/config.h"
      25             : #include "com/sun/star/uno/Reference.hxx"
      26             : 
      27             : #if defined SOLAR_JAVA
      28             : #include "jni.h"
      29             : #else
      30             : struct JNIEnv;
      31             : typedef void * jclass;
      32             : typedef void * jobjectArray;
      33             : #endif
      34             : 
      35             : namespace com { namespace sun { namespace star { namespace uno {
      36             :     class XComponentContext;
      37             : } } } }
      38             : namespace rtl { class OUString; }
      39             : 
      40             : namespace jvmaccess {
      41             : 
      42             : /**
      43             :    Helper functions for class path handling.
      44             : */
      45             : class JVMACCESS_DLLPUBLIC ClassPath {
      46             : public:
      47             :     /**
      48             :        translates a class path into a java.net.URL[] instance.
      49             : 
      50             :        @param context
      51             :        a component context; must not be null.
      52             : 
      53             :        @param environment
      54             :        a JNI environment; must not be null.
      55             : 
      56             :        @param classPath
      57             :        a list of zero or more internal (see the
      58             :        com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
      59             :        where any space characters (U+0020) are ignored (and, in particular,
      60             :        separate adjacent URI references).  Any vnd.sun.star.expand URL
      61             :        references in the list are expanded using the
      62             :        com.sun.star.util.theMacroExpander singleton of the given context.
      63             : 
      64             :        @returns
      65             :        a local reference to a java.net.URL[] instance containing the external
      66             :        (see the com.sun.star.uri.ExternalUriReferenceTranslator service)
      67             :        equivalents of all the URI references in the given classPath.  If null, a
      68             :        (still pending) JNI exception occurred.
      69             : 
      70             :        @throws com::sun::star::uno::RuntimeException
      71             :     */
      72             :     static inline ::jobjectArray
      73           0 :     translateToUrls(
      74             :         ::com::sun::star::uno::Reference<
      75             :         ::com::sun::star::uno::XComponentContext > const & context,
      76             :         ::JNIEnv * environment, ::rtl::OUString const & classPath)
      77             :     {
      78             :         return
      79             :             static_cast< ::jobjectArray >(
      80           0 :                 doTranslateToUrls(context, environment, classPath));
      81             :     }
      82             : 
      83             :     /**
      84             :        loads a class via a java.net.URLClassLoader.
      85             : 
      86             :        @param context
      87             :        a component context; must not be null.
      88             : 
      89             :        @param environment
      90             :        a JNI environment; must not be null.
      91             : 
      92             :        @param classPath
      93             :        a list of zero or more internal (see the
      94             :        com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
      95             :        where any space characters (U+0020) are ignored (and, in particular,
      96             :        separate adjacent URI references).  Any vnd.sun.star.expand URL
      97             :        references in the list are expanded using the
      98             :        com.sun.star.util.theMacroExpander singleton of the given context.
      99             : 
     100             :        @param name
     101             :        the Java binary name of the class to load.
     102             : 
     103             :        @returns
     104             :        a local reference to a java.lang.Class instance.  If null, a (still
     105             :        pending) JNI exception occurred.
     106             : 
     107             :        @throws com::sun::star::uno::RuntimeException
     108             :     */
     109             :     static inline ::jclass loadClass(
     110             :         ::com::sun::star::uno::Reference<
     111             :         ::com::sun::star::uno::XComponentContext > const & context,
     112             :         ::JNIEnv * environment, ::rtl::OUString const & classPath,
     113             :         ::rtl::OUString const & name)
     114             :     {
     115             :         return
     116             :             static_cast< ::jclass >(
     117             :                 doLoadClass(context, environment, classPath, name));
     118             :     }
     119             : 
     120             : private:
     121             :     ClassPath(); // not defined
     122             :     ClassPath(ClassPath &); // not defined
     123             :     ~ClassPath(); // not defined
     124             :     void operator =(ClassPath &); // not defined
     125             : 
     126             :     // Functions that replace JNIEnv, jobjectArray, and jclass with void *, so
     127             :     // that their mangled C++ names do not depend on the JDK version used at
     128             :     // compile time:
     129             : 
     130             :     static void * doTranslateToUrls(
     131             :         ::com::sun::star::uno::Reference<
     132             :         ::com::sun::star::uno::XComponentContext > const & context,
     133             :         void * environment, ::rtl::OUString const & classPath);
     134             : 
     135             :     static void * doLoadClass(
     136             :         ::com::sun::star::uno::Reference<
     137             :         ::com::sun::star::uno::XComponentContext > const & context,
     138             :         void * environment, ::rtl::OUString const & classPath,
     139             :         ::rtl::OUString const & name);
     140             : };
     141             : 
     142             : }
     143             : 
     144             : #endif
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10