Bump version to 4.3-4
[LibreOffice.git] / i18npool / source / textconversion / textconversion.cxx
blobaec186e016cf9d8fa332af2af0062d29fe3bf83d
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 com { namespace sun { namespace star { namespace i18n {
28 #ifndef DISABLE_DYNLOADING
30 extern "C" { static void SAL_CALL thisModule() {} }
32 #endif
34 TextConversion::TextConversion(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 TextConversion::~TextConversion()
50 #ifndef DISABLE_DYNLOADING
51 if (hModule) osl_unloadModule(hModule);
52 #endif
55 #ifndef DISABLE_DYNLOADING
57 static void* nullFunc()
59 return NULL;
62 oslGenericFunction SAL_CALL
63 TextConversion::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 TextConversion::getImplementationName() throw( RuntimeException, std::exception )
76 return OUString::createFromAscii(implementationName);
79 sal_Bool SAL_CALL
80 TextConversion::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
82 return cppu::supportsService(this, rServiceName);
85 Sequence< OUString > SAL_CALL
86 TextConversion::getSupportedServiceNames() throw( RuntimeException, std::exception )
88 Sequence< OUString > aRet(1);
89 aRet[0] = OUString::createFromAscii(implementationName);
90 return aRet;
93 } } } }
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */