本文整理汇总了C++中SimObject::getFieldList方法的典型用法代码示例。如果您正苦于以下问题:C++ SimObject::getFieldList方法的具体用法?C++ SimObject::getFieldList怎么用?C++ SimObject::getFieldList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimObject
的用法示例。
在下文中一共展示了SimObject::getFieldList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setObjectAttributes
// -----------------------------------------------------------------------------
// Set attribute of top stack element to given value.
// -----------------------------------------------------------------------------
void SimXMLDocument::setObjectAttributes(const char* objectID)
{
if( !objectID || !objectID[0] )
return;
if(m_paNode.empty())
return;
SimObject *pObject = Sim::findObject( objectID );
if( pObject == NULL )
return;
const int iLastElement = m_paNode.size() - 1;
TiXmlElement* pElement = m_paNode[iLastElement];
if(!pElement)
return;
char textbuf[1024];
TiXmlElement field( "Field" );
TiXmlElement group( "FieldGroup" );
pElement->SetAttribute( "Name", pObject->getName() );
// Iterate over our filed list and add them to the XML document...
AbstractClassRep::FieldList fieldList = pObject->getFieldList();
AbstractClassRep::FieldList::iterator itr;
for(itr = fieldList.begin(); itr != fieldList.end(); itr++)
{
if( itr->type == AbstractClassRep::DepricatedFieldType ||
itr->type == AbstractClassRep::StartGroupFieldType ||
itr->type == AbstractClassRep::EndGroupFieldType) continue;
// Not an Array
if(itr->elementCount == 1)
{
// get the value of the field as a string.
ConsoleBaseType *cbt = ConsoleBaseType::getType(itr->type);
const char *val = Con::getData(itr->type, (void *) (((const char *)pObject) + itr->offset), 0, itr->table, itr->flag);
// Make a copy for the field check.
if (!val)
continue;
FrameTemp<char> valCopy( dStrlen( val ) + 1 );
dStrcpy( (char *)valCopy, val );
if (!pObject->writeField(itr->pFieldname, valCopy))
continue;
val = valCopy;
expandEscape(textbuf, val);
if( !pObject->writeField( itr->pFieldname, textbuf ) )
continue;
field.SetValue( "Property" );
field.SetAttribute( "name", itr->pFieldname );
if( cbt != NULL )
field.SetAttribute( "type", cbt->getTypeName() );
else
field.SetAttribute( "type", "TypeString" );
field.SetAttribute( "data", textbuf );
pElement->InsertEndChild( field );
continue;
}
}
//// IS An Array
//for(U32 j = 0; S32(j) < f->elementCount; j++)
//{
// // If the start of a group create an element for the group and
// // the our chache to it
// const char *val = Con::getData(itr->type, (void *) (((const char *)pObject) + itr->offset), j, itr->table, itr->flag);
// // Make a copy for the field check.
// if (!val)
// continue;
// FrameTemp<char> valCopy( dStrlen( val ) + 1 );
// dStrcpy( (char *)valCopy, val );
// if (!pObject->writeField(itr->pFieldname, valCopy))
// continue;
// val = valCopy;
// // get the value of the field as a string.
// ConsoleBaseType *cbt = ConsoleBaseType::getType(itr->type);
// const char * dstr = Con::getData(itr->type, (void *)(((const char *)pObject) + itr->offset), 0, itr->table, itr->flag);
//.........这里部分代码省略.........