LibreOffice Module ure (master) 1
cpptest.cc
Go to the documentation of this file.
1/*
2 * This file is part of the LibreOffice project.
3 *
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/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
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 .
17 */
18
19#include "sal/config.h"
20
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"
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"
34
35#include "test/types/TestException.hpp"
36#include "test/types/XTest.hpp"
37
38namespace {
39
40class Service: public cppu::WeakImplHelper1< test::types::XTest > {
41public:
42 Service() {}
43
44 virtual void SAL_CALL throwException() {
46 rtl::OUString("test"),
47 static_cast< cppu::OWeakObject * >(this));
48 }
49
50private:
51 Service(Service &); // not defined
52 void operator =(Service &); // not defined
53
54 virtual ~Service() {}
55};
56
57namespace CppTest {
58
59css::uno::Reference< css::uno::XInterface > create(
60 css::uno::Reference< css::uno::XComponentContext > const &)
61{
62 return static_cast< cppu::OWeakObject * >(new Service);
63}
64
65rtl::OUString getImplementationName() {
66 return rtl::OUString("test.cpp.cpptest.Component");
67}
68
69css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
70 rtl::OUString s("test.types.CppTest");
71 return css::uno::Sequence< rtl::OUString >(&s, 1);
72}
73
74}
75
76cppu::ImplementationEntry entries[] = {
77 { CppTest::create, CppTest::getImplementationName,
78 CppTest::getSupportedServiceNames, cppu::createSingleComponentFactory, 0,
79 0 },
80 { 0, 0, 0, 0, 0, 0 } };
81
82}
83
84extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
85 char const * implName, void * serviceManager, void * registryKey)
86{
88 implName, serviceManager, registryKey, entries);
89}
OWeakObject &SAL_CALL operator=(const OWeakObject &)
SAL_DLLPUBLIC_EXPORT void *SAL_CALL component_getFactory(char const *implName, void *serviceManager, void *registryKey)
Definition: cpptest.cc:84
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
css::uno::Reference< css::uno::XInterface >(SAL_CALL *ComponentFactoryFunc)(css CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL createSingleComponentFactory(ComponentFactoryFunc fptr, ::rtl::OUString const &rImplementationName, css::uno::Sequence< ::rtl::OUString > const &rServiceNames, rtl_ModuleCount *pModCount=NULL)
void * component_getFactoryHelper(char const *pImplName, SAL_UNUSED_PARAMETER void *, SAL_UNUSED_PARAMETER void *, const struct ImplementationEntry entries[])
void SAL_CALL throwException(Any const &exc)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
const char * implName