LCOV - code coverage report
Current view: top level - xmlsecurity/source/xmlsec - serialnumberadapter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 20 70.0 %
Date: 2015-06-13 12:38:46 Functions: 8 11 72.7 %
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 <boost/noncopyable.hpp>
      23             : #include <com/sun/star/lang/XServiceInfo.hpp>
      24             : #include <com/sun/star/security/XSerialNumberAdapter.hpp>
      25             : #include <com/sun/star/uno/Reference.hxx>
      26             : #include <com/sun/star/uno/RuntimeException.hpp>
      27             : #include <com/sun/star/uno/Sequence.hxx>
      28             : #include <com/sun/star/uno/XComponentContext.hpp>
      29             : #include <com/sun/star/uno/XInterface.hpp>
      30             : #include <cppuhelper/implbase2.hxx>
      31             : #include <cppuhelper/supportsservice.hxx>
      32             : #include <cppuhelper/weak.hxx>
      33             : #include <rtl/ustring.hxx>
      34             : #include <sal/types.h>
      35             : #include "xmlsecurity/biginteger.hxx"
      36             : 
      37             : #include "serialnumberadapter.hxx"
      38             : 
      39             : namespace {
      40             : 
      41             : class Service:
      42             :     public cppu::WeakImplHelper2<
      43             :         css::lang::XServiceInfo, css::security::XSerialNumberAdapter >,
      44             :     private boost::noncopyable
      45             : {
      46             : public:
      47           1 :     Service() {}
      48             : 
      49             : private:
      50           2 :     virtual ~Service() {}
      51             : 
      52           1 :     virtual OUString SAL_CALL getImplementationName()
      53             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      54           1 :     { return xml_security::serial_number_adapter::implementationName(); }
      55             : 
      56           0 :     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
      57             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      58           0 :     { return cppu::supportsService(this, ServiceName); }
      59             : 
      60           1 :     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
      61             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      62           1 :     { return xml_security::serial_number_adapter::serviceNames(); }
      63             : 
      64           0 :     virtual OUString SAL_CALL toString(
      65             :         css::uno::Sequence< sal_Int8 > const & SerialNumber)
      66             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      67           0 :     { return bigIntegerToNumericString(SerialNumber); }
      68             : 
      69           0 :     virtual css::uno::Sequence< sal_Int8 > SAL_CALL toSequence(
      70             :         OUString const & SerialNumber)
      71             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      72           0 :     { return numericStringToBigInteger(SerialNumber); }
      73             : };
      74             : 
      75             : }
      76             : 
      77             : css::uno::Reference< css::uno::XInterface >
      78           1 : xml_security::serial_number_adapter::create(
      79             :     css::uno::Reference< css::uno::XComponentContext > const &)
      80             : {
      81           1 :     return static_cast< cppu::OWeakObject * >(new Service);
      82             : }
      83             : 
      84          10 : OUString xml_security::serial_number_adapter::implementationName()
      85             :     throw (css::uno::RuntimeException)
      86             : {
      87          10 :     return OUString("com.sun.star.comp.security.SerialNumberAdapter");
      88             : }
      89             : 
      90             : css::uno::Sequence< OUString >
      91           2 : xml_security::serial_number_adapter::serviceNames()
      92             :     throw (css::uno::RuntimeException)
      93             : {
      94           2 :     css::uno::Sequence< OUString > s(1);
      95           2 :     s[0] = "com.sun.star.security.SerialNumberAdapter";
      96           2 :     return s;
      97             : }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11