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


C++ LLXMLNodePtr::getAttributeF32方法代码示例

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


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

示例1: initFromXML

bool LLFontRegistry::initFromXML(LLXMLNodePtr node)
{
	LLXMLNodePtr child;
	
	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
	{
		std::string child_name;
		child->getAttributeString("name",child_name);
		if (child->hasName("font"))
		{
			LLFontDescriptor desc;
			bool font_succ = fontDescInitFromXML(child, desc);
			LLFontDescriptor norm_desc = desc.normalize();
			if (font_succ)
			{
				// if this is the first time we've seen this font name,
				// create a new template map entry for it.
				const LLFontDescriptor *match_desc = getMatchingFontDesc(desc);
				if (match_desc == NULL)
				{
					// Create a new entry (with no corresponding font).
					mFontMap[norm_desc] = NULL;
				}
				// otherwise, find the existing entry and combine data. 
				else
				{
					// Prepend files from desc.
					// A little roundabout because the map key is const,
					// so we have to fetch it, make a new map key, and
					// replace the old entry.
					string_vec_t match_file_names = match_desc->getFileNames();
					match_file_names.insert(match_file_names.begin(),
											desc.getFileNames().begin(),
											desc.getFileNames().end());
					LLFontDescriptor new_desc = *match_desc;
					new_desc.getFileNames() = match_file_names;
					mFontMap.erase(*match_desc);
					mFontMap[new_desc] = NULL;
				}
			}
		}
		else if (child->hasName("font_size"))
		{
			std::string size_name;
			F32 size_value;
			if (child->getAttributeString("name",size_name) &&
				child->getAttributeF32("size",size_value))
			{
				mFontSizes[size_name] = size_value;
			}

		}
	}
	return true;
}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:55,代码来源:llfontregistry.cpp

示例2: fromXML

LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string name("name_list");
	node->getAttributeString("name", name);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	BOOL multi_select = FALSE;
	node->getAttributeBOOL("multi_select", multi_select);

	BOOL draw_border = TRUE;
	node->getAttributeBOOL("draw_border", draw_border);

	BOOL draw_heading = FALSE;
	node->getAttributeBOOL("draw_heading", draw_heading);

	S32 name_column_index = 0;
	node->getAttributeS32("name_column_index", name_column_index);

	LLUICtrlCallback callback = NULL;

	LLNameListCtrl* name_list = new LLNameListCtrl(name,
				   rect,
				   callback,
				   NULL,
				   multi_select,
				   draw_border,
				   name_column_index);

	name_list->setDisplayHeading(draw_heading);
	if (node->hasAttribute("heading_height"))
	{
		S32 heading_height;
		node->getAttributeS32("heading_height", heading_height);
		name_list->setHeadingHeight(heading_height);
	}

	BOOL allow_calling_card_drop = FALSE;
	if (node->getAttributeBOOL("allow_calling_card_drop", allow_calling_card_drop))
	{
		name_list->setAllowCallingCardDrop(allow_calling_card_drop);
	}

	name_list->setScrollListParameters(node);

	name_list->initFromXML(node, parent);

	LLSD columns;
	S32 index = 0;
	S32 total_static = 0;
	LLXMLNodePtr child;
	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
	{
		if (child->hasName("column"))
		{
			std::string labelname("");
			child->getAttributeString("label", labelname);

			std::string columnname(labelname);
			child->getAttributeString("name", columnname);

			BOOL columndynamicwidth = FALSE;
			child->getAttributeBOOL("dynamicwidth", columndynamicwidth);

			std::string sortname(columnname);
			child->getAttributeString("sort", sortname);
		
			S32 columnwidth = -1;
			if (child->hasAttribute("relwidth"))
			{
				F32 columnrelwidth = 0.f;
				child->getAttributeF32("relwidth", columnrelwidth);
				columns[index]["relwidth"] = columnrelwidth;
			}
			else
			{
				child->getAttributeS32("width", columnwidth);
				columns[index]["width"] = columnwidth;
			}

			LLFontGL::HAlign h_align = LLFontGL::LEFT;
			h_align = LLView::selectFontHAlign(child);

			if(!columndynamicwidth) total_static += llmax(0, columnwidth);

			columns[index]["name"] = columnname;
			columns[index]["label"] = labelname;
			columns[index]["halign"] = (S32)h_align;
			columns[index]["dynamicwidth"] = columndynamicwidth;
			columns[index]["sort"] = sortname;

			index++;
		}
	}
	name_list->setTotalStaticColumnWidth(total_static);
	name_list->setColumnHeadings(columns);


	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
//.........这里部分代码省略.........
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:101,代码来源:llnamelistctrl.cpp


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