bump product version to 4.1.6.2
[LibreOffice.git] / xmlsecurity / source / xmlsec / serialnumberadapter.cxx
blobc441c48b44c67d735395f6a4bf3ea7b8975b2c17
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "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"
37 #include "serialnumberadapter.hxx"
39 namespace {
41 class Service:
42 public cppu::WeakImplHelper2<
43 css::lang::XServiceInfo, css::security::XSerialNumberAdapter >,
44 private boost::noncopyable
46 public:
47 Service() {}
49 private:
50 virtual ~Service() {}
52 virtual OUString SAL_CALL getImplementationName()
53 throw (css::uno::RuntimeException)
54 { return xml_security::serial_number_adapter::implementationName(); }
56 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
57 throw (css::uno::RuntimeException)
58 { return cppu::supportsService(this, ServiceName); }
60 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
61 throw (css::uno::RuntimeException)
62 { return xml_security::serial_number_adapter::serviceNames(); }
64 virtual OUString SAL_CALL toString(
65 css::uno::Sequence< sal_Int8 > const & SerialNumber)
66 throw (css::uno::RuntimeException)
67 { return bigIntegerToNumericString(SerialNumber); }
69 virtual css::uno::Sequence< sal_Int8 > SAL_CALL toSequence(
70 OUString const & SerialNumber)
71 throw (css::uno::RuntimeException)
72 { return numericStringToBigInteger(SerialNumber); }
77 css::uno::Reference< css::uno::XInterface >
78 xml_security::serial_number_adapter::create(
79 css::uno::Reference< css::uno::XComponentContext > const &)
81 return static_cast< cppu::OWeakObject * >(new Service);
84 OUString xml_security::serial_number_adapter::implementationName()
85 throw (css::uno::RuntimeException)
87 return OUString("com.sun.star.comp.security.SerialNumberAdapter");
90 css::uno::Sequence< OUString >
91 xml_security::serial_number_adapter::serviceNames()
92 throw (css::uno::RuntimeException)
94 css::uno::Sequence< OUString > s(1);
95 s[0] = "com.sun.star.security.SerialNumberAdapter";
96 return s;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */