Logo Search packages:      
Sourcecode: packagesearch version File versions

void PackageSearchImpl::removePlugin ( NPlugin::Plugin pPlugin  )  [virtual]

Finds every reference to plugin and remove it so that pPlugin can be safely deleted.

Parameters:
pPlugin the plugin to be removed

Implements NPlugin::IPluginUser.

Definition at line 257 of file packagesearchimpl.cpp.

References _informationPlugins, _plugins, _searchPlugins, _shortInformationColumn, _shortInformationPlugins, updateInformationPluginGui(), updateSearchPluginGui(), and updateShortInformationPluginGui().

{
      using namespace NPlugin;
      SearchPlugin* pSPlugin = dynamic_cast<SearchPlugin*>(pPlugin);
      if (pSPlugin)
      {
            SearchPluginContainer::iterator it = 
                  std::find(_searchPlugins.begin(), _searchPlugins.end(), pSPlugin);
            if (it != _searchPlugins.end())
            {
                  _searchPlugins.erase(it);
                  updateSearchPluginGui();
            }
      }
      InformationPlugin* pIPlugin = dynamic_cast<InformationPlugin*>(pPlugin);
      if (pIPlugin)
      {
            InformationPluginContainer::iterator it = 
                  std::find(_informationPlugins.begin(), _informationPlugins.end(), pIPlugin);
            if (it != _informationPlugins.end())
            {
                  _informationPlugins.erase(it);
                  updateInformationPluginGui();
            }
      }
      ShortInformationPlugin* pSIPlugin = dynamic_cast<ShortInformationPlugin*>(pPlugin);
      if (pSIPlugin)
      {
            ShortInformationPluginContainer::iterator it = 
                  std::find(_shortInformationPlugins.begin(), _shortInformationPlugins.end(), pSIPlugin);
            if (it != _shortInformationPlugins.end())
            {
                  _shortInformationPlugins.erase(it);
            }
            map<ShortInformationPlugin*, int>::iterator jt = _shortInformationColumn.find(pSIPlugin);
            // if the plugin was shown
            if (jt != _shortInformationColumn.end())
            {
                  _shortInformationColumn.erase(jt);
                  updateShortInformationPluginGui();
            }
      }
      PluginContainer::iterator it = 
            std::find(_plugins.begin(), _plugins.end(), pPlugin);
      if (it != _plugins.end())
      {
            _plugins.erase(it);
      }
}


Generated by  Doxygen 1.6.0   Back to index