当前位置: 首页>>代码示例>>C++>>正文


C++ LLXMLNodePtr类代码示例

本文整理汇总了C++中LLXMLNodePtr的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr类的具体用法?C++ LLXMLNodePtr怎么用?C++ LLXMLNodePtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LLXMLNodePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getNode

bool LLXUIParser::writeSDValue(const void* val_ptr, const name_stack_t& stack)
{
	LLXMLNodePtr node = getNode(stack);
	if (node.notNull())
	{
		std::string string_val = ((LLSD*)val_ptr)->asString();
		if (string_val.find('\n') != std::string::npos || string_val.size() > MAX_STRING_ATTRIBUTE_SIZE)
		{
			// don't write strings with newlines into attributes
			std::string attribute_name = node->getName()->mString;
			LLXMLNodePtr parent_node = node->mParent;
			parent_node->deleteChild(node);
			// write results in text contents of node
			if (attribute_name == "value")
			{
				// "value" is implicit, just write to parent
				node = parent_node;
			}
			else
			{
				node = parent_node->createChild(attribute_name.c_str(), false);
			}
		}

		node->setStringValue(string_val);
		return true;
	}
	return false;
}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:29,代码来源:llxuiparser.cpp

示例2: getXML

// virtual
LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const
{
	LLXMLNodePtr node = LLUICtrl::getXML();

	node->setName(LL_MULTI_SLIDER_CTRL_TAG);

	node->createChild("show_text", TRUE)->setBoolValue(mShowText);

	node->createChild("can_edit_text", TRUE)->setBoolValue(mCanEditText);

	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(mCurValue);

	if (mMultiSlider)
	{
		node->createChild("initial_val", TRUE)->setFloatValue(mMultiSlider->getInitialValue());
		node->createChild("min_val", TRUE)->setFloatValue(mMultiSlider->getMinValue());
		node->createChild("max_val", TRUE)->setFloatValue(mMultiSlider->getMaxValue());
		node->createChild("increment", TRUE)->setFloatValue(mMultiSlider->getIncrement());
	}
	addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
	addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");

	return node;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:33,代码来源:llmultisliderctrl.cpp

示例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;
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:26,代码来源:llradiogroup.cpp

示例4: parseLanguageStrings

//static
bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
{
	std::string xml_filename = "(language strings file)";
	if (!root->hasName("strings"))
	{
		llerrs << "Invalid root node name in " << xml_filename 
		<< ": was " << root->getName() << ", expected \"strings\"" << llendl;
	}
	
	StringTable string_table;
	LLXUIParser parser;
	parser.readXUI(root, string_table, xml_filename);
	
	if (!string_table.validateBlock())
	{
		llerrs << "Problem reading strings: " << xml_filename << llendl;
		return false;
	}
		
	for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin();
		it != string_table.strings.end();
		++it)
	{
		// share the same map with parseStrings() so we can search the strings using the same getString() function.- angela
		LLTransTemplate xml_template(it->name, it->value);
		sStringTemplates[xml_template.mName] = xml_template;
	}
	
	return true;
}
开发者ID:NickyPerian,项目名称:viewer-development,代码行数:31,代码来源:lltrans.cpp

示例5: buildContextMenu

//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLContextMenu* LLUICtrlFactory::buildContextMenu(const std::string& filename, LLView* parentp)
{
	LLXMLNodePtr root;

	if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
	{
		return NULL;
	}

	// root must be called panel
	if( !root->hasName( LL_PIE_MENU_TAG ))
	{
		LL_WARNS() << "Root node should be named " << LL_PIE_MENU_TAG << " in : " << filename << LL_ENDL;
		return NULL;
	}

	std::string name("menu");
	root->getAttributeString("name", name);

	static LLUICachedControl<bool> context("LiruUseContextMenus", false);
	LLContextMenu* menu = context ? new LLContextMenu(name) : new LLPieMenu(name);
	parentp->addChild(menu);
	menu->initXML(root, parentp, this, context);

	if (LLUI::sShowXUINames)
	{
		menu->setToolTip(filename);
	}

	return menu;
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:34,代码来源:lluictrlfactory.cpp

示例6: 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;
}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:33,代码来源:llcombobox.cpp

示例7: buildFloaterInternal

void LLUICtrlFactory::buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
										   const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
	// root must be called floater
	if( !(root->hasName("floater") || root->hasName("multi_floater") ) )
	{
		llwarns << "Root node should be named floater in: " << filename << llendl;
		return;
	}

	if (factory_map)
	{
		mFactoryStack.push_front(factory_map);
	}

	floaterp->initFloaterXML(root, NULL, this, open);	/* Flawfinder: ignore */

	if (LLUI::sShowXUINames)
	{
		floaterp->setToolTip(filename);
	}

	if (factory_map)
	{
		mFactoryStack.pop_front();
	}

	LLHandle<LLFloater> handle = floaterp->getHandle();
	mBuiltFloaters[handle] = filename;
}
开发者ID:BillBarnhill,项目名称:SingularityViewer,代码行数:30,代码来源:lluictrlfactory.cpp

示例8: parseStrings

//static 
bool LLUITrans::parseStrings(const std::string& xml_filename)
{
	LLXMLNodePtr root;
	BOOL success  = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);

	if (!success || root.isNull() || !root->hasName( "strings" ))
	{
		llwarns << "Problem reading strings: " << xml_filename << llendl;
		return false;
	}
	
	for (LLXMLNode* string = root->getFirstChild();
		 string != NULL; string = string->getNextSibling())
	{
		if (!string->hasName("string"))
		{
			continue;
		}
		
		std::string string_name;

		if (! string->getAttributeString("name", string_name))
		{
			llwarns << "Unable to parse string with no name" << llendl;
			continue;
		}
	
		LLUITransTemplate xml_template(string_name, string->getTextContents());
		sStringTemplates[xml_template.mName] = xml_template;
	}

	return true;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:34,代码来源:lluitrans.cpp

示例9: loadFromFilename

bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_map_t& table)
{
	LLXMLNodePtr root;

	if(!LLXMLNode::parseFile(filename, root, NULL))
	{
		llwarns << "Unable to parse color file " << filename << llendl;
		return false;
	}

	if(!root->hasName("colors"))
	{
		llwarns << filename << " is not a valid color definition file" << llendl;
		return false;
	}

	Params params;
	LLXUIParser parser;
	parser.readXUI(root, params, filename);

	if(params.validateBlock())
	{
		insertFromParams(params, table);
	}
	else
	{
		llwarns << filename << " failed to load" << llendl;
		return false;
	}

	return true;
}
开发者ID:HizWylder,项目名称:GIS,代码行数:32,代码来源:lluicolortable.cpp

示例10: getAttributeColor

//static
BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color)
{
	std::string colorstring;
	BOOL res = node->getAttributeString(name.c_str(), colorstring);
	if (res && LLUI::sColorsGroup)
	{
		if (LLUI::sColorsGroup->controlExists(colorstring))
		{
			color.setVec(LLUI::sColorsGroup->getColor(colorstring));
		}
		else
		{
			res = FALSE;
		}
	}
	if (!res)
	{
		res = LLColor4::parseColor(colorstring, &color);
	}	
	if (!res)
	{
		res = node->getAttributeColor(name.c_str(), color);
	}
	return res;
}
开发者ID:Xara,项目名称:Meerkat-Viewer,代码行数:26,代码来源:lluictrlfactory.cpp

示例11: kidstring

void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory)
{
	std::string kidstring(node->getName()->mString);
	kidstring += ".string";
	LLXMLNodePtr child;
	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
	{
		// look for string declarations for programmatic text
		if (child->hasName("string") || child->hasName(kidstring))
		{
			std::string string_name;
			child->getAttributeString("name", string_name);
			if (!string_name.empty())
			{
				std::string contents = child->getTextContents();
				child->getAttributeString("value", contents);
				mUIStrings[string_name] = contents;
			}
		}
		else
		{
			factory->createWidget(this, child);
		}
	}
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:25,代码来源:llpanel.cpp

示例12: buildFloaterInternal

void LLUICtrlFactory::buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
										   const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
	// root must be called floater
	if( !(root->hasName("floater") || root->hasName("multi_floater") ) )
	{
		llwarns << "Root node should be named floater in: " << filename << llendl;
		return;
	}

	if (factory_map)
	{
		mFactoryStack.push_front(factory_map);
	}

	// for local registry callbacks; define in constructor, referenced in XUI or postBuild
	floaterp->getCommitCallbackRegistrar().pushScope();
	floaterp->getEnableCallbackRegistrar().pushScope();
	floaterp->initFloaterXML(root, NULL, this, open);	/* Flawfinder: ignore */
	floaterp->getCommitCallbackRegistrar().popScope();
	floaterp->getEnableCallbackRegistrar().popScope();
	if (LLUI::sShowXUINames)
	{
		floaterp->setToolTip(filename);
	}

	if (factory_map)
	{
		mFactoryStack.pop_front();
	}

	LLHandle<LLFloater> handle = floaterp->getHandle();
	mBuiltFloaters[handle] = filename;
}
开发者ID:OS-Development,项目名称:VW.Singularity,代码行数:34,代码来源:lluictrlfactory.cpp

示例13: name

//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLPieMenu *LLUICtrlFactory::buildPieMenu(const std::string &filename, LLView* parentp)
{
	LLXMLNodePtr root;

	if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
	{
		return NULL;
	}

	// root must be called panel
	if( !root->hasName( LL_PIE_MENU_TAG ))
	{
		llwarns << "Root node should be named " << LL_PIE_MENU_TAG << " in : " << filename << llendl;
		return NULL;
	}

	std::string name("menu");
	root->getAttributeString("name", name);

	LLPieMenu *menu = new LLPieMenu(name);
	parentp->addChild(menu);
	menu->initXML(root, parentp, this);

	if (LLUI::sShowXUINames)
	{
		menu->setToolTip(filename);
	}

	return menu;
}
开发者ID:Xara,项目名称:Meerkat-Viewer,代码行数:33,代码来源:lluictrlfactory.cpp

示例14: checkForXMLTemplate

// private to this file
// returns true if the template request was invalid and there's nothing else we
// can do with this node, false if you should keep processing (it may have
// replaced the contents of the node referred to)
LLXMLNodePtr LLNotifications::checkForXMLTemplate(LLXMLNodePtr item)
{
	if (item->hasName("usetemplate"))
	{
		std::string replacementName;
		if (item->getAttributeString("name", replacementName))
		{
			StringMap replacements;
			for (LLXMLAttribList::const_iterator it=item->mAttributes.begin(); 
				 it != item->mAttributes.end(); ++it)
			{
				replacements[it->second->getName()->mString] = it->second->getValue();
			}
			if (mXmlTemplates.count(replacementName))
			{
				item=LLXMLNode::replaceNode(item, mXmlTemplates[replacementName]);
				
				// walk the nodes looking for $(substitution) here and replace
				replaceSubstitutionStrings(item, replacements);
			}
			else
			{
				llwarns << "XML template lookup failure on '" << replacementName << "' " << llendl;
			}
		}
	}
	return item;
}
开发者ID:CasperWarden,项目名称:CasperViewer,代码行数:32,代码来源:llnotifications.cpp

示例15:

//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLMenuGL *LLUICtrlFactory::buildMenu(const std::string &filename, LLView* parentp)
{
	// TomY TODO: Break this function into buildMenu and buildMenuBar
	LLXMLNodePtr root;
	LLMenuGL*    menu;

	if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
	{
		return NULL;
	}

	// root must be called panel
	if( !root->hasName( "menu_bar" ) && !root->hasName( "menu" ))
	{
		llwarns << "Root node should be named menu bar or menu in : " << filename << llendl;
		return NULL;
	}

	if (root->hasName("menu"))
	{
		menu = (LLMenuGL*)LLMenuGL::fromXML(root, parentp, this);
	}
	else
	{
		menu = (LLMenuGL*)LLMenuBarGL::fromXML(root, parentp, this);
	}
	
	if (LLUI::sShowXUINames)
	{
		menu->setToolTip(filename);
	}

    return menu;
}
开发者ID:Xara,项目名称:Meerkat-Viewer,代码行数:37,代码来源:lluictrlfactory.cpp


注:本文中的LLXMLNodePtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。