示例#1
0
static bool CheckAPICompatibility ( const PluginAPIRef pluginAPIs )
{
	// Note: This is the place where we can reject old plugins.
	//       For example if we consider all functionality of
	//       plugin API version 2 mandatory we can reject
	//       plugin version 1 by returning false in case 1.
	switch ( pluginAPIs->mVersion )
	{
	case 1:
		return CheckAPICompatibility_V1 ( pluginAPIs );
		break;

	case 2:
		return CheckAPICompatibility_V2 ( pluginAPIs );
		break;

	case 3:
		return CheckAPICompatibility_V3 ( pluginAPIs );
		break;

	default:
		// The loaded plugin is newer than the host.
		// Only basic functionality to run the plugin is required.
		return CheckAPICompatibility_V1 ( pluginAPIs );
		break;
	}
}
示例#2
0
bool SetHostAPI( HostAPIRef hostAPI )
{
	bool valid = false;
	if( hostAPI && hostAPI->mVersion > 0 )
	{
		if ( hostAPI->mVersion <= 3 )
		{
			// Old host API before plugin versioning changes
			valid = CheckAPICompatibility_V1( hostAPI );
		}
		else
		{
			// New host API including RequestAPISuite.
			// This version of the HostAPI struct should not be changed.
			valid = CheckAPICompatibility_V4( hostAPI );
		}
	}
	
	if( valid )
	{
		sHostAPI = hostAPI;
		sHostAPIVersion = hostAPI->mVersion;
	}
	
	return valid;
}
示例#3
0
static bool CheckAPICompatibility_V2 ( const PluginAPIRef pluginAPIs )
{
	if ( CheckAPICompatibility_V1 ( pluginAPIs ) )
	{
		if ( pluginAPIs->mFillMetadataFilesProc 
			&& pluginAPIs->mFillAssociatedResourcesProc )
		{
			return true;
		}
	}
	return false;
}
示例#4
0
static bool CheckAPICompatibility_V4 ( const HostAPIRef hostAPI )
{
	return ( CheckAPICompatibility_V1( hostAPI )
			&& hostAPI->mRequestAPISuite != NULL );
}