Line data Source code
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 :
20 :
21 : #include <assert.h>
22 : #include <textconversion.hxx>
23 :
24 : using namespace com::sun::star::uno;
25 :
26 : using ::rtl::OUString;
27 :
28 : namespace com { namespace sun { namespace star { namespace i18n {
29 :
30 : #ifndef DISABLE_DYNLOADING
31 :
32 0 : extern "C" { static void SAL_CALL thisModule() {} }
33 :
34 : #endif
35 :
36 0 : TextConversion::TextConversion()
37 : {
38 : #ifndef DISABLE_DYNLOADING
39 : #ifdef SAL_DLLPREFIX
40 0 : OUString lib(SAL_DLLPREFIX"textconv_dict" SAL_DLLEXTENSION);
41 : #else
42 : OUString lib("textconv_dict" SAL_DLLEXTENSION);
43 : #endif
44 : hModule = osl_loadModuleRelative(
45 0 : &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
46 : #endif
47 0 : }
48 :
49 0 : TextConversion::~TextConversion()
50 : {
51 : #ifndef DISABLE_DYNLOADING
52 0 : if (hModule) osl_unloadModule(hModule);
53 : #endif
54 0 : }
55 :
56 : #ifndef DISABLE_DYNLOADING
57 :
58 0 : static void* nullFunc()
59 : {
60 0 : return NULL;
61 : }
62 :
63 : oslGenericFunction SAL_CALL
64 0 : TextConversion::getFunctionBySymbol(const sal_Char* func)
65 : {
66 0 : if (hModule)
67 0 : return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData);
68 : else
69 0 : return reinterpret_cast< oslGenericFunction >(nullFunc);
70 : }
71 :
72 : #endif
73 :
74 : OUString SAL_CALL
75 0 : TextConversion::getImplementationName() throw( RuntimeException )
76 : {
77 0 : return OUString::createFromAscii(implementationName);
78 : }
79 :
80 : sal_Bool SAL_CALL
81 0 : TextConversion::supportsService(const OUString& rServiceName) throw( RuntimeException )
82 : {
83 0 : return rServiceName.equalsAscii(implementationName);
84 : }
85 :
86 : Sequence< OUString > SAL_CALL
87 0 : TextConversion::getSupportedServiceNames() throw( RuntimeException )
88 : {
89 0 : Sequence< OUString > aRet(1);
90 0 : aRet[0] = OUString::createFromAscii(implementationName);
91 0 : return aRet;
92 : }
93 :
94 : } } } }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|