LCOV - code coverage report
Current view: top level - codemaker/source/cppumaker - cppumaker.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 45 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : #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 "cppuoptions.hxx"
      37             : #include "cpputype.hxx"
      38             : 
      39           0 : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
      40           0 :     CppuOptions options;
      41             :     try {
      42           0 :         if (!options.initOptions(argc, argv)) {
      43           0 :             return EXIT_FAILURE;
      44             :         }
      45           0 :     } catch (IllegalArgument & e) {
      46           0 :         std::cerr << "Illegal option " << e.m_message << '\n';
      47           0 :         return EXIT_FAILURE;
      48             :     }
      49             :     try {
      50           0 :         rtl::Reference< TypeManager > typeMgr(new TypeManager);
      51           0 :         for (std::vector< OString >::const_iterator i(
      52           0 :                  options.getExtraInputFiles().begin());
      53           0 :              i != options.getExtraInputFiles().end(); ++i)
      54             :         {
      55           0 :             typeMgr->loadProvider(convertToFileUrl(*i), false);
      56             :         }
      57           0 :         for (std::vector< OString >::const_iterator i(
      58           0 :                  options.getInputFiles().begin());
      59           0 :              i != options.getInputFiles().end(); ++i)
      60             :         {
      61           0 :             typeMgr->loadProvider(convertToFileUrl(*i), true);
      62             :         }
      63           0 :         codemaker::GeneratedTypeSet generated;
      64           0 :         if (options.isValid("-T")) {
      65           0 :             OUString names(b2u(options.getOption("-T")));
      66           0 :             for (sal_Int32 i = 0; i != -1;) {
      67           0 :                 OUString name(names.getToken(0, ';', i));
      68           0 :                 if (!name.isEmpty()) {
      69             :                     produce(
      70           0 :                         (name == "*"
      71             :                          ? ""
      72           0 :                          : name.endsWith(".*")
      73           0 :                          ? name.copy(0, name.getLength() - std::strlen(".*"))
      74             :                          : name),
      75           0 :                         typeMgr, generated, options);
      76             :                 }
      77           0 :             }
      78             :         } else {
      79           0 :             produce("", typeMgr, generated, options);
      80             :         }
      81           0 :         if (!options.isValid("-nD")) {
      82             :             // C++ header files generated for the following UNO types are
      83             :             // included in header files in cppu/inc/com/sun/star/uno (Any.hxx,
      84             :             // Reference.hxx, Type.h), so it seems best to always generate those
      85             :             // C++ header files:
      86             :             produce(
      87             :                 "com.sun.star.uno.RuntimeException", typeMgr, generated,
      88           0 :                 options);
      89             :             produce(
      90           0 :                 "com.sun.star.uno.TypeClass", typeMgr, generated, options);
      91             :             produce(
      92           0 :                 "com.sun.star.uno.XInterface", typeMgr, generated, options);
      93           0 :         }
      94           0 :     } catch (CannotDumpException & e) {
      95           0 :         std::cerr << "ERROR: " << e.getMessage() << '\n';
      96           0 :         return EXIT_FAILURE;
      97           0 :     } catch (unoidl::NoSuchFileException & e) {
      98           0 :         std::cerr << "ERROR: No such file <" << e.getUri() << ">\n";
      99           0 :         return EXIT_FAILURE;
     100           0 :     } catch (unoidl::FileFormatException & e) {
     101             :         std::cerr
     102           0 :             << "ERROR: Bad format of <" << e.getUri() << ">, \""
     103           0 :             << e.getDetail() << "\"\n";
     104           0 :         return EXIT_FAILURE;
     105             :     }
     106           0 :     return EXIT_SUCCESS;
     107           0 : }
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10