本文整理汇总了C++中LLXmlTreeNode::getAttributeS32方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXmlTreeNode::getAttributeS32方法的具体用法?C++ LLXmlTreeNode::getAttributeS32怎么用?C++ LLXmlTreeNode::getAttributeS32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXmlTreeNode
的用法示例。
在下文中一共展示了LLXmlTreeNode::getAttributeS32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromFile
// Returns number of controls loaded, so 0 if failure
U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
LLString name;
LLXmlTree xml_controls;
if (!xml_controls.parseFile(filename))
{
llwarns << "Unable to open control file " << filename << llendl;
return 0;
}
LLXmlTreeNode* rootp = xml_controls.getRoot();
if (!rootp || !rootp->hasAttribute("version"))
{
llwarns << "No valid settings header found in control file " << filename << llendl;
return 0;
}
U32 item = 0;
U32 validitems = 0;
S32 version;
rootp->getAttributeS32("version", version);
// Check file version
if (version != CURRENT_VERSION)
{
llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
return 0;
}
LLXmlTreeNode* child_nodep = rootp->getFirstChild();
while(child_nodep)
{
name = child_nodep->getName();
BOOL declared = controlExists(name);
if (require_declaration && !declared)
{
// Declaration required, but this name not declared.
// Complain about non-empty names.
if (!name.empty())
{
//read in to end of line
llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
}
child_nodep = rootp->getNextChild();
continue;
}
// Got an item. Load it up.
item++;
// If not declared, assume it's a string
if (!declared)
{
switch(declare_as)
{
case TYPE_COL4:
declareColor4(name, LLColor4::white, "", NO_PERSIST);
break;
case TYPE_COL4U:
declareColor4U(name, LLColor4U::white, "", NO_PERSIST);
break;
case TYPE_STRING:
default:
declareString(name, LLString::null, "", NO_PERSIST);
break;
}
}
// Control name has been declared in code.
LLControlBase *control = getControl(name);
llassert(control);
mLoadedSettings.insert(name);
switch(control->mType)
{
case TYPE_F32:
{
F32 initial = 0.f;
child_nodep->getAttributeF32("value", initial);
control->set(initial);
validitems++;
}
break;
case TYPE_S32:
{
S32 initial = 0;
child_nodep->getAttributeS32("value", initial);
control->set(initial);
//.........这里部分代码省略.........