libyui
3.0.5
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
Friends
YUIPlugin.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YUIPlugin.h
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
26
#ifndef YUIPlugin_h
27
#define YUIPlugin_h
28
29
#include <string>
30
31
32
/**
33
* Wrapper class for dlopen() and related.
34
**/
35
class
YUIPlugin
36
{
37
public
:
38
39
/**
40
* Constructor: Load the specified plugin library
41
* from the standard UI plugin directory (/usr/lib/yui/).
42
**/
43
YUIPlugin
(
const
char
*
pluginLibBaseName
);
44
45
/**
46
* Destructor.
47
*
48
* Please note that this will NOT attempt to unload the plugin library
49
* since this is usually counterproductive. If unloading the plugin is
50
* desired, call unload() manually.
51
**/
52
virtual
~YUIPlugin
();
53
54
/**
55
* Unload this plugin. This calls dlclose() which will unload the plugin
56
* library if it is no longer used, i.e. if the reference count dlopen()
57
* uses reaches 0.
58
**/
59
void
unload
();
60
61
/**
62
* Try to locate the specified symbol (function or global variable) in the
63
* plugin library.
64
*
65
* Returns the in-memory address of that symbol or 0 if it could not be
66
* found or if loading the plugin library had failed in the constructor.
67
**/
68
void
*
locateSymbol
(
const
char
* symbol );
69
70
/**
71
* Returns 'true' if there was an error loading the plugin.
72
**/
73
bool
error
()
const
;
74
75
/**
76
* Returns 'true' if there was no error loading the plugin.
77
**/
78
bool
success
()
const
;
79
80
/**
81
* Returns a human readable (but in most cases untranslated) error message
82
* if there was an error.
83
**/
84
std::string
errorMsg
()
const
;
85
86
protected
:
87
88
/**
89
* Returns the dlopen() handle of the plugin library.
90
**/
91
void
*
pluginLibHandle
() {
return
_pluginLibHandle; }
92
93
/**
94
* Returns the base name of the plugin library.
95
**/
96
std::string
pluginLibBaseName
()
const
{
return
_pluginLibBaseName; }
97
98
/**
99
* Returns the full path of the plugin library.
100
**/
101
std::string
pluginLibFullPath
()
const
;
102
103
private
:
104
105
std::string _pluginLibBaseName;
106
void
* _pluginLibHandle;
107
std::string _errorMsg;
108
};
109
110
111
#endif // YUIPlugin_h
src
YUIPlugin.h
Generated by
1.8.3.1