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


C++ KeyValue::AsShort方法代码示例

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


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

示例1: if

void KVReader2::Dump(KeyValue* inNode, unsigned int startAddress)
{
	KeyValue* cur = inNode;

	while(cur!=0) 
	{
	
		for(int i=0;i<cur->depth;i++)
		{
			printf("    ");
		}
		if(cur->key!=0)
		{
			//printf("= '%s' [%X] :",cur->key,cur->keyHash);
			printf("'%s' : ",cur->key);
		}
		else 
		{
			//printf(" : ");
		}
		if(cur->value != 0)
		{
			if(cur->type==NTRO_DATA_TYPE_HANDLE || cur->type==NTRO_DATA_TYPE_NAME)
			{
				printf("(str) '%s'",cur->AsHandle());
			}
			else if(cur->type==NTRO_DATA_TYPE_INTEGER)
			{
				printf("(int) %d",cur->AsInt());
			}
			else if(cur->type==NTRO_DATA_TYPE_UINTEGER)
			{
				printf("(uint) %u",cur->AsUint());
			}
			else if(cur->type==NTRO_DATA_TYPE_SHORT)
			{
				printf("(short) %d",cur->AsShort());
			}
			else if(cur->type==NTRO_DATA_TYPE_USHORT)
			{
				printf("(ushort) %u",cur->AsUshort());
			}
			else if(cur->type==NTRO_DATA_TYPE_BYTE)
			{
				printf("(byte) %2X",cur->AsByte());
			}
			else if(cur->type==NTRO_DATA_TYPE_BOOLEAN)
			{
				printf("(bool) %2X",cur->AsByte());
			}
			else if(cur->type==NTRO_DATA_TYPE_FLOAT)
			{
				printf("(float) %f",cur->AsFloat());
			}
			else if(cur->type==10)	// not sure what it is, but it's used as image format
			{
				printf("(format 10) %u",cur->AsByte());
			}
			else if(cur->type==NTRO_DATA_TYPE_VECTOR3)
			{
				glm::vec3 v(cur->AsVec3());
				printf("(vec3) [%f, %f, %f]",v[0],v[1],v[2]);
			}
			else if(cur->type==NTRO_DATA_TYPE_VECTOR4)
			{
				glm::vec4 v(cur->AsVec4());
				printf("(vec4) [%f, %f, %f, %f]",v[0],v[1],v[2],v[3]);
			}
			else if(cur->type==NTRO_DATA_TYPE_QUATERNION)
			{
				glm::vec4 v(cur->AsVec4());
				printf("(quat) [%f, %f, %f, %f]",v[0],v[1],v[2],v[3]);
			}
			else if(cur->type==NTRO_DATA_TYPE_COLOR)
			{
				glm::vec4 v(cur->AsVec4());
				printf("(color) [%f, %f, %f, %f]",v[0],v[1],v[2],v[3]);
			}
			else
			{
				printf("(unknown %d) %2X",cur->type, (unsigned int) cur->value);
			}
			
			printf(" @%X",(unsigned int)cur->value+16 - (unsigned int)startAddress);
		}
		else
		{
			printf("[%d/%d]",cur->childCount,cur->realChildCount);
			printf(" @%X",(unsigned int)cur->childCountAddress+16 - (unsigned int)startAddress);
		}
		printf("\n");
		
		Dump(cur->child, startAddress);
	
		cur = cur->sibling;
	
	}
	
}
开发者ID:d2armory,项目名称:flare,代码行数:99,代码来源:kvreader2.cpp


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