blob: 198bde4b6c3f2ba16a72325ff600e8cfd0f1d122 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
* Copyright (C) 2006
* Siraj Razick <[email protected]>
* PhobosK <[email protected]>
* see Also AUTHORS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kbfxplugin.h"
KbfxPlugin::KbfxPlugin ( TQString name,TQString lib,uint id )
{
m_name = name;
m_libName = lib;
m_id = id;
m_loaded = false;
}
KbfxPlugin::KbfxPlugin()
{
}
KbfxPlugin::~KbfxPlugin()
{
// delete [] m_name;
// delete [] m_libName;
}
TQString
KbfxPlugin::name()
{
return m_name;
}
TQString
KbfxPlugin::libName()
{
return m_libName;
}
uint
KbfxPlugin::id()
{
return m_id;
}
bool
KbfxPlugin::status()
{
return m_loaded;
}
KbfxDataStack *
KbfxPlugin::data()
{
typedef KbfxDataStack * ( *KbfxPluginView ) ();
KbfxDataStack * m_stack =0;
KbfxPluginView m_hook;
TQLibrary * m_plugin = new TQLibrary ( m_libName );
if ( m_plugin == NULL )
return new KbfxDataStack();
m_hook = ( KbfxPluginView ) m_plugin->resolve ( "view" );
m_stack = m_hook();
m_plugin->unload();
delete m_plugin;
if ( m_stack != NULL )
return m_stack;
else
return new KbfxDataStack();
}
KbfxDataGroup *
KbfxPlugin::search ( TQString keyword )
{
if ( keyword == 0 )
return NULL;//new KbfxDataGroup();
if ( keyword.isNull() )
return NULL;//KbfxDataGroup();
typedef KbfxDataGroup * ( *KbfxPluginSearch ) ( TQString key );
KbfxDataGroup * m_group =0;
KbfxPluginSearch m_hook;
TQLibrary * m_plugin = new TQLibrary ( m_libName );
m_hook = ( KbfxPluginSearch ) m_plugin->resolve ( "search" );
m_group = m_hook ( keyword );
m_plugin->unload();
delete m_plugin;
if ( m_group != NULL )
{
// qDebug("KbfxPlugin():search():103:return Valid Group "+m_group->name());
return m_group;
}
else return NULL;
}
#include "kbfxplugin.moc"
|