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 
23 using namespace com::sun::star::uno;
24 
25 namespace i18npool {
26 
27 #ifndef DISABLE_DYNLOADING
28 
29 extern "C" { static void thisModule() {} }
30 
31 #endif
32 
33 TextConversionService::TextConversionService(const char *pImplName)
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 
56 static void* nullFunc()
57 {
58  return nullptr;
59 }
60 
61 oslGenericFunction
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 
72 OUString SAL_CALL
74 {
75  return OUString::createFromAscii(implementationName);
76 }
77 
78 sal_Bool SAL_CALL
79 TextConversionService::supportsService(const OUString& rServiceName)
80 {
81  return cppu::supportsService(this, rServiceName);
82 }
83 
84 Sequence< OUString > SAL_CALL
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_DLLEXTENSION
std::unique_ptr< ContentProperties > pData
#define SAL_DLLPREFIX
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~TextConversionService() override
unsigned char sal_Bool
Constant values shared between i18npool and, for example, the number formatter.
oslGenericFunction getFunctionBySymbol(const char *func)
OUString SAL_CALL getImplementationName() override
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
#define implementationName
static void * nullFunc()
static void thisModule()