LCOV - code coverage report
Current view: top level - package/source/manifest - ManifestWriter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 25 29 86.2 %
Date: 2015-06-13 12:38:46 Functions: 10 11 90.9 %
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 <ManifestWriter.hxx>
      21             : #include <ManifestExport.hxx>
      22             : #include <comphelper/processfactory.hxx>
      23             : #include <cppuhelper/factory.hxx>
      24             : #include <cppuhelper/supportsservice.hxx>
      25             : #include <com/sun/star/io/XActiveDataSource.hpp>
      26             : #include <com/sun/star/xml/sax/Writer.hpp>
      27             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      28             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      29             : #include <com/sun/star/xml/sax/SAXException.hpp>
      30             : 
      31             : #include <osl/diagnose.hxx>
      32             : 
      33             : using namespace ::com::sun::star;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::beans;
      36             : using namespace ::com::sun::star::io;
      37             : using namespace ::com::sun::star::lang;
      38             : using namespace ::com::sun::star::registry;
      39             : using namespace ::com::sun::star::packages;
      40             : using namespace ::com::sun::star::xml::sax;
      41             : 
      42             : #if OSL_DEBUG_LEVEL > 0
      43             : #define THROW_WHERE SAL_WHERE
      44             : #else
      45             : #define THROW_WHERE ""
      46             : #endif
      47             : 
      48         270 : ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext )
      49         270 : : m_xContext ( xContext )
      50             : {
      51         270 : }
      52         540 : ManifestWriter::~ManifestWriter()
      53             : {
      54         540 : }
      55             : 
      56             : // XManifestWriter methods
      57         269 : void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence )
      58             :         throw (RuntimeException, std::exception)
      59             : {
      60         269 :     Reference < XWriter > xSource = Writer::create( m_xContext );
      61         269 :     xSource->setOutputStream ( rStream );
      62             :     try {
      63         269 :         ManifestExport( xSource, rSequence);
      64             :     }
      65           0 :     catch( SAXException& )
      66             :     {
      67           0 :         throw RuntimeException( THROW_WHERE );
      68         269 :     }
      69         269 : }
      70             : 
      71             : // Component methods
      72         270 : Reference < XInterface > SAL_CALL ManifestWriter_createInstance( Reference< XMultiServiceFactory > const & rServiceFactory )
      73             : {
      74         270 :     return *new ManifestWriter( comphelper::getComponentContext(rServiceFactory) );
      75             : }
      76             : 
      77         297 : OUString ManifestWriter::static_getImplementationName()
      78             : {
      79         297 :     return OUString ( "com.sun.star.packages.manifest.comp.ManifestWriter" );
      80             : }
      81             : 
      82          31 : Sequence < OUString > ManifestWriter::static_getSupportedServiceNames()
      83             : {
      84          31 :     Sequence < OUString > aNames(1);
      85          31 :     aNames[0] = "com.sun.star.packages.manifest.ManifestWriter";
      86          31 :     return aNames;
      87             : }
      88             : 
      89           1 : OUString ManifestWriter::getImplementationName()
      90             :     throw (RuntimeException, std::exception)
      91             : {
      92           1 :     return static_getImplementationName();
      93             : }
      94             : 
      95           0 : sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName)
      96             :     throw (RuntimeException, std::exception)
      97             : {
      98           0 :     return cppu::supportsService(this, rServiceName);
      99             : }
     100           1 : Sequence < OUString > ManifestWriter::getSupportedServiceNames()
     101             :     throw (RuntimeException, std::exception)
     102             : {
     103           1 :     return static_getSupportedServiceNames();
     104             : }
     105          30 : Reference < XSingleServiceFactory > ManifestWriter::createServiceFactory( Reference < XMultiServiceFactory > const & rServiceFactory )
     106             : {
     107             :     return cppu::createSingleFactory (rServiceFactory,
     108             :                                            static_getImplementationName(),
     109             :                                            ManifestWriter_createInstance,
     110          30 :                                            static_getSupportedServiceNames());
     111             : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11