----------------------------------------------------------------------------- VController::writeDataTable( pElement ); Write the DataTable out to a TinyXML document. -----------------------------------------------------------------------------
| 607 | // |
| 608 | //----------------------------------------------------------------------------- |
| 609 | bool VController::writeDataTable( TiXmlElement *pElement ) |
| 610 | { |
| 611 | // Create Data Table Root. |
| 612 | TiXmlElement *dataTableRoot = new TiXmlElement( "DataTable" ); |
| 613 | pElement->LinkEndChild( dataTableRoot ); |
| 614 | |
| 615 | for ( VDataTable::VDataMap::Iterator itr = mDataTable.mDataMap.begin(); itr != mDataTable.mDataMap.end(); ++itr ) |
| 616 | { |
| 617 | // Fetch Data. |
| 618 | VDataTable::sDataItem *data = &itr->value; |
| 619 | |
| 620 | // Create Element. |
| 621 | TiXmlElement *dataElement = new TiXmlElement( "DataItem" ); |
| 622 | |
| 623 | // Apply Attributes. |
| 624 | dataElement->SetAttribute( "Type", VDataTable::getDataTypeDescription( data->Type ) ); |
| 625 | dataElement->SetAttribute( "Name", data->FieldName ); |
| 626 | dataElement->SetAttribute( "Value", getDataField( StringTable->insert( data->FieldName.c_str() ), NULL ) ); |
| 627 | |
| 628 | // Add. |
| 629 | dataTableRoot->LinkEndChild( dataElement ); |
| 630 | } |
| 631 | |
| 632 | return true; |
| 633 | } |
| 634 | |
| 635 | //----------------------------------------------------------------------------- |
| 636 | // |