本文整理汇总了C++中Plugin::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Plugin::getName方法的具体用法?C++ Plugin::getName怎么用?C++ Plugin::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPlugin
int PluginHost::addPlugin(const char *fname, int stackType, Channel *ch) {
Plugin *p = new Plugin();
bool success = true;
gVector <Plugin *> *pStack;
pStack = getStack(stackType, ch);
if (!p->load(fname)) {
//delete p;
//return 0;
success = false;
}
/* if the load failed we add a 'dead' plugin into the stack. This is
* useful to report a missing plugin. */
if (!success) {
pStack->add(p);
return 0;
}
/* otherwise let's try to initialize it. */
else {
/* try to init the plugin. If fails, delete it and return error. */
if (!p->init(&PluginHost::HostCallback)) {
delete p;
return 0;
}
/* plugin setup */
p->setup(G_Conf.samplerate, kernelAudio::realBufsize);
/* try to add the new plugin until succeed */
int lockStatus;
while (true) {
lockStatus = pthread_mutex_trylock(&G_Mixer.mutex_plugins);
if (lockStatus == 0) {
pStack->add(p);
pthread_mutex_unlock(&G_Mixer.mutex_plugins);
break;
}
}
char name[256]; p->getName(name);
gLog("[pluginHost] plugin id=%d loaded (%s), stack type=%d, stack size=%d\n", p->getId(), name, stackType, pStack->size);
/* p->resume() is suggested. Who knows... */
p->resume();
return 1;
}
}
示例2: exec
void LoadPluginCmd::exec()
{
if (mPluginPath.empty())
return ;
Plugin* plugin = PluginManager::getSingletonPtr()->getPluginByFileName(mPluginPath);
if (!plugin)
{
if (PluginManager::getSingletonPtr()->loadPlugin(mPluginPath))
{
Plugin* plugin = PluginManager::getSingletonPtr()->getPluginByFileName(mPluginPath);
System* system = SystemManager::getSingletonPtr()->getSystemByName(plugin->getSystemName());
system->shutdown();
if (!plugin->initialize())
{
LOGE("Couldn't initialise the plugin '" + plugin->getName() + "'");
CommandManager::getSingletonPtr()->setReturnMessage("Plugin \"" + mPluginPath + "\" failed : Couldn't initialise the plugin '" + plugin->getName() + "'");
return ;
}
system->init();
CommandManager::getSingletonPtr()->setReturnMessage("Plugin \"" + mPluginPath + "\" loaded");
}
else
CommandManager::getSingletonPtr()->setReturnMessage("Failed to load plugin \"" + mPluginPath + "\"");
}
else
{
std::string pluginName = plugin->getName();
System* system = SystemManager::getSingletonPtr()->getSystemByName(plugin->getSystemName());
std::string systemPluginName = system->getPluginName();
if (pluginName != systemPluginName)
{
system->shutdown();
if (!plugin->initialize())
{
LOGE("Couldn't initialise the plugin '" + plugin->getName() + "'");
CommandManager::getSingletonPtr()->setReturnMessage("Couldn't initialise the plugin '" + plugin->getName() + "'");
return ;
}
system->init();
CommandManager::getSingletonPtr()->setReturnMessage("Plugin \"" + mPluginPath + "\" loaded. System " + system->getName() + " initialized.");
}
else
CommandManager::getSingletonPtr()->setReturnMessage("Plugin \"" + mPluginPath + "\" already loaded.");
}
}
示例3: registerPlugin
void PluginManager::registerPlugin(Plugin* plugin)
{
// ensure that we haven't already loaded the plugin
for(vector<Plugin*>::iterator it = plugins.begin(); it != plugins.end(); ++it) {
Plugin *p = *it;
if ( ! strcmp(p->getName(), plugin->getName()) ) {
throw runtime_error( (string("Plugin with name '") + string(plugin->getName()) + string("' was loaded multiple times!")) );
}
}
plugins.push_back(plugin);
plugin->registerPlugin();
}
示例4: getPlugin
/**
* Returns a plugin registered in the system with a specific name. If there are several, the first will be returned.
* @param pluginName name of the plugin to be returned.
* @return pointer to the plugin if found, NULL if not found
*/
Cing::Plugin* Application::getPlugin( const std::string& pluginName )
{
// search for a plugin with the received name (and return the first found
for ( PluginList::iterator it = m_plugins.begin(); it != m_plugins.end(); ++it )
{
Plugin* plugin = *it;
if ( plugin && (plugin->getName() == pluginName) )
{
return plugin;
}
}
// not found
return NULL;
}
示例5: populate
void DlgPrefBeats::populate() {
VampAnalyser::initializePluginPaths();
m_listIdentifier.clear();
m_listName.clear();
m_listLibrary.clear();
disconnect(plugincombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(pluginSelected(int)));
plugincombo->clear();
plugincombo->setDuplicatesEnabled(false);
connect(plugincombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(pluginSelected(int)));
VampPluginLoader *loader = VampPluginLoader::getInstance();
std::vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
qDebug() << "VampPluginLoader::listPlugins() returned" << plugins.size() << "plugins";
for (unsigned int iplugin=0; iplugin < plugins.size(); iplugin++) {
// TODO(XXX): WTF, 48000
Plugin *plugin = loader->loadPlugin(plugins[iplugin], 48000);
//TODO: find a way to add beat trackers only
if (plugin) {
Plugin::OutputList outputs = plugin->getOutputDescriptors();
for (unsigned int ioutput=0; ioutput < outputs.size(); ioutput++) {
QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
+ QString::number(ioutput);
QString displaynametext = QString::fromStdString(plugin->getName());
qDebug() << "Plugin output displayname:" << displayname << displaynametext;
bool goodones = ((displayname.contains("mixxxbpmdetection")||
displayname.contains("qm-tempotracker:0"))||
displayname.contains("beatroot:0")||
displayname.contains("marsyas_ibt:0")||
displayname.contains("aubiotempo:0")
);
if (goodones) {
m_listName << displaynametext;
QString pluginlibrary = QString::fromStdString(plugins[iplugin]).section(":",0,0);
m_listLibrary << pluginlibrary;
QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
+ QString::number(ioutput);
m_listIdentifier << displayname;
plugincombo->addItem(displaynametext, displayname);
}
}
delete plugin;
plugin = 0;
}
}
}
示例6: loadPlugin
bool PluginManager::loadPlugin(QString file, bool silent) {
QLibrary* library = new QLibrary(file);
if(!library->load()) {
if(!silent) {
QMessageBox::critical (_gi, tr("Error loading plugin"), library->errorString());
}
return false;
}
std::cout << file.toStdString() << " loaded" << std::endl;
QFunctionPointer ptr = library->resolve("loadPlugin");
if(ptr == 0) {
if(!silent) {
QMessageBox::critical (_gi, tr("Error loading plugin"), tr("Could not find the plugin's entry point \"loadPlugin\""));
}
return false;
}
std::cout << file.toStdString() << ": entry point found" << std::endl;
typedef Plugin* (*entryPoint)();
entryPoint getPlugin = reinterpret_cast<entryPoint>(ptr);
Plugin* plugin = getPlugin();
if(plugin==NULL) {
if(!silent) {
QMessageBox::critical (_gi, tr("Error loading plugin"), tr("The getPlugin entry point does not return a valid Plugin"));
}
return false;
}
std::cout << file.toStdString() << ": got Plugin" << std::endl;
vector<GenericOperation*> operations = plugin->getOperations();
std::cout << "Plugin " << plugin->getName() << " loaded : " << operations.size() << " operations "<< std::endl;
//PluginService* pluginService = new PluginService(plugin);
_plugins.insert(pair<string,Plugin*>(file.toStdString(), plugin));
_libraries.insert(pair<Plugin*,QLibrary*>(plugin, library));
//_gi->addService(pluginService);
emit addPlugin(plugin);
return true;
}
示例7: loadPlugins
size_t PluginEngine::loadPlugins( const std::string & pluginFldr ) {
// 1. get all files in pluginFldr that conform to a platform-dependent
// naming convention.
// 2. For each one, try to open it and determine if it has the interface
// expected for this plugin engine
// 3. If it does, register it with the appropriate manager.
// (NOt entirely sure what this means yet...ultimately, the manager
// has to be able to provide information about the entity in the
// plug-in and provide the ability to insantiate it. "information"
// may also include the ability to parse itself from the xml.
StringList files;
#ifdef _MSC_VER
std::string extension( "*.dll" );
#else
std::string extension( "*.so" );
#endif
if ( !os::listdir( pluginFldr, files, extension ) ) {
return 0;
}
StringListCItr itr = files.begin();
for ( ; itr != files.end(); ++itr ) {
std::string fullPath;
if ( ! os::path::absPath( os::path::join( 2, pluginFldr.c_str(), (*itr).c_str() ), fullPath ) ) {
logger << Logger::ERR_MSG << "Unable to get absolute path for " << (*itr);
continue;
}
Plugin * plugin;
try {
plugin = new Plugin( fullPath );
} catch ( std::exception & ) {
logger << Logger::ERR_MSG << "Failed loading " << fullPath << " as a plug-in";
continue;
}
logger << Logger::INFO_MSG << "Loaded: " << plugin->getName() << "\n";;
logger << "\t" << plugin->getDescription();
plugin->registerPlugin( this );
_plugins.insert( PluginMap::value_type( (*itr), plugin ) );
}
return files.size();
}
示例8: createPluginObject
/*!
Add a plugin.
\param file The plugin file name.
\param server The server object to use.
messages.
\param global Specify if the library should be loaded globally.
*/
Plugin*
PluginsManager::preLoadPlugin (string &file, Server* server, bool global)
{
Plugin *plugin = createPluginObject ();
string name;
const char* namePtr;
if (plugin->preLoad (file, global))
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error pre-loading plugin `%s'"),
file.c_str ());
delete plugin;
return NULL;
}
namePtr = plugin->getName ();
if (namePtr)
name.assign (namePtr);
else
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error pre-loading plugin `%s'"),
file.c_str ());
delete plugin;
return NULL;
}
if (plugin->findSymbol ("__gpl_license") == NULL)
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s', the license is not GPL"),
file.c_str ());
delete plugin;
return NULL;
}
return plugin;
}
示例9: populate
void DlgPrefKey::populate() {
VampAnalyser::initializePluginPaths();
m_listIdentifier.clear();
m_listName.clear();
m_listLibrary.clear();
plugincombo->clear();
plugincombo->setDuplicatesEnabled(false);
VampPluginLoader* loader = VampPluginLoader::getInstance();
std::vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
qDebug() << "VampPluginLoader::listPlugins() returned" << plugins.size() << "plugins";
for (unsigned int iplugin=0; iplugin < plugins.size(); iplugin++) {
// TODO(XXX): WTF, 48000
Plugin* plugin = loader->loadPlugin(plugins[iplugin], 48000);
//TODO(XXX): find a general way to add key detectors only
if (plugin) {
Plugin::OutputList outputs = plugin->getOutputDescriptors();
for (unsigned int ioutput=0; ioutput < outputs.size(); ioutput++) {
QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
+ QString::number(ioutput);
QString displaynametext = QString::fromStdString(plugin->getName());
qDebug() << "Plugin output displayname:" << displayname << displaynametext;
bool goodones = displayname.contains(VAMP_ANALYSER_KEY_DEFAULT_PLUGIN_ID);
if (goodones) {
m_listName << displaynametext;
QString pluginlibrary = QString::fromStdString(plugins[iplugin]).section(":",0,0);
m_listLibrary << pluginlibrary;
QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
+ QString::number(ioutput);
m_listIdentifier << displayname;
plugincombo->addItem(displaynametext, displayname);
}
}
delete plugin;
plugin = 0;
}
}
}
示例10: main
int main()
{
try
{
//Create a RoadRunner object
RoadRunner rr("r:\\installs\\cg\\xe3\\debug\\rr_support");
//Get the plugin manager
PluginManager& plugins = rr.getPluginManager();
if(!plugins.load())
{
clog<<"Failed loading plugins..\n";
}
if(plugins.getNumberOfPlugins() > 0)
{
cout<<"The following plugins are loaded:\n";
for(int i = 0; i < plugins.getNumberOfPlugins(); i++)
{
Plugin* aPlugin = plugins[i];
cout<<"Plugin "<<i<<": "<<aPlugin->getName()<<"\n";
cout<<aPlugin->getInfo();
aPlugin->execute();
}
}
plugins.unload();
Pause(true);
rr.~RoadRunner();
}
catch(const rr::Exception& ex)
{
clog<<"There was a problem: "<<ex.what();
}
return 0;
}
示例11:
void
printPluginCategoryList()
{
PluginLoader *loader = PluginLoader::getInstance();
vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
set<string> printedcats;
for (size_t i = 0; i < plugins.size(); ++i) {
PluginLoader::PluginKey key = plugins[i];
PluginLoader::PluginCategoryHierarchy category =
loader->getPluginCategory(key);
Plugin *plugin = loader->loadPlugin(key, 48000);
if (!plugin) continue;
string catstr = "";
if (category.empty()) catstr = '|';
else {
for (size_t j = 0; j < category.size(); ++j) {
catstr += category[j];
catstr += '|';
if (printedcats.find(catstr) == printedcats.end()) {
std::cout << catstr << std::endl;
printedcats.insert(catstr);
}
}
}
std::cout << catstr << key << ":::" << plugin->getName() << ":::" << plugin->getMaker() << ":::" << plugin->getDescription() << std::endl;
}
}
示例12: strdup
const VampPluginDescriptor *
PluginAdapterBase::Impl::getDescriptor()
{
#ifdef DEBUG_PLUGIN_ADAPTER
std::cerr << "PluginAdapterBase::Impl[" << this << "]::getDescriptor" << std::endl;
#endif
if (m_populated) return &m_descriptor;
Plugin *plugin = m_base->createPlugin(48000);
if (plugin->getVampApiVersion() != VAMP_API_VERSION) {
std::cerr << "Vamp::PluginAdapterBase::Impl::getDescriptor: ERROR: "
<< "Plugin object API version "
<< plugin->getVampApiVersion()
<< " does not match actual API version "
<< VAMP_API_VERSION << std::endl;
delete plugin;
return 0;
}
m_parameters = plugin->getParameterDescriptors();
m_programs = plugin->getPrograms();
m_descriptor.vampApiVersion = plugin->getVampApiVersion();
m_descriptor.identifier = strdup(plugin->getIdentifier().c_str());
m_descriptor.name = strdup(plugin->getName().c_str());
m_descriptor.description = strdup(plugin->getDescription().c_str());
m_descriptor.maker = strdup(plugin->getMaker().c_str());
m_descriptor.pluginVersion = plugin->getPluginVersion();
m_descriptor.copyright = strdup(plugin->getCopyright().c_str());
m_descriptor.parameterCount = m_parameters.size();
m_descriptor.parameters = (const VampParameterDescriptor **)
malloc(m_parameters.size() * sizeof(VampParameterDescriptor));
unsigned int i;
for (i = 0; i < m_parameters.size(); ++i) {
VampParameterDescriptor *desc = (VampParameterDescriptor *)
malloc(sizeof(VampParameterDescriptor));
desc->identifier = strdup(m_parameters[i].identifier.c_str());
desc->name = strdup(m_parameters[i].name.c_str());
desc->description = strdup(m_parameters[i].description.c_str());
desc->unit = strdup(m_parameters[i].unit.c_str());
desc->minValue = m_parameters[i].minValue;
desc->maxValue = m_parameters[i].maxValue;
desc->defaultValue = m_parameters[i].defaultValue;
desc->isQuantized = m_parameters[i].isQuantized;
desc->quantizeStep = m_parameters[i].quantizeStep;
desc->valueNames = 0;
if (desc->isQuantized && !m_parameters[i].valueNames.empty()) {
desc->valueNames = (const char **)
malloc((m_parameters[i].valueNames.size()+1) * sizeof(char *));
for (unsigned int j = 0; j < m_parameters[i].valueNames.size(); ++j) {
desc->valueNames[j] = strdup(m_parameters[i].valueNames[j].c_str());
}
desc->valueNames[m_parameters[i].valueNames.size()] = 0;
}
m_descriptor.parameters[i] = desc;
}
m_descriptor.programCount = m_programs.size();
m_descriptor.programs = (const char **)
malloc(m_programs.size() * sizeof(const char *));
for (i = 0; i < m_programs.size(); ++i) {
m_descriptor.programs[i] = strdup(m_programs[i].c_str());
}
if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
m_descriptor.inputDomain = vampFrequencyDomain;
} else {
m_descriptor.inputDomain = vampTimeDomain;
}
m_descriptor.instantiate = vampInstantiate;
m_descriptor.cleanup = vampCleanup;
m_descriptor.initialise = vampInitialise;
m_descriptor.reset = vampReset;
m_descriptor.getParameter = vampGetParameter;
m_descriptor.setParameter = vampSetParameter;
m_descriptor.getCurrentProgram = vampGetCurrentProgram;
m_descriptor.selectProgram = vampSelectProgram;
m_descriptor.getPreferredStepSize = vampGetPreferredStepSize;
m_descriptor.getPreferredBlockSize = vampGetPreferredBlockSize;
m_descriptor.getMinChannelCount = vampGetMinChannelCount;
m_descriptor.getMaxChannelCount = vampGetMaxChannelCount;
m_descriptor.getOutputCount = vampGetOutputCount;
m_descriptor.getOutputDescriptor = vampGetOutputDescriptor;
m_descriptor.releaseOutputDescriptor = vampReleaseOutputDescriptor;
m_descriptor.process = vampProcess;
m_descriptor.getRemainingFeatures = vampGetRemainingFeatures;
m_descriptor.releaseFeatureSet = vampReleaseFeatureSet;
if (!m_adapterMap) {
m_adapterMap = new AdapterMap;
}
(*m_adapterMap)[&m_descriptor] = this;
//.........这里部分代码省略.........
示例13: FindPlugins
wxArrayString VampEffectsModule::FindPlugins(PluginManagerInterface & WXUNUSED(pm))
{
wxArrayString names;
PluginLoader *loader = PluginLoader::getInstance();
PluginLoader::PluginKeyList keys = loader->listPlugins();
for (PluginLoader::PluginKeyList::iterator i = keys.begin(); i != keys.end(); ++i)
{
Plugin *vp = PluginLoader::getInstance()->loadPlugin(*i, 48000); // rate doesn't matter here
if (!vp)
{
continue;
}
// We limit the listed plugin outputs to those whose results can
// readily be displayed in an Audacity label track.
//
// - Any output whose features have no values (time instants only),
// with or without duration, is fine
//
// - Any output whose features have more than one value, or an
// unknown or variable number of values, is right out
//
// - Any output whose features have exactly one value, with
// variable sample rate or with duration, should be OK --
// this implies a sparse feature, of which the time and/or
// duration are significant aspects worth displaying
//
// - An output whose features have exactly one value, with
// fixed sample rate and no duration, cannot be usefully
// displayed -- the value is the only significant piece of
// data there and we have no good value plot
Plugin::OutputList outputs = vp->getOutputDescriptors();
int output = 0;
for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
{
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
!j->hasFixedBinCount ||
(j->hasFixedBinCount && j->binCount > 1))
{
// All of these qualities disqualify (see notes above)
++output;
continue;
}
wxString name = wxString::FromUTF8(vp->getName().c_str());
if (outputs.size() > 1)
{
// This is not the plugin's only output.
// Use "plugin name: output name" as the effect name,
// unless the output name is the same as the plugin name
wxString outputName = wxString::FromUTF8(j->name.c_str());
if (outputName != name)
{
name = wxString::Format(wxT("%s: %s"),
name.c_str(), outputName.c_str());
}
}
wxString path = wxString::FromUTF8(i->c_str()) + wxT("/") + name;
names.Add(path);
++output;
}
delete vp;
}
return names;
}
示例14:
Plugin *VampEffectsModule::FindPlugin(const wxString & path,
int & output,
bool & hasParameters)
{
PluginLoader::PluginKey key = path.BeforeLast(wxT('/')).ToUTF8().data();
Plugin *vp = PluginLoader::getInstance()->loadPlugin(key, 48000); // rate doesn't matter here
if (!vp)
{
return false;
}
// We limit the listed plugin outputs to those whose results can
// readily be displayed in an Audacity label track.
//
// - Any output whose features have no values (time instants only),
// with or without duration, is fine
//
// - Any output whose features have more than one value, or an
// unknown or variable number of values, is right out
//
// - Any output whose features have exactly one value, with
// variable sample rate or with duration, should be OK --
// this implies a sparse feature, of which the time and/or
// duration are significant aspects worth displaying
//
// - An output whose features have exactly one value, with
// fixed sample rate and no duration, cannot be usefully
// displayed -- the value is the only significant piece of
// data there and we have no good value plot
Plugin::OutputList outputs = vp->getOutputDescriptors();
output = 0;
hasParameters = !vp->getParameterDescriptors().empty();
for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
{
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
!j->hasFixedBinCount ||
(j->hasFixedBinCount && j->binCount > 1))
{
// All of these qualities disqualify (see notes above)
++output;
continue;
}
wxString name = wxString::FromUTF8(vp->getName().c_str());
if (outputs.size() > 1)
{
// This is not the plugin's only output.
// Use "plugin name: output name" as the effect name,
// unless the output name is the same as the plugin name
wxString outputName = wxString::FromUTF8(j->name.c_str());
if (outputName != name)
{
name = wxString::Format(wxT("%s: %s"),
name.c_str(), outputName.c_str());
}
}
if (wxString::FromUTF8(key.c_str()) + wxT("/") + name == path)
{
return vp;
}
++output;
}
delete vp;
return NULL;
}
示例15: notify
LRESULT PluginListView::notify(WPARAM /*wParam*/, LPARAM lParam)
{
switch (((LPNMHDR)lParam)->code)
{
case LVN_GETDISPINFO:
{
if (_listMode == LISTMODE_LIST)
{
NMLVDISPINFO* plvdi = (NMLVDISPINFO*)lParam;
Plugin* plugin = reinterpret_cast<Plugin*>(plvdi->item.lParam);
switch (plvdi->item.iSubItem)
{
case 0:
{
plvdi->item.pszText = const_cast<TCHAR*>(plugin->getName().c_str());
break;
}
case 1:
{
plvdi->item.pszText = const_cast<TCHAR*>(plugin->getCategory().c_str());
break;
}
default:
if (plvdi->item.iSubItem == _nVersionColumns + 2)
{
plvdi->item.pszText = const_cast<TCHAR*>(plugin->getStability().c_str());
}
else
{
switch(_columns[plvdi->item.iSubItem - 2])
{
case VERSION_INSTALLED:
plvdi->item.pszText = plugin->getInstalledVersion().getDisplayString();
plvdi->item.cchTextMax = (int)_tcslen(plvdi->item.pszText);
break;
case VERSION_AVAILABLE:
plvdi->item.pszText = plugin->getVersion().getDisplayString();
plvdi->item.cchTextMax = (int)_tcslen(plvdi->item.pszText);
break;
}
}
break;
}
return TRUE;
}
break;
}
case LVN_COLUMNCLICK:
{
NMLISTVIEW *colInfo = reinterpret_cast<NMLISTVIEW*>(lParam);
int (CALLBACK *compareFunc)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) = NULL;
LVSORTCOLUMN sortColumn = LVSORTCOLUMN_NAME;
if (colInfo->iSubItem < 2 || colInfo->iSubItem == _nVersionColumns + 2)
{
compareFunc = PluginListView::stringComparer;
if (colInfo->iSubItem == 1)
{
sortColumn = LVSORTCOLUMN_CATEGORY;
}
else if (colInfo->iSubItem == _nVersionColumns + 2)
{
sortColumn = LVSORTCOLUMN_STABILITY;
}
}
else
{
compareFunc = PluginListView::versionComparer;
switch(_columns[colInfo->iSubItem - 2])
{
case VERSION_AVAILABLE:
sortColumn = LVSORTCOLUMN_VERSIONAVAILABLE;
break;
case VERSION_INSTALLED:
sortColumn = LVSORTCOLUMN_VERSIONINSTALLED;
break;
// Just in case there's another one introduced at some point (beta version or something)
default:
sortColumn = LVSORTCOLUMN_VERSIONAVAILABLE;
break;
}
}
ListView_SortItems(_hListView, compareFunc, static_cast<LPARAM>(sortColumn));
}
break;
case NM_CLICK:
//.........这里部分代码省略.........