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


C++ LLXUIParser::readXUI方法代码示例

本文整理汇总了C++中LLXUIParser::readXUI方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXUIParser::readXUI方法的具体用法?C++ LLXUIParser::readXUI怎么用?C++ LLXUIParser::readXUI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLXUIParser的用法示例。


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

示例1: 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

示例2: 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

示例3: parseStrings

//static 
bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& default_args)
{
	std::string xml_filename = "(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;
	}
	
	sStringTemplates.clear();
	sDefaultArgs.clear();
	
	for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin();
		it != string_table.strings.end();
		++it)
	{
		LLTransTemplate xml_template(it->name, it->value);
		sStringTemplates[xml_template.mName] = xml_template;
		
		std::set<std::string>::const_iterator iter = default_args.find(xml_template.mName);
		if (iter != default_args.end())
		{
			std::string name = *iter;
			if (name[0] != '[')
				name = llformat("[%s]",name.c_str());
			sDefaultArgs[name] = xml_template.mText;
		}
	}

	return true;
}
开发者ID:NickyPerian,项目名称:viewer-development,代码行数:42,代码来源:lltrans.cpp

示例4:

const outfit_accordion_tab_params& get_accordion_tab_params()
{
	static outfit_accordion_tab_params tab_params;
	static bool initialized = false;
	if (!initialized)
	{
		initialized = true;

		LLXMLNodePtr xmlNode;
		if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode))
		{
			LLXUIParser parser;
			parser.readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml");
		}
		else
		{
			llwarns << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << llendl;
		}
	}

	return tab_params;
}
开发者ID:OS-Development,项目名称:VW.Zen,代码行数:22,代码来源:lloutfitslist.cpp

示例5: initPanelXML

BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
{
	Params params(default_params);
	{
		LLFastTimer timer(FTM_PANEL_SETUP);

		LLXMLNodePtr referenced_xml;
		std::string xml_filename = mXMLFilename;
		
		// if the panel didn't provide a filename, check the node
		if (xml_filename.empty())
		{
			node->getAttributeString("filename", xml_filename);
			setXMLFilename(xml_filename);
		}

		LLXUIParser parser;

		if (!xml_filename.empty())
		{
			LLUICtrlFactory::instance().pushFileName(xml_filename);

			LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD);
			if (output_node)
			{
				//if we are exporting, we want to export the current xml
				//not the referenced xml
				parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
				Params output_params(params);
				setupParamsForExport(output_params, parent);
				output_node->setName(node->getName()->mString);
				parser.writeXUI(output_node, output_params, &default_params);
				return TRUE;
			}
		
			if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml))
			{
				llwarns << "Couldn't parse panel from: " << xml_filename << llendl;

				return FALSE;
			}

			parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());

			// add children using dimensions from referenced xml for consistent layout
			setShape(params.rect);
			LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance());

			LLUICtrlFactory::instance().popFileName();
		}

		// ask LLUICtrlFactory for filename, since xml_filename might be empty
		parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());

		if (output_node)
		{
			Params output_params(params);
			setupParamsForExport(output_params, parent);
			output_node->setName(node->getName()->mString);
			parser.writeXUI(output_node, output_params, &default_params);
		}
		
		params.from_xui = true;
		applyXUILayout(params, parent);
		{
			LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
			initFromParams(params);
		}

		// add children
		LLUICtrlFactory::createChildren(this, node, child_registry_t::instance(), output_node);

		// Connect to parent after children are built, because tab containers
		// do a reshape() on their child panels, which requires that the children
		// be built/added. JC
		if (parent)
		{
			S32 tab_group = params.tab_group.isProvided() ? params.tab_group() : parent->getLastTabGroup();
			parent->addChild(this, tab_group);
		}

		{
			LLFastTimer timer(FTM_PANEL_POSTBUILD);
			postBuild();
		}
	}
	return TRUE;
}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:88,代码来源:llpanel.cpp

示例6: loadToolbars

bool LLToolBarView::loadToolbars(bool force_default)
{
	LLToolBarView::ToolbarSet toolbar_set;
	bool err = false;
	
	// Load the toolbars.xml file
	std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
	if (force_default)
	{
		toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_TOP_SKIN, "toolbars.xml"); // FS:AO - Look in skin directory, not settings
	}
	else if (!gDirUtilp->fileExists(toolbar_file)) 
	{
		LL_WARNS() << "User toolbars def not found -> use selected skin" << LL_ENDL;
		toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_TOP_SKIN, "toolbars.xml"); // FS:AO - Look in skin directory, not settings
	}
	if (!gDirUtilp->fileExists(toolbar_file)) // FS:AO - Look in skin default dir as fallback
	{
		LL_WARNS() << "Skin toolbars def not found -> use default skin" << LL_ENDL;
                toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "toolbars.xml");
	}
	
	LLXMLNodePtr root;
	if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
	{
		LL_WARNS() << "Unable to load toolbars from file: " << toolbar_file << LL_ENDL;
		err = true;
	}
	
	if (!err && !root->hasName("toolbars"))
	{
		LL_WARNS() << toolbar_file << " is not a valid toolbars definition file" << LL_ENDL;
		err = true;
	}
	
	// Parse the toolbar settings
	LLXUIParser parser;
	if (!err)
	{
	    parser.readXUI(root, toolbar_set, toolbar_file);
	}

	if (!err && !toolbar_set.validateBlock())
	{
		LL_WARNS() << "Unable to validate toolbars from file: " << toolbar_file << LL_ENDL;
		err = true;
	}
	
	if (err)
	{
		if (force_default)
		{
			LL_ERRS() << "Unable to load toolbars from default file : " << toolbar_file << LL_ENDL;
		    return false;
	    }

		// Try to load the default toolbars
		return loadToolbars(true);
	}
	
	// Clear the toolbars now before adding the loaded commands and settings
	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
	{
		if (mToolbars[i])
		{
			mToolbars[i]->clearCommandsList();
		}
	}
	
	// Add commands to each toolbar
	if (toolbar_set.left_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
	{
		if (toolbar_set.left_toolbar.button_display_mode.isProvided())
		{
			LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
			mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type);
		}
		// <FS:Zi> Load left toolbar layout and alignment from XML
		if (toolbar_set.left_toolbar.button_alignment.isProvided())
		{
			LLToolBarEnums::Alignment alignment = toolbar_set.left_toolbar.button_alignment;
			mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setAlignment(alignment);
		}

		if (toolbar_set.left_toolbar.button_layout_style.isProvided())
		{
			LLToolBarEnums::LayoutStyle layout_style = toolbar_set.left_toolbar.button_layout_style;
			mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setLayoutStyle(layout_style);
		}
		// </FS:Zi>
		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.left_toolbar.commands)
		{
			if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT]))
			{
				LL_WARNS() << "Error adding command '" << command_params.name() << "' to left toolbar." << LL_ENDL;
			}
		}
	}
	if (toolbar_set.right_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
	{
//.........这里部分代码省略.........
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:101,代码来源:lltoolbarview.cpp


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