2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include "sal/config.h"
21 #include "com/sun/star/uno/Exception.hpp"
22 #include "com/sun/star/uno/Reference.hxx"
23 #include "com/sun/star/uno/Sequence.hxx"
24 #include "com/sun/star/uno/XComponentContext.hpp"
25 #include "com/sun/star/uno/XInterface.hpp"
26 #include "cppuhelper/factory.hxx"
27 #include "cppuhelper/implbase1.hxx"
28 #include "cppuhelper/implementationentry.hxx"
29 #include "cppuhelper/weak.hxx"
30 #include "rtl/ustring.h"
31 #include "rtl/ustring.hxx"
32 #include "sal/types.h"
33 #include "uno/environment.h"
35 #include "test/types/Data.hpp"
36 #include "test/types/XServer.hpp"
40 class Service
: public ::cppu::WeakImplHelper1
< ::test::types::XServer
> {
44 virtual ::test::types::Data SAL_CALL
getData() {
45 return ::test::types::Data(rtl::OUString("Hello"), 42);
49 Service(Service
&); // not defined
50 void operator =(Service
&); // not defined
57 css::uno::Reference
< css::uno::XInterface
> create(
58 css::uno::Reference
< css::uno::XComponentContext
> const &)
60 return static_cast< ::cppu::OWeakObject
* >(new Service
);
63 rtl::OUString
getImplementationName() {
64 return rtl::OUString("test.cpp.cppserver.Component");
67 css::uno::Sequence
< rtl::OUString
> getSupportedServiceNames() {
68 return css::uno::Sequence
< rtl::OUString
>();
73 ::cppu::ImplementationEntry entries
[] = {
74 { CppServer::create
, CppServer::getImplementationName
,
75 CppServer::getSupportedServiceNames
, ::cppu::createSingleComponentFactory
,
77 { 0, 0, 0, 0, 0, 0 } };
81 extern "C" SAL_DLLPUBLIC_EXPORT ::sal_Bool SAL_CALL
component_writeInfo(
82 void * serviceManager
, void * registryKey
)
84 return ::cppu::component_writeInfoHelper(
85 serviceManager
, registryKey
, entries
);
88 extern "C" SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory(
89 char const * implName
, void * serviceManager
, void * registryKey
)
91 return ::cppu::component_getFactoryHelper(
92 implName
, serviceManager
, registryKey
, entries
);