本文整理汇总了C++中NodeTree::getAttr方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeTree::getAttr方法的具体用法?C++ NodeTree::getAttr怎么用?C++ NodeTree::getAttr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeTree
的用法示例。
在下文中一共展示了NodeTree::getAttr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
/*!
Load the plugin options.
\param server The server object to use.
*/
int
PluginsManager::loadOptions (Server *server)
{
int ret = 0;
string key ("server.plugins");
NodeTree<string>* node = server->getNodeTree (key);
if (node == NULL)
return 0;
list<NodeTree<string>*> *children = node->getChildren ();
if (children == NULL)
return 0;
string namespaceKey ("namespace");
string pluginKey ("plugin");
string globalKey ("global");
string enabledKey ("enabled");
for (list<NodeTree<string>*>::iterator it = children->begin ();
it != children->end ();
it++)
{
NodeTree<string>* node = *it;
string plugin;
string namespaceName;
bool global = false;
bool enabled = false;
if (node->getAttr (namespaceKey))
namespaceName.assign (*node->getAttr (namespaceKey));
if (node->getAttr (pluginKey))
plugin.assign (*node->getAttr (pluginKey));
if (node->getAttr (globalKey))
global = stringcmpi (*node->getAttr (globalKey), "YES") == 0;
if (node->getAttr (enabledKey))
enabled = stringcmpi (*node->getAttr (enabledKey), "YES") == 0;
if (plugin.length ())
addPluginInfo (plugin, new PluginInfo (plugin, enabled, global));
else
{
server->log (MYSERVER_LOG_MSG_WARNING,
_("Invalid plugin name in PLUGIN block."));
ret = -1;
}
}
return ret;
}