source: dev/branches/egtra/ab5.0/jenga/src/common/SourceTemplate.cpp@ 820

Last change on this file since 820 was 625, checked in by dai_9181, 16 years ago

・WindowInfoクラスをリファクタリング
・MdiInfoを単純配列からvectorに変更した。

File size: 895 bytes
Line 
1#include "stdafx.h"
2
3using namespace Jenga::Common;
4
5void SourceTemplate::Values::Insert( const std::string &tagName, const std::string &value )
6{
7 this->insert( Values::value_type(
8 tagName,
9 value
10 ) );
11}
12
13SourceTemplate::SourceTemplate( const std::string &filePath )
14{
15 Jenga::Common::File file = Jenga::Common::File( filePath );
16 source = file.Read();
17}
18std::string SourceTemplate::GetResult( const std::map<std::string,std::string> &values )
19{
20 std::string result = source;
21
22 std::map<std::string,std::string>::const_iterator it = values.begin();
23 while( it != values.end() )
24 {
25 while( true )
26 {
27 std::string::size_type index = result.find( it->first );
28 if( index == std::string::npos )
29 {
30 break;
31 }
32
33 result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() );
34 }
35 it++;
36 }
37
38 return result;
39}
Note: See TracBrowser for help on using the repository browser.