My Project
UDK 3.2.7 C/C++ API Reference
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
osl
module.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*************************************************************************
3
*
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* Copyright 2000, 2010 Oracle and/or its affiliates.
7
*
8
* OpenOffice.org - a multi-platform office productivity suite
9
*
10
* This file is part of OpenOffice.org.
11
*
12
* OpenOffice.org is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU Lesser General Public License version 3
14
* only, as published by the Free Software Foundation.
15
*
16
* OpenOffice.org is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Lesser General Public License version 3 for more details
20
* (a copy is included in the LICENSE file that accompanied this code).
21
*
22
* You should have received a copy of the GNU Lesser General Public License
23
* version 3 along with OpenOffice.org. If not, see
24
* <http://www.openoffice.org/license.html>
25
* for a copy of the LGPLv3 License.
26
*
27
************************************************************************/
28
29
#ifndef _OSL_MODULE_HXX_
30
#define _OSL_MODULE_HXX_
31
32
#include <
rtl/ustring.hxx
>
33
#include <
osl/module.h
>
34
35
namespace
osl
36
{
37
38
class
Module
39
{
40
Module
(
const
Module
&);
41
Module
& operator = (
const
Module
&);
42
43
public
:
44
static
sal_Bool
getUrlFromAddress
(
void
* addr, ::
rtl::OUString
& libraryUrl) {
45
return
osl_getModuleURLFromAddress
(addr, &libraryUrl.pData);
46
}
47
69
static
sal_Bool
getUrlFromAddress
(
oslGenericFunction
addr, ::
rtl::OUString
& libraryUrl){
70
return
osl_getModuleURLFromFunctionAddress
( addr, &libraryUrl.pData );
71
}
72
73
Module
(): m_Module(0){}
74
75
Module
( const ::rtl::OUString& strModuleName, sal_Int32 nRtldMode =
SAL_LOADMODULE_DEFAULT
) : m_Module(0)
76
{
77
load
( strModuleName, nRtldMode);
78
}
79
80
~Module
()
81
{
82
osl_unloadModule
(m_Module);
83
}
84
85
sal_Bool
SAL_CALL
load
( const ::rtl::OUString& strModuleName,
86
sal_Int32 nRtldMode =
SAL_LOADMODULE_DEFAULT
)
87
{
88
unload
();
89
m_Module=
osl_loadModule
( strModuleName.pData, nRtldMode );
90
return
is
();
91
}
92
94
sal_Bool
SAL_CALL
loadRelative
(
95
::
oslGenericFunction
baseModule, ::
rtl::OUString
const
& relativePath,
96
::sal_Int32 mode =
SAL_LOADMODULE_DEFAULT
)
97
{
98
unload
();
99
m_Module =
osl_loadModuleRelative
(baseModule, relativePath.pData, mode);
100
return
is
();
101
}
102
104
sal_Bool
SAL_CALL
loadRelative
(
105
oslGenericFunction
baseModule,
char
const
* relativePath,
106
sal_Int32 mode =
SAL_LOADMODULE_DEFAULT
)
107
{
108
unload
();
109
m_Module =
osl_loadModuleRelativeAscii
(baseModule, relativePath, mode);
110
return
is
();
111
}
112
113
void
SAL_CALL
unload
()
114
{
115
if
(m_Module)
116
{
117
osl_unloadModule
(m_Module);
118
m_Module = 0;
119
}
120
}
121
122
sal_Bool
SAL_CALL
is
()
const
123
{
124
return
m_Module != NULL;
125
}
126
127
void
* SAL_CALL
getSymbol
( const ::rtl::OUString& strSymbolName)
128
{
129
return
(
osl_getSymbol
( m_Module, strSymbolName.pData ) );
130
}
131
150
oslGenericFunction
SAL_CALL
getFunctionSymbol
( const ::rtl::OUString& ustrFunctionSymbolName )
const
151
{
152
return
(
osl_getFunctionSymbol
( m_Module, ustrFunctionSymbolName.pData ) );
153
}
154
156
oslGenericFunction
SAL_CALL
getFunctionSymbol
(
char
const
* name)
const
{
157
return
osl_getAsciiFunctionSymbol
(m_Module, name);
158
}
159
160
operator
oslModule
()
const
161
{
162
return
m_Module;
163
}
164
165
private
:
166
oslModule
m_Module;
167
168
};
169
170
}
171
172
#endif
173
174
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Generated on Mon Oct 8 2012 00:36:41 for My Project by
1.8.1.2