LCOV - code coverage report
Current view: top level - codemaker/source/javamaker - javamaker.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 41 43.9 %
Date: 2015-06-13 12:38:46 Functions: 4 4 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             : #include "sal/config.h"
      21             : 
      22             : #include <cstdlib>
      23             : #include <cstring>
      24             : #include <iostream>
      25             : #include <vector>
      26             : 
      27             : #include "codemaker/generatedtypeset.hxx"
      28             : #include "codemaker/typemanager.hxx"
      29             : #include "rtl/ref.hxx"
      30             : #include "rtl/string.hxx"
      31             : #include "rtl/ustring.hxx"
      32             : #include "sal/main.h"
      33             : #include "sal/types.h"
      34             : #include "unoidl/unoidl.hxx"
      35             : 
      36             : #include "javaoptions.hxx"
      37             : #include "javatype.hxx"
      38             : 
      39           8 : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
      40           4 :     JavaOptions options;
      41             :     try {
      42           4 :         if (!options.initOptions(argc, argv)) {
      43           0 :             return EXIT_FAILURE;
      44             :         }
      45             : 
      46           4 :         rtl::Reference< TypeManager > typeMgr(new TypeManager);
      47          21 :         for (std::vector< rtl::OString >::const_iterator i(
      48           4 :                  options.getExtraInputFiles().begin());
      49          14 :              i != options.getExtraInputFiles().end(); ++i)
      50             :         {
      51           3 :             typeMgr->loadProvider(convertToFileUrl(*i), false);
      52             :         }
      53          27 :         for (std::vector< rtl::OString >::const_iterator i(
      54           4 :                  options.getInputFiles().begin());
      55          18 :              i != options.getInputFiles().end(); ++i)
      56             :         {
      57           5 :             typeMgr->loadProvider(convertToFileUrl(*i), true);
      58             :         }
      59           8 :         codemaker::GeneratedTypeSet generated;
      60           4 :         if (options.isValid("-T")) {
      61           0 :             OUString names(b2u(options.getOption("-T")));
      62           0 :             for (sal_Int32 i = 0; i != -1;) {
      63           0 :                 OUString name(names.getToken(0, ';', i));
      64           0 :                 if (!name.isEmpty()) {
      65             :                     produce(
      66           0 :                         (name == "*"
      67             :                          ? ""
      68           0 :                          : name.endsWith(".*")
      69           0 :                          ? name.copy(0, name.getLength() - std::strlen(".*"))
      70             :                          : name),
      71           0 :                         typeMgr, generated, options);
      72             :                 }
      73           0 :             }
      74             :         } else {
      75           4 :             produce("", typeMgr, generated, options);
      76           4 :         }
      77             :     }
      78           0 :     catch (CannotDumpException & e) {
      79           0 :         std::cerr << "ERROR: " << e.getMessage() << '\n';
      80           0 :         return EXIT_FAILURE;
      81           0 :     } catch (unoidl::NoSuchFileException & e) {
      82           0 :         std::cerr << "ERROR: No such file <" << e.getUri() << ">\n";
      83           0 :         return EXIT_FAILURE;
      84           0 :     } catch (unoidl::FileFormatException & e) {
      85             :         std::cerr
      86           0 :             << "ERROR: Bad format of <" << e.getUri() << ">, \""
      87           0 :             << e.getDetail() << "\"\n";
      88           0 :         return EXIT_FAILURE;
      89           0 :     } catch (IllegalArgument & e) {
      90           0 :         std::cerr << "Illegal option " << e.m_message << '\n';
      91           0 :         return EXIT_FAILURE;
      92             :     }
      93           4 :     return EXIT_SUCCESS;
      94          12 : }
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11