Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / i18npool / source / textconversion / textconversion.cxx
blob149aaf3b1b4a5ebc87d5a4449b9acb444cd247ca
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 <assert.h>
21 #include <cppuhelper/supportsservice.hxx>
22 #include <textconversion.hxx>
24 using namespace com::sun::star::uno;
26 namespace i18npool {
28 #ifndef DISABLE_DYNLOADING
30 extern "C" { static void thisModule() {} }
32 #endif
34 TextConversionService::TextConversionService(const char *pImplName)
35 : implementationName(pImplName)
37 #ifndef DISABLE_DYNLOADING
38 #ifdef SAL_DLLPREFIX
39 OUString lib(SAL_DLLPREFIX"textconv_dict" SAL_DLLEXTENSION);
40 #else
41 OUString lib("textconv_dict" SAL_DLLEXTENSION);
42 #endif
43 hModule = osl_loadModuleRelative(
44 &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
45 #endif
48 TextConversionService::~TextConversionService()
50 #ifndef DISABLE_DYNLOADING
51 if (hModule) osl_unloadModule(hModule);
52 #endif
55 #ifndef DISABLE_DYNLOADING
57 static void* nullFunc()
59 return nullptr;
62 oslGenericFunction
63 TextConversionService::getFunctionBySymbol(const sal_Char* func)
65 if (hModule)
66 return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData);
67 else
68 return reinterpret_cast< oslGenericFunction >(nullFunc);
71 #endif
73 OUString SAL_CALL
74 TextConversionService::getImplementationName()
76 return OUString::createFromAscii(implementationName);
79 sal_Bool SAL_CALL
80 TextConversionService::supportsService(const OUString& rServiceName)
82 return cppu::supportsService(this, rServiceName);
85 Sequence< OUString > SAL_CALL
86 TextConversionService::getSupportedServiceNames()
88 Sequence< OUString > aRet { OUString::createFromAscii(implementationName) };
89 return aRet;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */