LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/jvmfwk/plugins/sunmajor/pluginlib - vendorlist.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 16 93.8 %
Date: 2013-07-09 Functions: 2 2 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             : 
      20             : 
      21             : #include "vendorlist.hxx"
      22             : #include "gnujre.hxx"
      23             : #include "sunjre.hxx"
      24             : #include "otherjre.hxx"
      25             : #include "osl/thread.h"
      26             : #include <stdio.h>
      27             : 
      28             : using namespace com::sun::star::uno;
      29             : 
      30             : 
      31             : namespace jfw_plugin
      32             : {
      33             : 
      34             : /* Note: The vendor strings must be UTF-8. For example, if
      35             :    the string contains an a umlaut then it must be expressed
      36             :    by "\xXX\xXX"
      37             :  */
      38             : BEGIN_VENDOR_MAP()
      39             :     VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo)
      40             :     VENDOR_MAP_ENTRY("Oracle Corporation", SunInfo)
      41             :     VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo)
      42             :     VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo)
      43             :     VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo)
      44             :     VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo)
      45             :     VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo)
      46             :     VENDOR_MAP_ENTRY("Free Software Foundation, Inc.", GnuInfo)
      47             :     VENDOR_MAP_ENTRY("The FreeBSD Foundation", OtherInfo)
      48             : END_VENDOR_MAP()
      49             : 
      50             : 
      51           2 : Sequence<OUString> getVendorNames()
      52             : {
      53           2 :     const size_t count = sizeof(gVendorMap) / sizeof (VendorSupportMapEntry) - 1;
      54          20 :     OUString arNames[count];
      55          20 :     for ( size_t pos = 0; pos < count; ++pos )
      56             :     {
      57          18 :         OString sVendor(gVendorMap[pos].sVendorName);
      58          18 :         arNames[pos] = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8);
      59          18 :     }
      60          20 :     return Sequence<OUString>(arNames, count);
      61             : }
      62             : 
      63           2 : bool isVendorSupported(const OUString& sVendor)
      64             : {
      65           2 :     Sequence<OUString> seqNames = getVendorNames();
      66           2 :     const OUString * arNames = seqNames.getConstArray();
      67           2 :     sal_Int32 count = seqNames.getLength();
      68             : 
      69           4 :     for (int i = 0; i < count; i++)
      70             :     {
      71           4 :         if (sVendor.equals(arNames[i]))
      72           2 :             return true;
      73             :     }
      74             : #if OSL_DEBUG_LEVEL >= 2
      75             :     OString sVendorName = OUStringToOString(sVendor, osl_getThreadTextEncoding());
      76             :     fprintf(stderr, "[Java frameworksunjavaplugin.so]sunjavaplugin does not support vendor: %s.\n",
      77             :             sVendorName.getStr());
      78             : #endif
      79           0 :     return false;
      80             : }
      81             : 
      82             : }
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10