本文整理汇总了C++中PluginInfo::addDependence方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::addDependence方法的具体用法?C++ PluginInfo::addDependence怎么用?C++ PluginInfo::addDependence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInfo
的用法示例。
在下文中一共展示了PluginInfo::addDependence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
{
xmlChar* maxVersion = xmlGetProp (nodes->nodeTab[0],
(const xmlChar*) "max-version");
string sMaxVer ((char*)maxVersion);
pinfo->setMyServerMaxVersion (PluginInfo::convertVersion (sMaxVer));
}
else
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
auto_ptr<XmlXPathResult> xpathResPluginName = auto_ptr<XmlXPathResult>
(xml.evaluateXpath ("/PLUGIN/NAME/text ()"));
nodes = xpathResPluginName->getNodeSet ();
size = (nodes) ? nodes->nodeNr : 0;
if (size != 1)
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
const char* cname = (const char*) nodes->nodeTab[0]->content;
if (strcmp (name.c_str (), cname))
return NULL;
auto_ptr<XmlXPathResult> xpathResPluginVersion = auto_ptr<XmlXPathResult>
(xml.evaluateXpath ("/PLUGIN/VERSION/text ()"));
nodes = xpathResPluginVersion->getNodeSet ();
size = (nodes) ? nodes->nodeNr : 0;
if (size != 1)
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
string verStr ((char*) nodes->nodeTab[0]->content);
int version = PluginInfo::convertVersion (verStr);
if (version != -1)
pinfo->setVersion (version);
else
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
auto_ptr<XmlXPathResult> xpathResDeps = auto_ptr<XmlXPathResult>
(xml.evaluateXpath ("/PLUGIN/DEPENDS"));
nodes = xpathResDeps->getNodeSet ();
size = (nodes) ? nodes->nodeNr : 0;
for (int i = 0; i < size; i++)
{
const char* depends = (const char*) nodes->nodeTab[i]->children->content;
string nameDep (depends);
if (!xmlHasProp (nodes->nodeTab[i], (const xmlChar*) "min-version") ||
!xmlHasProp (nodes->nodeTab[i], (const xmlChar*) "max-version"))
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
string minVerStr = ((char*) xmlGetProp (nodes->nodeTab[i],
(const xmlChar*) "min-version"));
string maxVerStr = ((char*) xmlGetProp (nodes->nodeTab[i],
(const xmlChar*) "max-version"));
int minVersion = PluginInfo::convertVersion (minVerStr);
int maxVersion = PluginInfo::convertVersion (maxVerStr);
if (minVersion == -1 || maxVersion == -1)
{
server->log (MYSERVER_LOG_MSG_ERROR,
_("Error loading plugin `%s': invalid plugin.xml"),
name.c_str ());
return NULL;
}
pinfo->addDependence (nameDep, minVersion, maxVersion);
}
pinfoAutoPtr.release ();
return pinfo;
}