Esempio n. 1
0
/**
 * get the plugin by id.  vermaj and vermin can be specified.  if they are not it will
 * pick the highest found version.
 */
OfxhPlugin* OfxhPluginCache::getPluginById( const std::string& id, int vermaj, int vermin )
{
	if( vermaj == -1 &&  vermin == -1 )
		return _pluginsByID[id];

	// return the highest version one, which fits the pattern provided
	OfxhPlugin* sofar = 0;

	for( std::list<OfxhPlugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i )
	{
		OfxhPlugin* p = *i;

		if( p->getIdentifier() != id )
		{
			continue;
		}

		if( vermaj != -1 && p->getVersionMajor() != vermaj )
		{
			continue;
		}

		if( vermin != -1 && p->getVersionMinor() != vermin )
		{
			continue;
		}

		if( !sofar || p->trumps( *sofar ) )
		{
			sofar = p;
		}
	}
	return sofar;
}