1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/security/XSerialNumberAdapter.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/RuntimeException.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/uno/XInterface.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <cppuhelper/supportsservice.hxx>
31 #include <cppuhelper/weak.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
34 #include <biginteger.hxx>
36 #include "serialnumberadapter.hxx"
41 public cppu::WeakImplHelper
<
42 css::lang::XServiceInfo
, css::security::XSerialNumberAdapter
>
46 Service(const Service
&) = delete;
47 Service
& operator=(const Service
&) = delete;
50 virtual ~Service() override
{}
52 virtual OUString SAL_CALL
getImplementationName() override
53 { return xml_security::serial_number_adapter::implementationName(); }
55 virtual sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
56 { return cppu::supportsService(this, ServiceName
); }
58 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
59 { return xml_security::serial_number_adapter::serviceNames(); }
61 virtual OUString SAL_CALL
toString(
62 css::uno::Sequence
< sal_Int8
> const & SerialNumber
) override
63 { return xmlsecurity::bigIntegerToNumericString(SerialNumber
); }
65 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
toSequence(
66 OUString
const & SerialNumber
) override
67 { return xmlsecurity::numericStringToBigInteger(SerialNumber
); }
72 css::uno::Reference
< css::uno::XInterface
>
73 xml_security::serial_number_adapter::create(
74 css::uno::Reference
< css::uno::XComponentContext
> const &)
76 return static_cast< cppu::OWeakObject
* >(new Service
);
79 OUString
xml_security::serial_number_adapter::implementationName()
81 return OUString("com.sun.star.comp.security.SerialNumberAdapter");
84 css::uno::Sequence
< OUString
>
85 xml_security::serial_number_adapter::serviceNames()
87 css::uno::Sequence
< OUString
> s
{ "com.sun.star.security.SerialNumberAdapter" };
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */