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


C++ Pixel::loadXml方法代码示例

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


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

示例1: readXml

bool Scene::readXml(TiXmlElement* e)
{
	string objName;

	TiXmlElement* child = e->FirstChildElement();
	while(child != NULL)
	{
		if(child->ValueStr() == "pixel")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
			{
				Pixel* p = new Pixel(objName, getOscRootAddress());
				p->loadXml(child);
				addObject(p);
				
				LOG_DEBUG << "Scene \"" << _name << "\": Loaded pixel \"" << objName << "\" \""
						  << p->getOscRootAddress() << "\"" << std::endl;
			}
			else
			{
				LOG_WARN << "Scene \"" << _name << "\": cannot load pixel without name, line "
						 << child->Row() << endl;
			}
		}

		else if(child->ValueStr() == "line")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
			{						  
				Line* l = new Line(objName, getOscRootAddress());
				l->loadXml(child);
				addObject(l);
				
				LOG_DEBUG << "Scene \"" << _name << "\": Loaded line \"" << objName << "\" \""
						  << l->getOscRootAddress() << "\"" << std::endl;
			}
			else
			{
				LOG_WARN << "Scene \"" << _name << "\": cannot load line without name, line "
						 << child->Row() << endl;
			}
		}

		else if(child->ValueStr() == "rect")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
			{
				Rect* r = new Rect(objName, getOscRootAddress());
				r->loadXml(child);
				addObject(r);
				
				LOG_DEBUG << "Scene \"" << _name << "\": Loaded rect \"" << objName << "\" \""
						  << r->getOscRootAddress() << "\"" << std::endl;
			}
			else
			{
				LOG_WARN << "Scene \"" << _name << "\": cannot load rect without name, line "
						 << child->Row() << endl;
			}
		}

		else if(child->ValueStr() == "bitmap")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
			{
				Bitmap* b = new Bitmap(objName, getOscRootAddress());
				b->loadXml(child);
				addObject(b);
				
				LOG_DEBUG << "Scene \"" << _name << "\": Loaded bitmap \"" << objName << "\" \""
						  << b->getOscRootAddress() << "\"" << std::endl;
			}
			else
			{
				LOG_WARN << "Scene \"" << _name << "\": cannot load bitmap without name, line "
						 << child->Row() << endl;
			}
		}

		else if(child->ValueStr() == "sprite")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
			{
				Sprite* s = new Sprite(objName, getOscRootAddress());
				s->loadXml(child);
				addObject(s);
				
				LOG_DEBUG << "Scene \"" << _name << "\": Loaded sprite \"" << objName << "\" \""
						  << s->getOscRootAddress() << "\"" << std::endl;
			}
			else
			{
				LOG_WARN << "Scene \"" << _name << "\": cannot load sprite without name, line "
						 << child->Row() << endl;
			}
		}
		
		else if(child->ValueStr() == "image")
		{
			if((objName = Xml::getAttrString(child, "name")) != "")
//.........这里部分代码省略.........
开发者ID:danomatika,项目名称:rc-visual,代码行数:101,代码来源:Scene.cpp


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