本文整理汇总了C++中PluginInfo::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::get方法的具体用法?C++ PluginInfo::get怎么用?C++ PluginInfo::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInfo
的用法示例。
在下文中一共展示了PluginInfo::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loaded
bool PluginFactory::loaded( const PluginInfoPair& pair )
{
PluginInfo *pluginInfo = pair.first;
if( !pluginInfo ) return false;
return pluginInfo->get();
}
示例2: destroyPlugin
void PluginFactory::destroyPlugin( const PluginInfoPair& pair )
{
PluginInfo *pluginInfo = pair.first;
Plugin *plugin = pluginInfo->get();
if( !plugin ) return;
PTRACE( 6, "Exiting plugin... " << pluginInfo->name );
plugin->exit();
//remove plugin from the lists
Plugin::Type type = pluginInfo->type;
PluginList& list = pluginMap[ type ];
list.removeRef( plugin );
idMap.remove(pluginInfo->id);
PTRACE( 6, "Destroying plugin" );
delete plugin;
}
示例3: dir
PluginInfoList& PluginFactory::rescan()
{
//remove plugins that are not loaded
PluginInfoList::Iterator it = infoList.begin();
while( it != infoList.end() ) {
PluginInfo *info = (*it).first;
if( !info ) continue;
//plugin is not loaded
if( !info->get() ) {
QLibrary *lib = (*it).second;
lib->unload();
delete lib;
it = infoList.remove(it);
continue;
}
++it;
}
//load all plugins (and avoid collisions)
QRegExp libRxp = QRegExp( "^lib.*\\.so[0-9.]*$" );
//QRegExp libRxp = QRegExp( "^lib.*" );
PluginInfoList pluginList;
QStringList libraryPaths = ancaConf->readListEntry( LIBRARY_PATHS, LIBRARY_PATHS_DEFAULT );
#ifdef PREL
libraryPaths.append( PREL "/share/anca/plugins");
#endif
libraryPaths.append(QDir::homeDirPath() + "/.anca/plugins");
//iterate all paths where plugins should be
for ( QStringList::iterator it = libraryPaths.begin(); it != libraryPaths.end(); ++it ) {
PTRACE( 3, "Searching directory " << ( *it ).latin1() << " for plugins" );
QDir dir( *it );
if ( !dir.exists() ) continue;
dir.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *fileList = dir.entryInfoList();
QFileInfo *file;
QLibrary *lib;
//iterate all files in the directory
for ( QFileInfoListIterator fit( *fileList ); ( file = *fit ); ++fit ) {
//is the file plugin?
if ( !file->fileName().contains( libRxp ) ) continue;
//open plugin
lib = new QLibrary( file->filePath().latin1() );
if( !lib->load() ) {
PTRACE( 3, "Library " << file->fileName().latin1() << " could not be loaded" );
continue;
}
//resolve symbol 'getPluginInfo'
if ( GetPluginInfo * getPluginInfo = ( GetPluginInfo* ) lib->resolve( "getPluginInfo" ) ) {
PluginInfo * pluginInfo = getPluginInfo();
pluginList.append( PluginInfoPair(pluginInfo, lib) );
} else {
PTRACE( 3, "Symbol \"getPluginInfo\" not found in library " << file->fileName().latin1() );
delete lib;
}
}
}
//insert that pluginInfo to class infoList that in not already there
for( PluginInfoList::iterator it = pluginList.begin(); it != pluginList.end(); ++it ) {
QLibrary *lib = (*it).second;
if( !lib ) continue;
if( !infoList.contains( *it ) )
infoList.append( *it );
else {
lib->unload();
delete lib;
}
}
// sort plugins according to type
qHeapSort(infoList);
return infoList;
}