#include "stdafx.h" using namespace Jenga::Common; void SourceTemplate::Values::Insert( const std::string &tagName, const std::string &value ) { this->insert( Values::value_type( tagName, value ) ); } SourceTemplate::SourceTemplate( const std::string &filePath ) { Jenga::Common::File file = Jenga::Common::File( filePath ); source = file.Read(); } std::string SourceTemplate::GetResult( const std::map &values ) { std::string result = source; std::map::const_iterator it = values.begin(); while( it != values.end() ) { while( true ) { std::string::size_type index = result.find( it->first ); if( index == std::string::npos ) { break; } result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() ); } it++; } return result; }