本文整理汇总了C++中LLXMLNodePtr::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::getChild方法的具体用法?C++ LLXMLNodePtr::getChild怎么用?C++ LLXMLNodePtr::getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::getChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initFromXML
void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
{
std::string name;
if(node->getAttributeString("name", name))
setName(name);
BOOL has_tab_stop = hasTabStop();
node->getAttributeBOOL("tab_stop", has_tab_stop);
setTabStop(has_tab_stop);
node->getAttributeBOOL("requests_front", mRequestsFront);
std::string str = node->getName()->mString;
std::string attrib_str;
LLXMLNodePtr child_node;
//Since so many other callback 'types' piggyback off of the commitcallback registrar as well as use the same callback signature
//we can assemble a nice little static list to iterate down instead of copy-pasting mostly similar code for each instance.
//Validate/enable callbacks differ, as it uses its own registry/callback signature. This could be worked around with a template, but keeping
//all the code local to this scope is more beneficial.
typedef boost::signals2::connection (LLUICtrl::*commit_fn)( const commit_signal_t::slot_type& cb );
static std::pair<std::string,commit_fn> sCallbackRegistryMap[3] =
{
std::pair<std::string,commit_fn>(".commit_callback",&LLUICtrl::setCommitCallback),
std::pair<std::string,commit_fn>(".mouseenter_callback",&LLUICtrl::setMouseEnterCallback),
std::pair<std::string,commit_fn>(".mouseleave_callback",&LLUICtrl::setMouseLeaveCallback)
};
for(S32 i= 0; i < sizeof(sCallbackRegistryMap)/sizeof(sCallbackRegistryMap[0]);++i)
{
if(node->getChild((str+sCallbackRegistryMap[i].first).c_str(),child_node,false))
{
if(child_node->getAttributeString("function",attrib_str))
{
commit_callback_t* func = (CommitCallbackRegistry::getValue(attrib_str));
if (func)
{
if(child_node->getAttributeString("parameter",attrib_str))
(this->*sCallbackRegistryMap[i].second)(boost::bind((*func), this, LLSD(attrib_str)));
else
(this->*sCallbackRegistryMap[i].second)(commit_signal_t::slot_type(*func));
}
}
}
}
if(node->getChild((str+".validate_callback").c_str(),child_node,false))
{
if(child_node->getAttributeString("function",attrib_str))
{
enable_callback_t* func = (EnableCallbackRegistry::getValue(attrib_str));
if (func)
{
if(child_node->getAttributeString("parameter",attrib_str))
setValidateCallback(boost::bind((*func), this, LLSD(attrib_str)));
else
setValidateCallback(enable_signal_t::slot_type(*func));
}
}
}
LLView::initFromXML(node, parent);
if (node->getAttributeString("enabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setEnabledControlVariable(control);
}
if (node->getAttributeString("disabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setDisabledControlVariable(control);
}
if(node->getAttributeString("visibility_control",attrib_str) || node->getAttributeString("visiblity_control",attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setMakeVisibleControlVariable(control);
}
if(node->getAttributeString("invisibility_control",attrib_str) || node->getAttributeString("invisiblity_control",attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setMakeInvisibleControlVariable(control);
}
}