LibreOffice Module i18npool (master) 1
textconversion.cxx
Go to the documentation of this file.
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
21#include <textconversion.hxx>
22
23using namespace com::sun::star::uno;
24
25namespace i18npool {
26
27#ifndef DISABLE_DYNLOADING
28
29extern "C" { static void thisModule() {} }
30
31#endif
32
34 : implementationName(pImplName)
35{
36#ifndef DISABLE_DYNLOADING
37#ifdef SAL_DLLPREFIX
38 OUString lib(SAL_DLLPREFIX"textconv_dict" SAL_DLLEXTENSION);
39#else
40 OUString lib("textconv_dict" SAL_DLLEXTENSION);
41#endif
42 hModule = osl_loadModuleRelative(
43 &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
44#endif
45}
46
48{
49#ifndef DISABLE_DYNLOADING
50 if (hModule) osl_unloadModule(hModule);
51#endif
52}
53
54#ifndef DISABLE_DYNLOADING
55
56static void* nullFunc()
57{
58 return nullptr;
59}
60
61oslGenericFunction
63{
64 if (hModule)
65 return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData);
66 else
67 return reinterpret_cast< oslGenericFunction >(nullFunc);
68}
69
70#endif
71
72OUString SAL_CALL
74{
75 return OUString::createFromAscii(implementationName);
76}
77
78sal_Bool SAL_CALL
79TextConversionService::supportsService(const OUString& rServiceName)
80{
81 return cppu::supportsService(this, rServiceName);
82}
83
86{
87 Sequence< OUString > aRet { OUString::createFromAscii(implementationName) };
88 return aRet;
89}
90
91}
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_DLLPREFIX
OUString SAL_CALL getImplementationName() override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~TextConversionService() override
oslGenericFunction getFunctionBySymbol(const char *func)
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
TextConversionService(const char *pImplName)
#define SAL_DLLEXTENSION
std::unique_ptr< sal_Int32[]> pData
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Constant values shared between i18npool and, for example, the number formatter.
constexpr OUStringLiteral implementationName
static void thisModule()
Definition: xdictionary.cxx:41
static void * nullFunc()
unsigned char sal_Bool