本文整理汇总了C++中LLXMLNodePtr::createChild方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::createChild方法的具体用法?C++ LLXMLNodePtr::createChild怎么用?C++ LLXMLNodePtr::createChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::createChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCardinalityNode
LLXMLNodePtr LLRNGWriter::createCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count)
{
// unlinked by default, meaning this attribute is forbidden
LLXMLNodePtr count_node = new LLXMLNode();
if (min_count == 0)
{
if (max_count == 1)
{
count_node = parent_node->createChild("optional", false);
}
else if (max_count > 1)
{
count_node = parent_node->createChild("zeroOrMore", false);
}
}
else if (min_count >= 1)
{
if (max_count == 1 && min_count == 1)
{
// just add raw element, will count as 1 and only 1
count_node = parent_node;
}
else
{
count_node = parent_node->createChild("oneOrMore", false);
}
}
return count_node;
}
示例2: getXML
// virtual
LLXMLNodePtr LLComboBox::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_COMBO_BOX_TAG);
// Attributes
node->createChild("allow_text_entry", TRUE)->setBoolValue(mAllowTextEntry);
node->createChild("max_chars", TRUE)->setIntValue(mMaxChars);
// Contents
std::vector<LLScrollListItem*> data_list = mList->getAllData();
std::vector<LLScrollListItem*>::iterator data_itor;
for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
{
LLScrollListItem* item = *data_itor;
LLScrollListCell* cell = item->getColumn(0);
if (cell)
{
LLXMLNodePtr item_node = node->createChild("combo_item", FALSE);
LLSD value = item->getValue();
item_node->createChild("value", TRUE)->setStringValue(value.asString());
item_node->createChild("enabled", TRUE)->setBoolValue(item->getEnabled());
item_node->setStringValue(cell->getValue().asString());
}
}
return node;
}
示例3: getXML
// virtual
LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_RADIO_GROUP_TAG);
// Attributes
node->createChild("draw_border", TRUE)->setBoolValue(mHasBorder);
node->createChild("allow_deselect", TRUE)->setBoolValue(mAllowDeselect);
// Contents
for (button_list_t::const_iterator iter = mRadioButtons.begin();
iter != mRadioButtons.end(); ++iter)
{
LLRadioCtrl* radio = *iter;
LLXMLNodePtr child_node = radio->getXML();
node->addChild(child_node);
}
return node;
}
示例4: getXML
// virtual
LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_SLIDER_CTRL_TAG);
node->createChild("show_text", TRUE)->setBoolValue(mShowText);
node->createChild("can_edit_text", TRUE)->setBoolValue(mCanEditText);
node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider);
node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision);
if (mLabelBox)
{
node->createChild("label", TRUE)->setStringValue(mLabelBox->getText());
}
// TomY TODO: Do we really want to export the transient state of the slider?
node->createChild("value", TRUE)->setFloatValue(mValue);
if (mSlider)
{
node->createChild("initial_val", TRUE)->setFloatValue(mSlider->getInitialValue());
node->createChild("min_val", TRUE)->setFloatValue(mSlider->getMinValue());
node->createChild("max_val", TRUE)->setFloatValue(mSlider->getMaxValue());
node->createChild("increment", TRUE)->setFloatValue(mSlider->getIncrement());
}
addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");
return node;
}
示例5: getXML
// virtual
LLXMLNodePtr LLSlider::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue());
node->createChild("min_val", TRUE)->setFloatValue(getMinValue());
node->createChild("max_val", TRUE)->setFloatValue(getMaxValue());
node->createChild("increment", TRUE)->setFloatValue(getIncrement());
node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider);
return node;
}
示例6: getXML
// virtual
LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
if (mImageName != "")
{
node->createChild("image_name", TRUE)->setStringValue(mImageName);
}
node->createChild("color", TRUE)->setFloatValue(4, mColor.mV);
return node;
}
示例7: getXML
// virtual
LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_SPIN_CTRL_TAG);
node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision);
if (mLabelBox)
{
node->createChild("label", TRUE)->setStringValue(mLabelBox->getText());
node->createChild("label_width", TRUE)->setIntValue(mLabelBox->getRect().getWidth());
if (node->hasAttribute("font"))
{
node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL));
}
}
node->createChild("initial_val", TRUE)->setFloatValue(mInitialValue);
node->createChild("min_val", TRUE)->setFloatValue(mMinValue);
node->createChild("max_val", TRUE)->setFloatValue(mMaxValue);
node->createChild("increment", TRUE)->setFloatValue(mIncrement);
addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");
return node;
}
示例8: getXML
LLXMLNodePtr LLJoystick::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign()));
node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant));
addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),std::string("image_unselected"));
addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),std::string("image_selected"));
node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage());
return node;
}
示例9: addImageAttributeToXML
void LLButton::addImageAttributeToXML(LLXMLNodePtr node,
const std::string& image_name,
const LLUUID& image_id,
const std::string& xml_tag_name) const
{
if( !image_name.empty() )
{
node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name);
}
else if( image_id != LLUUID::null )
{
node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id);
}
}
示例10: writeRNG
void LLRNGWriter::writeRNG(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace)
{
mGrammarNode = node;
mGrammarNode->setName("grammar");
mGrammarNode->createChild("xmlns", true)->setStringValue("http://relaxng.org/ns/structure/1.0");
mGrammarNode->createChild("datatypeLibrary", true)->setStringValue("http://www.w3.org/2001/XMLSchema-datatypes");
mGrammarNode->createChild("ns", true)->setStringValue(xml_namespace);
node = mGrammarNode->createChild("start", false);
node = node->createChild("ref", false);
node->createChild("name", true)->setStringValue(type_name);
addDefinition(type_name, block);
}
示例11: addDefinition
void LLRNGWriter::addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block)
{
if (mDefinedElements.find(type_name) != mDefinedElements.end()) return;
mDefinedElements.insert(type_name);
LLXMLNodePtr node = mGrammarNode->createChild("define", false);
node->createChild("name", true)->setStringValue(type_name);
mElementNode = node->createChild("element", false);
mElementNode->createChild("name", true)->setStringValue(type_name);
mChildrenNode = mElementNode->createChild("zeroOrMore", false)->createChild("choice", false);
mAttributesWritten.first = mElementNode;
mAttributesWritten.second.clear();
mElementsWritten.clear();
block.inspectBlock(*this);
// add includes for all possible children
const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name);
const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type);
// add include declarations for all valid children
for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
it != widget_registryp->currentRegistrar().endItems();
++it)
{
std::string child_name = it->first;
if (child_name == type_name)
{
continue;
}
LLXMLNodePtr old_element_node = mElementNode;
LLXMLNodePtr old_child_node = mChildrenNode;
//FIXME: add LLDefaultParamBlockRegistry back when working on schema generation
//addDefinition(child_name, (*LLDefaultParamBlockRegistry::instance().getValue(type))());
mElementNode = old_element_node;
mChildrenNode = old_child_node;
mChildrenNode->createChild("ref", false)->createChild("name", true)->setStringValue(child_name);
}
if (mChildrenNode->mChildren.isNull())
{
// remove unused children node
mChildrenNode->mParent->mParent->deleteChild(mChildrenNode->mParent);
}
}
示例12: getXML
// virtual
LLXMLNodePtr LLNameListCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLScrollListCtrl::getXML();
node->createChild("allow_calling_card_drop", TRUE)->setBoolValue(mAllowCallingCardDrop);
if (mNameColumnIndex != 0)
{
node->createChild("name_column_index", TRUE)->setIntValue(mNameColumnIndex);
}
// Don't save contents, probably filled by code
return node;
}
示例13: getXML
// virtual
LLXMLNodePtr LLPanel::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_PANEL_TAG);
if (mBorder && mBorder->getVisible())
{
node->createChild("border", TRUE)->setBoolValue(TRUE);
}
if (!mRectControl.empty())
{
node->createChild("rect_control", TRUE)->setStringValue(mRectControl);
}
if (!mLabel.empty())
{
node->createChild("label", TRUE)->setStringValue(mLabel);
}
ui_string_map_t::const_iterator i = mUIStrings.begin();
ui_string_map_t::const_iterator end = mUIStrings.end();
for (; i != end; ++i)
{
LLXMLNodePtr child_node = node->createChild("string", FALSE);
child_node->setStringValue(i->second);
child_node->createChild("name", TRUE)->setStringValue(i->first);
}
if (save_children)
{
LLView::child_list_const_reverse_iter_t rit;
for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit)
{
LLView* childp = *rit;
if (childp->getSaveToXML())
{
LLXMLNodePtr xml_node = childp->getXML();
node->addChild(xml_node);
}
}
}
return node;
}
示例14: getXML
LLXMLNodePtr LLUICtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLView::getXML(save_children);
node->createChild("tab_stop", TRUE)->setBoolValue(hasTabStop());
return node;
}
示例15: getXML
// virtual
LLXMLNodePtr LLTextureCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_TEXTURE_CTRL_TAG);
node->createChild("label", TRUE)->setStringValue(getLabel());
node->createChild("default_image_name", TRUE)->setStringValue(getDefaultImageName());
node->createChild("allow_no_texture", TRUE)->setBoolValue(mAllowNoTexture);
node->createChild("can_apply_immediately", TRUE)->setBoolValue(mCanApplyImmediately );
return node;
}