LCOV - code coverage report
Current view: top level - codemaker/source/commonjava - commonjava.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 62 0.0 %
Date: 2014-04-14 Functions: 0 2 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             : 
      21             : #include "sal/config.h"
      22             : 
      23             : #include "codemaker/commonjava.hxx"
      24             : 
      25             : #include "codemaker/options.hxx"
      26             : #include "codemaker/typemanager.hxx"
      27             : #include "codemaker/unotype.hxx"
      28             : 
      29             : #include "osl/diagnose.h"
      30             : #include "rtl/strbuf.h"
      31             : #include "rtl/string.h"
      32             : #include "rtl/string.hxx"
      33             : #include "rtl/ustring.hxx"
      34             : #include "sal/types.h"
      35             : 
      36             : #include <vector>
      37             : 
      38             : namespace codemaker { namespace java {
      39             : 
      40           0 : OString translateUnoToJavaType(
      41             :     codemaker::UnoType::Sort sort, OString const & nucleus, bool referenceType)
      42             : {
      43           0 :     OStringBuffer buf;
      44           0 :     if (sort <= codemaker::UnoType::SORT_ANY) {
      45             :         OString const javaTypes[codemaker::UnoType::SORT_ANY + 1][2] = {
      46             :             { "void", "java/lang/Void" },
      47             :             { "boolean", "java/lang/Boolean" },
      48             :             { "byte", "java/lang/Byte" },
      49             :             { "short", "java/lang/Short" },
      50             :             { "short", "java/lang/Short" },
      51             :             { "int",  "java/lang/Integer" },
      52             :             { "int",  "java/lang/Integer" },
      53             :             { "long", "java/lang/Long" },
      54             :             { "long", "java/lang/Long" },
      55             :             { "float", "java/lang/Float" },
      56             :             { "double", "java/lang/Double" },
      57             :             { "char", "java/lang/Character" },
      58             :             { "java/lang/String", "java/lang/String" },
      59             :             { "com/sun/star/uno/Type", "com/sun/star/uno/Type" },
      60           0 :             { "java/lang/Object", "java/lang/Object" } };
      61           0 :         buf.append(javaTypes[sort][referenceType]);
      62             :     } else {
      63           0 :         if (nucleus == "com/sun/star/uno/XInterface") {
      64           0 :             buf.append("java/lang/Object");
      65             :         } else {
      66             :             //TODO: check that nucleus is a valid (Java-modified UTF-8)
      67             :             // identifier
      68           0 :             buf.append(nucleus);
      69             :         }
      70             :     }
      71           0 :     return buf.makeStringAndClear();
      72             : }
      73             : 
      74           0 : OString translateUnoToJavaIdentifier(
      75             :     OString const & identifier, OString const & prefix)
      76             : {
      77           0 :     if (identifier == "abstract"
      78           0 :         || identifier == "assert" // since Java 1.4
      79           0 :         || identifier == "boolean"
      80           0 :         || identifier == "break"
      81           0 :         || identifier == "byte"
      82           0 :         || identifier == "case"
      83           0 :         || identifier == "catch"
      84           0 :         || identifier == "char"
      85           0 :         || identifier == "class"
      86           0 :         || identifier == "const"
      87           0 :         || identifier == "continue"
      88           0 :         || identifier == "default"
      89           0 :         || identifier == "do"
      90           0 :         || identifier == "double"
      91           0 :         || identifier == "else"
      92           0 :         || identifier == "enum" // probable addition in Java 1.5
      93           0 :         || identifier == "extends"
      94           0 :         || identifier == "final"
      95           0 :         || identifier == "finally"
      96           0 :         || identifier == "float"
      97           0 :         || identifier == "for"
      98           0 :         || identifier == "goto"
      99           0 :         || identifier == "if"
     100           0 :         || identifier == "implements"
     101           0 :         || identifier == "import"
     102           0 :         || identifier == "instanceof"
     103           0 :         || identifier == "int"
     104           0 :         || identifier == "interface"
     105           0 :         || identifier == "long"
     106           0 :         || identifier == "native"
     107           0 :         || identifier == "new"
     108           0 :         || identifier == "package"
     109           0 :         || identifier == "private"
     110           0 :         || identifier == "protected"
     111           0 :         || identifier == "public"
     112           0 :         || identifier == "return"
     113           0 :         || identifier == "short"
     114           0 :         || identifier == "static"
     115           0 :         || identifier == "strictfp"
     116           0 :         || identifier == "super"
     117           0 :         || identifier == "switch"
     118           0 :         || identifier == "synchronized"
     119           0 :         || identifier == "this"
     120           0 :         || identifier == "throw"
     121           0 :         || identifier == "throws"
     122           0 :         || identifier == "transient"
     123           0 :         || identifier == "try"
     124           0 :         || identifier == "void"
     125           0 :         || identifier == "volatile"
     126           0 :         || identifier == "while")
     127             :     {
     128           0 :         return prefix + "_" + identifier;
     129             :     } else {
     130           0 :         return identifier;
     131             :     }
     132             : }
     133             : 
     134             : } }
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10