MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / readDataTable

Method readDataTable

Engine/source/Verve/Core/VController.cpp:649–671  ·  view source on GitHub ↗

----------------------------------------------------------------------------- VController::readDataTable( pElement ); Read the DataTable from a TinyXML document. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

647//
648//-----------------------------------------------------------------------------
649bool VController::readDataTable( tinyxml2::XMLElement *pElement )
650{
651 tinyxml2::XMLElement *dataTableRoot = pElement->FirstChildElement( "DataTable" );
652 if ( dataTableRoot )
653 {
654 for ( tinyxml2::XMLElement *child = dataTableRoot->FirstChildElement(); child != NULL; child = child->NextSiblingElement() )
655 {
656 // Get Field Data.
657 const char *fieldType = child->Attribute( "Type" );
658 const char *fieldName = child->Attribute( "Name" );
659 const char *fieldValue = child->Attribute( "Value" );
660
661 // Add Data Item.
662 mDataTable.insert( VDataTable::getDataTypeEnum( fieldType ), fieldName );
663
664 // Set Field Value.
665 setDataField( StringTable->insert( fieldName ), NULL, fieldValue );
666 }
667 }
668
669 // Valid Read.
670 return true;
671}
672
673//-----------------------------------------------------------------------------
674//

Callers 1

readFunction · 0.45

Calls 4

FirstChildElementMethod · 0.80
NextSiblingElementMethod · 0.80
AttributeMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected