本文整理汇总了C++中TypeInfo::BaseInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeInfo::BaseInfo方法的具体用法?C++ TypeInfo::BaseInfo怎么用?C++ TypeInfo::BaseInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeInfo
的用法示例。
在下文中一共展示了TypeInfo::BaseInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Helper
static void Helper(CStateInfo& state, void* next, const string &nextName)
{
state.s += RepeatString("\t", state.depth);
state.s += "{\n";
state.depth++;
TypeInfo *typeInfo = TypeInfo::GetTypeInfo(nextName);
while (typeInfo)
{
map<string, PropertyInfo*> &props = typeInfo->Properties();
for (map<string, PropertyInfo*>::iterator i = props.begin(); i != props.end(); ++i)
{
map<string, PropertyInfo*>::iterator nextIter = ++i;
i--;
if (i->second->Integral())
{
if ( i->second->IsPointer() )
{
printf( "we are here ");
}
void *value = i->second->GetValue(next);
std::string stringTypeName = i->second->TypeName();
TypeInfo* _typeInfo = TypeInfo::GetTypeInfo(stringTypeName);
std::string stringValue = _typeInfo->GetString(value);
state.s += RepeatString("\t", state.depth) +
"\"" +
i->second->Name() +
"\" : \"" +
stringValue.c_str() +
"\"" +
RepeatString(",", typeInfo->BaseInfo() != 0 || nextIter != props.end()) +
"\n";
}
else if (i->second->IsArray())
{
state.s += RepeatString("\t", state.depth) +
"\"" +
i->second->Name() +
"\" : \n" +
RepeatString("\t", state.depth) +
"[\n";
state.depth++;
for (int j = 0; j < i->second->GetArraySize(next); j++)
{
void *value = i->second->GetValue(next, j);
char floatStr[256];
sprintf(floatStr, "%f", *(static_cast<float*>(value)));
state.s += RepeatString("\t", state.depth) +
"\"" +
floatStr +
"\"" +
RepeatString(",", j != i->second->GetArraySize(next) - 1 ) +
"\n";
delete value;
}
state.depth--;
state.s += RepeatString("\t", state.depth) +
"]" +
RepeatString(",", nextIter != props.end() || typeInfo->BaseInfo()) +
"\n";
}
else
{
state.s += RepeatString("\t", state.depth) +
"\"" +
i->second->Name() +
"\" : \n";
bool alreadySerialized = false;
bool nullPtr = false;
if ( i->second->IsPointer() )
{
if (i->second->GetValue(next) == 0)
nullPtr = true;
if (nullPtr)
{
state.s += "0";
}
else
{
alreadySerialized = state.addresTable.count( i->second->GetValue(next) ) == 1;
if (alreadySerialized)
{
state.s += "\"@ptr" +
To<int>::String( state.addresTable[ i->second->GetValue(next) ] ) +
"\",\n";
}
else
{
state.ptrCount++;
state.addresTable[ i->second->GetValue(next) ] = state.ptrCount;
state.s += RepeatString("\t", state.depth) +
"{\n" +
RepeatString("\t", state.depth + 1) +
"\"@ptr\" : " +
To<int>::String(state.ptrCount) +
",\n" +
RepeatString("\t", state.depth + 1) +
//.........这里部分代码省略.........