当前位置: 首页>>代码示例>>C++>>正文


C++ PluginInfo::getMyServerMinVersion方法代码示例

本文整理汇总了C++中PluginInfo::getMyServerMinVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::getMyServerMinVersion方法的具体用法?C++ PluginInfo::getMyServerMinVersion怎么用?C++ PluginInfo::getMyServerMinVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginInfo的用法示例。


在下文中一共展示了PluginInfo::getMyServerMinVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: name

/*!
  Load the plugins.
  \param server The server object to use.
 */
int
PluginsManager::load (Server *server)
{
  list<string*> toRemove;
  HashMap<string, list<string>*> dependsOn;
  HashMap<string, PluginInfo*>::Iterator it = pluginsInfos.begin ();
  HashMap<string, bool> remove;
  while (it != pluginsInfos.end ())
    {
      string name (it.getKey ());
      PluginInfo* pinfo = *it;
      HashMap<string, pair<int, int>* >::Iterator depIt = pinfo->begin ();

      string msversion (MYSERVER_VERSION);
      size_t i = msversion.find ("-", 0);
      if (i != string::npos)
        msversion = msversion.substr (0, i);

      int msVersion = PluginInfo::convertVersion (msversion);
      if (msVersion < pinfo->getMyServerMinVersion ()
          || msVersion > pinfo->getMyServerMaxVersion ())
        server->log (MYSERVER_LOG_MSG_WARNING,
                            _("Plugin `%s' not compatible with this version"),
                            name.c_str ());
      else
        remove.put (name, false);

      for (; depIt != pinfo->end (); depIt++)
        {
          string dname = depIt.getKey ();

          list<string>* deps = dependsOn.get (dname);
          if (!deps)
            {
              deps = new list<string > ();
              dependsOn.put (dname, deps);
            }

          deps->push_front (name);
        }

      it++;
    }

  list<string*>::iterator tRIt = toRemove.begin ();
  for (; tRIt != toRemove.end (); tRIt++)
    removePlugin (**tRIt);
  toRemove.clear ();

  HashMap<string, list<string>*>::Iterator dIt = dependsOn.begin ();
  for (; dIt != dependsOn.end (); dIt++)
    {
      string logBuf;
      string dname = dIt.getKey ();

      PluginInfo* pinfo = getPluginInfo (dname);

      if (!pinfo || pinfo->getVersion () == 0)
        remove.put (dname, true);

      list<string>* dependsList = (*dIt);
      if (!dependsList)
        continue;
      if (dependsList->empty ())
        continue;

      bool rem = remove.get (dname);
      if (rem)
        {
          recursiveDependencesFallDown (server, dname, remove, dependsOn);
          continue;
        }

      HashMap<string, pair<int, int>* >::Iterator lit = pinfo->begin ();
      for (; lit != pinfo->end (); lit++)
        {
          string depN = lit.getKey ();
          PluginInfo* dep = getPluginInfo (depN);
          if (!dep || remove.get (depN))
            {
              server->log (MYSERVER_LOG_MSG_WARNING,
                                  _("Missing plugin dependence `%s' --> `%s'"),
                                  dname.c_str (), depN.c_str ());
              recursiveDependencesFallDown (server, dname, remove, dependsOn);
              break;
            }


          pair<int, int>* pdep = *lit;
          if (dep->getVersion () < pdep->first
              || dep->getVersion () > pdep->second)
            {
              recursiveDependencesFallDown (server, dname, remove, dependsOn);
              server->log (MYSERVER_LOG_MSG_WARNING,
                            _("Plugin `%s' not compatible with this version"),
                            dname.c_str ());
//.........这里部分代码省略.........
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:101,代码来源:plugins_manager.cpp


注:本文中的PluginInfo::getMyServerMinVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。