Index: trunk/ab5.0/jenga/include/MyAssert.h
===================================================================
--- trunk/ab5.0/jenga/include/MyAssert.h	(revision 825)
+++ trunk/ab5.0/jenga/include/MyAssert.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/Binary.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Binary.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Binary.h	(revision 828)
@@ -1,2 +1,5 @@
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/split_member.hpp>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h
===================================================================
--- trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h	(revision 828)
@@ -1,2 +1,5 @@
+#include <iosfwd>
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/CmdLine.h
===================================================================
--- trunk/ab5.0/jenga/include/common/CmdLine.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/CmdLine.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/Directory.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Directory.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Directory.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/EasyToken.h
===================================================================
--- trunk/ab5.0/jenga/include/common/EasyToken.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/EasyToken.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/Environment.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Environment.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Environment.h	(revision 828)
@@ -1,2 +1,6 @@
+#include <string>
+#include <windows.h>
+#include <shlobj.h>
+
 #pragma once
 
@@ -4,5 +8,4 @@
 namespace Common{
 
-#pragma warning(disable : 4996)
 
 class Environment
Index: trunk/ab5.0/jenga/include/common/Exception.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Exception.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Exception.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/File.h
===================================================================
--- trunk/ab5.0/jenga/include/common/File.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/File.h	(revision 828)
@@ -1,4 +1,6 @@
+#include <string>
+#include <Windows.h>
+
 #pragma once
-#pragma warning(disable : 4996)
 
 
Index: trunk/ab5.0/jenga/include/common/FileSystem.h
===================================================================
--- trunk/ab5.0/jenga/include/common/FileSystem.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/FileSystem.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/Hashmap.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Hashmap.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Hashmap.h	(revision 828)
@@ -1,2 +1,11 @@
+#include <stdexcept>
+#include <unordered_set>
+#include <boost/range/algorithm.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/cast.hpp>
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/split_member.hpp>
+
 #pragma once
 
@@ -5,24 +14,38 @@
 namespace Common{
 
+template<class T>
+class ObjectInHashmap;
+template<class T>
+struct ObjectInHashmapHash;
+template<class T>
+struct ObjectInHashmapEqualTo;
 
 #define MAX_HASHMAP 65535
-template<class T> class Hashmap
-{
-	T* hashArray[MAX_HASHMAP];
+template<class T> class Hashmap : boost::noncopyable
+{
+	typedef std::unordered_set<ObjectInHashmap<T>*, ObjectInHashmapHash<T>, ObjectInHashmapEqualTo<T>> MapType;
+	MapType map;
+
+	struct downcast
+	{
+		typedef T* result_type;
+		T* operator ()(ObjectInHashmap<T>* p) const
+		{
+			return boost::polymorphic_cast<T*>(p);
+		}
+	};
+	struct const_downcast
+	{
+		typedef T const* result_type;
+		T const* operator ()(ObjectInHashmap<T> const* p) const
+		{
+			return boost::polymorphic_cast<T const*>(p);
+		}
+	};
 
 public:
-	virtual int GetHash( const char *keyName ) const
-	{
-		int key;
-		for(key=0;*keyName!='\0';keyName++){
-			key=((key<<8)+ *keyName )%MAX_HASHMAP;
-		}
-		return key;
-	}
 
 	Hashmap()
-		: isIteratorReady( false )
-	{
-		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
+	{
 	}
 	~Hashmap()
@@ -32,13 +55,6 @@
 	void Clear()
 	{
-		for( int i=0; i<MAX_HASHMAP; i++ )
-		{
-			T* temp = hashArray[i];
-			if( temp )
-			{
-				delete temp;
-			}
-		}
-		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
+		boost::for_each(*this, boost::checked_deleter<T const>());
+		map.clear();
 	}
 
@@ -46,114 +62,52 @@
 	void PullOutAll()
 	{
-		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
-	}
-
-	bool Put( T* value )
-	{
-		int key = GetHash( value->GetKeyName().c_str() );
-
-		if(hashArray[key]){
-			T *temp = hashArray[key];
-			while( true ){
-				if( temp->IsDuplication( value ) )
-				{
-					// 重複している
-					return false;
-				}
-
-				if( temp->GetChainNext() == NULL )
-				{
-					break;
-				}
-				temp = temp->GetChainNext();
-			}
-			temp->SetChainNext( value );
-		}
-		else{
-			hashArray[key] = value;
-		}
-
-		return true;
-	}
-
-	T* GetHashArrayElement( const char *keyName )
-	{
-		return hashArray[GetHash(keyName)];
-	}
-	const T* GetHashArrayElement( const char *keyName ) const
-	{
-		return hashArray[GetHash(keyName)];
-	}
-
-	bool IsExistDuplicationKeyName( const std::string &keyName ) const
-	{
-		int key = GetHash( keyName.c_str() );
-
-		if(hashArray[key]){
-			const T *temp = hashArray[key];
-			while( true ){
-				if( temp->IsDuplication( keyName ) )
-				{
-					// 重複している
-					return true;
-				}
-
-				if( temp->GetChainNext() == NULL )
-				{
-					break;
-				}
-				temp = temp->GetChainNext();
-			}
-		}
-
-		return false;
+		map.clear();
+	}
+
+	bool Put(T* value)
+	{
+		if (value == nullptr)
+		{
+			throw std::invalid_argument("Hashmap::Put");
+		}
+		return map.insert(value).second;
+	}
+
+	typedef boost::transform_iterator<downcast, typename MapType::local_iterator> local_iterator;
+	typedef boost::transform_iterator<const_downcast, typename MapType::const_local_iterator> const_local_iterator;
+
+	boost::iterator_range<local_iterator> GetHashArrayElement(std::string const& keyName)
+	{
+		ObjectInHashmapDummy<T> t(keyName);
+		return boost::iterator_range<local_iterator>(
+			local_iterator(map.begin(map.bucket(&t)), downcast()),
+			local_iterator(map.end(map.bucket(&t)), downcast()));
+	}
+
+	boost::iterator_range<const_local_iterator> GetHashArrayElement(std::string const& keyName) const
+	{
+		ObjectInHashmapDummy<T> t(keyName);
+		return boost::iterator_range<const_local_iterator>(
+			const_local_iterator(map.begin(map.bucket(&t)), const_downcast()),
+			const_local_iterator(map.end(map.bucket(&t)), const_downcast()));
+	}
+
+	bool IsExistDuplicationKeyName(const std::string &keyName) const
+	{
+		ObjectInHashmapDummy<T> t(keyName);
+		return map.find(&t) != map.end();
 	}
 
 	bool IsExist( const T* value ) const
 	{
-		int key = GetHash( value->GetKeyName().c_str() );
-
-		if(hashArray[key]){
-			const T *temp = hashArray[key];
-			while( true ){
-				if( temp->IsDuplication( value ) )
-				{
-					// 重複している
-					return true;
-				}
-
-				if( temp->GetChainNext() == NULL )
-				{
-					break;
-				}
-				temp = temp->GetChainNext();
-			}
-		}
-
-		return false;
-	}
-
-	const T *FindLike( const T* value ) const
-	{
-		int key = GetHash( value->GetKeyName().c_str() );
-
-		if(hashArray[key]){
-			const T *temp = hashArray[key];
-			while( true ){
-				if( temp->IsDuplication( value ) )
-				{
-					// 重複している
-					return temp;
-				}
-
-				if( temp->GetChainNext() == NULL )
-				{
-					break;
-				}
-				temp = temp->GetChainNext();
-			}
-		}
-
-		return NULL;
+		return map.find(const_cast<T*>(value)) != map.end();
+	}
+
+	const T *FindLike( const ObjectInHashmap<T>* value ) const
+	{
+		auto it = map.find(const_cast<ObjectInHashmap<T>*>(value));
+		return it != map.end()
+			? boost::polymorphic_downcast<T const*>(*it)
+			: nullptr;
 	}
 
@@ -162,49 +116,25 @@
 	// イテレータ
 	/////////////////////////////////////////////////////////////////
-private:
-	mutable std::vector<T*> iterator_Objects;
-	mutable int iterator_CurrentNext;
-	mutable bool isIteratorReady;
-public:
-	void Iterator_Init() const
-	{
-		iterator_Objects.clear();
-		iterator_CurrentNext = 0;
-
-		for( int i=0; i<MAX_HASHMAP; i++ ){
-			if( hashArray[i] ){
-				T* temp = hashArray[i];
-				while( temp )
-				{
-					iterator_Objects.push_back( temp );
-
-					temp = (T*)temp->GetChainNext();
-				}
-			}
-		}
-
-		isIteratorReady = true;
-	}
-	void Iterator_Reset() const
-	{
-		if( !isIteratorReady )
-		{
-			Jenga::Throw( "イテレータの準備ができていない" );
-		}
-		iterator_CurrentNext = 0;
-	}
-	bool Iterator_HasNext() const
-	{
-		return ( iterator_CurrentNext < (int)iterator_Objects.size() );
-	}
-	T *Iterator_GetNext() const
-	{
-		return iterator_Objects[iterator_CurrentNext++];
-	}
-	int Iterator_GetMaxCount() const
-	{
-		return (int)iterator_Objects.size();
-	}
-
+	//typedef boost::transform_iterator<downcast, typename MapType::iterator> iterator;
+	typedef boost::transform_iterator<downcast, typename MapType::const_iterator> const_iterator;
+	typedef const_iterator iterator;
+	typedef typename MapType::size_type size_type;
+	typedef typename MapType::difference_type difference_type;
+	//iterator begin()
+	//{
+	//	return iterator(map.begin(), downcast());
+	//}
+	//iterator end()
+	//{
+	//	return iterator(map.end(), downcast());
+	//}
+	const_iterator begin() const
+	{
+		return const_iterator(map.begin(), downcast());
+	}
+	const_iterator end() const
+	{
+		return const_iterator(map.end(), downcast());
+	}
 
 	// XMLシリアライズ用
@@ -215,46 +145,27 @@
 	{
 		std::vector<T *> objects;
-		ar & BOOST_SERIALIZATION_NVP( objects );
-
-		// 読み込み後の処理
+		ar & BOOST_SERIALIZATION_NVP(objects);
 		Clear();
-		BOOST_FOREACH( T *object, objects )
-		{
-			Put( object );
-		}
-		Iterator_Init();
+		map = boost::copy_range<MapType>(objects);
 	}
 	template<class Archive> void save(Archive& ar, const unsigned int version) const
 	{
-		// 保存準備
-		std::vector<T *> objects;
-		objects.clear();
-		Iterator_Reset();
-		while( Iterator_HasNext() )
-		{
-			objects.push_back( Iterator_GetNext() );
-		}
-
-		ar & BOOST_SERIALIZATION_NVP( objects );
-	}
-};
-
-template<class T> class ObjectInHashmap
-{
-	T *pNextObject;
+		std::vector<T *> objects(begin(), end());
+		ar & BOOST_SERIALIZATION_NVP(objects);
+	}
+};
+
+template<class T>
+class ObjectInHashmap
+{
+protected:
+	ObjectInHashmap()
+	{
+	}
+	~ObjectInHashmap()
+	{
+	}
+
 public:
-
-	ObjectInHashmap()
-		: pNextObject( NULL )
-	{
-	}
-	~ObjectInHashmap()
-	{
-		if( pNextObject )
-		{
-			delete pNextObject;
-		}
-	}
-
 	virtual const std::string &GetKeyName() const = 0;
 	virtual bool IsDuplication( const T *value ) const
@@ -266,16 +177,54 @@
 		return ( GetKeyName() == keyName );
 	}
-
-	T *GetChainNext()
-	{
-		return pNextObject;
-	}
-	const T *GetChainNext() const
-	{
-		return pNextObject;
-	}
-	void SetChainNext( T *pNextObject )
-	{
-		this->pNextObject = pNextObject;
+};
+
+template<class T>
+struct ObjectInHashmapHash
+{
+	typedef std::size_t result_type;
+	std::size_t operator ()(ObjectInHashmap<T> const* x) const
+	{
+		return std::hash<std::string>()(x->GetKeyName());
+	}
+};
+
+// GetHashArrayElementなどで文字列から検索するために用いる。
+template<class T>
+class ObjectInHashmapDummy : public ObjectInHashmap<T>, boost::noncopyable
+{
+public:
+	explicit ObjectInHashmapDummy(std::string const& s) : str(s) {}
+
+	virtual std::string const& GetKeyName() const override
+	{
+		return str;
+	}
+
+	virtual bool IsDuplication(T const* value) const override
+	{
+		return value != nullptr
+			&& value->ObjectInHashmap<T>::IsDuplication(str);
+	}
+
+private:
+	std::string const& str;
+};
+
+template<class T>
+struct ObjectInHashmapEqualTo
+{
+	typedef bool result_type;
+	bool operator ()(_In_ ObjectInHashmap<T> const* lhs, _In_ ObjectInHashmap<T> const* rhs) const
+	{
+		assert(lhs != nullptr);
+		assert(rhs != nullptr);
+		if (auto pl = dynamic_cast<T const*>(rhs))
+		{
+			return lhs->IsDuplication(pl);
+		}
+		else
+		{
+			return rhs->IsDuplication(dynamic_cast<T const*>(lhs));
+		}
 	}
 };
Index: trunk/ab5.0/jenga/include/common/Path.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Path.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/Path.h	(revision 828)
@@ -1,2 +1,4 @@
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/SourceTemplate.h
===================================================================
--- trunk/ab5.0/jenga/include/common/SourceTemplate.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/SourceTemplate.h	(revision 828)
@@ -1,2 +1,5 @@
+#include <map>
+#include <string>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/String.h
===================================================================
--- trunk/ab5.0/jenga/include/common/String.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/String.h	(revision 828)
@@ -1,2 +1,5 @@
+#include <string>
+#include <vector>
+
 #pragma once
 
Index: trunk/ab5.0/jenga/include/common/VectorSupporter.h
===================================================================
--- trunk/ab5.0/jenga/include/common/VectorSupporter.h	(revision 825)
+++ trunk/ab5.0/jenga/include/common/VectorSupporter.h	(revision 828)
@@ -7,12 +7,5 @@
 template<class T> void EraseVectorItem( T &v, int index )
 {
-	T::iterator it = v.begin();
-	int i = 0;
-	while( i < index )
-	{
-		i ++;
-		it ++;
-	}
-	v.erase( it );
+	v.erase(v.begin() + index);
 }
 
Index: trunk/ab5.0/jenga/projects/jenga/jenga.vcproj
===================================================================
--- trunk/ab5.0/jenga/projects/jenga/jenga.vcproj	(revision 825)
+++ 	(revision )
@@ -1,413 +1,0 @@
-<?xml version="1.0" encoding="shift_jis"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="jenga"
-	ProjectGUID="{F01805B6-65B4-4708-88F4-A5E07DEA9FBD}"
-	RootNamespace="common"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			ConfigurationType="4"
-			InheritedPropertySheets="..\..\..\abdev\ab-common-32.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			ConfigurationType="4"
-			InheritedPropertySheets="..\..\..\abdev\ab-common-64.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\;..\..\..\cpplibs\boost"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			ConfigurationType="4"
-			InheritedPropertySheets="..\..\..\abdev\ab-common-32.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="0"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories=""
-				RuntimeLibrary="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			ConfigurationType="4"
-			InheritedPropertySheets="..\..\..\abdev\ab-common-64.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="0"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories=""
-				RuntimeLibrary="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="ソース ファイル"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\..\src\common\CmdLine.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\Directory.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\EasyToken.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\Exception.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\FileSystem.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\MyAssert.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\Path.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\src\common\SourceTemplate.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\stdafx.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\src\common\String.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="ヘッダー ファイル"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\include\common\Binary.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\BoostSerializationSupport.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\CmdLine.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\Directory.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\EasyToken.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\Environment.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\Exception.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\File.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\FileSystem.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\Hashmap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\jenga.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\MyAssert.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\Path.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\SourceTemplate.h"
-				>
-			</File>
-			<File
-				RelativePath=".\stdafx.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\String.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\common\VectorSupporter.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="リソース ファイル"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj
===================================================================
--- trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj	(revision 828)
+++ trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj	(revision 828)
@@ -0,0 +1,170 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{F01805B6-65B4-4708-88F4-A5E07DEA9FBD}</ProjectGuid>
+    <RootNamespace>common</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\..\..\abdev\ab-common.props" />
+    <Import Project="..\..\..\abdev\ab-common-32.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\..\..\abdev\ab-common.props" />
+    <Import Project="..\..\..\abdev\ab-common-32.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\..\..\abdev\ab-common.props" />
+    <Import Project="..\..\..\abdev\ab-common-64.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\..\..\abdev\ab-common.props" />
+    <Import Project="..\..\..\abdev\ab-common-64.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\lib\x86\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)-$(Platform)\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\lib\x64\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)-$(Platform)\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\lib\x86\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)-$(Platform)\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\lib\x64\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)-$(Platform)\</IntDir>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)d</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)d</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Lib />
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Lib />
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Lib />
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Lib />
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\common\CmdLine.cpp" />
+    <ClCompile Include="..\..\src\common\Directory.cpp" />
+    <ClCompile Include="..\..\src\common\EasyToken.cpp" />
+    <ClCompile Include="..\..\src\common\Exception.cpp" />
+    <ClCompile Include="..\..\src\common\FileSystem.cpp" />
+    <ClCompile Include="..\..\src\MyAssert.cpp" />
+    <ClCompile Include="..\..\src\common\Path.cpp" />
+    <ClCompile Include="..\..\src\common\SourceTemplate.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\String.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\include\common\Binary.h" />
+    <ClInclude Include="..\..\include\common\BoostSerializationSupport.h" />
+    <ClInclude Include="..\..\include\common\CmdLine.h" />
+    <ClInclude Include="..\..\include\common\Directory.h" />
+    <ClInclude Include="..\..\include\common\EasyToken.h" />
+    <ClInclude Include="..\..\include\common\Environment.h" />
+    <ClInclude Include="..\..\include\common\Exception.h" />
+    <ClInclude Include="..\..\include\common\File.h" />
+    <ClInclude Include="..\..\include\common\FileSystem.h" />
+    <ClInclude Include="..\..\include\common\Hashmap.h" />
+    <ClInclude Include="..\..\include\jenga.h" />
+    <ClInclude Include="..\..\include\MyAssert.h" />
+    <ClInclude Include="..\..\include\common\Path.h" />
+    <ClInclude Include="..\..\include\common\SourceTemplate.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="..\..\include\common\String.h" />
+    <ClInclude Include="..\..\include\common\VectorSupporter.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
Index: trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj.filters
===================================================================
--- trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj.filters	(revision 828)
+++ trunk/ab5.0/jenga/projects/jenga/jenga.vcxproj.filters	(revision 828)
@@ -0,0 +1,102 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\common\CmdLine.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\Directory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\EasyToken.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\Exception.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\FileSystem.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\MyAssert.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\Path.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\SourceTemplate.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\String.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\include\common\Binary.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\BoostSerializationSupport.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\CmdLine.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\Directory.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\EasyToken.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\Environment.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\Exception.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\File.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\FileSystem.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\Hashmap.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\jenga.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\MyAssert.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\Path.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\SourceTemplate.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\String.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\common\VectorSupporter.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
Index: trunk/ab5.0/jenga/projects/jenga/stdafx.h
===================================================================
--- trunk/ab5.0/jenga/projects/jenga/stdafx.h	(revision 825)
+++ trunk/ab5.0/jenga/projects/jenga/stdafx.h	(revision 828)
@@ -1,4 +1,5 @@
 #pragma once
 
+#include <algorithm>
 #include <map>
 #include <string>
@@ -21,6 +22,7 @@
 #include <assert.h>
 
-//boost libraries
 #include <boost/foreach.hpp>
+#include <boost/implicit_cast.hpp>
+#include <boost/range/algorithm.hpp>
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/nvp.hpp>
Index: trunk/ab5.0/jenga/src/common/String.cpp
===================================================================
--- trunk/ab5.0/jenga/src/common/String.cpp	(revision 825)
+++ trunk/ab5.0/jenga/src/common/String.cpp	(revision 828)
@@ -1,84 +1,100 @@
 #include "stdafx.h"
-#include <algorithm>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/algorithm/string/replace.hpp>
 
-bool Jenga::Common::IsExistString( const Jenga::Common::Strings &strings, const std::string &findStr )
+using boost::numeric_cast;
+using boost::implicit_cast;
+
+bool Jenga::Common::IsExistString(const Jenga::Common::Strings &strings, const std::string &findStr)
 {
-	return std::find( strings.begin(), strings.end(), findStr ) != strings.end();
+	return boost::find(strings, findStr) != strings.end();
 }
 
-std::string& Jenga::Common::StringReplace( std::string& str, const std::string &sb, const std::string &sa )
+std::string& Jenga::Common::StringReplace(std::string& str, const std::string &sb, const std::string &sa)
 {
-	std::string::size_type n, nb = 0;
-	
-	while ((n = str.find(sb,nb)) != std::string::npos)
-	{
-		str.replace(n,sb.size(),sa);
-		nb = n + sa.size();
-	}
-	
+	boost::algorithm::replace_all(str, sb, sa);
 	return str;
 }
 
-std::string Jenga::Common::ToString( int n )
+std::string Jenga::Common::ToString(int n)
 {
-	char temp[255];
-	wsprintf( temp, "%d", n );
-	return temp;
+	// VC++ 2010だとこのキャストが必要。
+	return std::to_string(implicit_cast<long long>(n));
 }
 
 std::string Jenga::Common::ToString( const std::wstring &wstr )
 {
-	int needSize = 	WideCharToMultiByte(
-		CP_THREAD_ACP,
+	if (wstr.empty())
+	{
+		return std::string();
+	}
+	int srcSize = numeric_cast<int>(wstr.size());
+	int needSize = WideCharToMultiByte(
+		CP_ACP,
 		0,
-		wstr.data(), static_cast<int>(wstr.size()),
-		NULL, NULL,
-		NULL, NULL );
+		wstr.data(), srcSize,
+		nullptr, 0,
+		nullptr, nullptr);
+	if (needSize <= 0)
+	{
+		throw std::runtime_error("WideCharToMultiByte error");
+	}
 
-	char *pstr = (char *)calloc( needSize, 1 );
-	WideCharToMultiByte(
-		CP_THREAD_ACP,
+	std::string ret(needSize, '\0');
+	int res = WideCharToMultiByte(
+		CP_ACP,
 		0,
-		wstr.data(), static_cast<int>(wstr.size()),
-		pstr, needSize,
-		NULL, NULL );
+		wstr.data(), srcSize,
+		&ret[0], needSize,
+		nullptr, nullptr);
+	if (res <= 0)
+	{
+		throw std::runtime_error("WideCharToMultiByte error");
+	}
 
-	std::string result(pstr, needSize);
-
-	free( pstr );
-
-	return result;
+	return ret;
 }
 
-std::wstring Jenga::Common::ToWString( const std::string &str )
+std::wstring Jenga::Common::ToWString(const std::string &str)
 {
-	int size = MultiByteToWideChar(
+	if (str.empty())
+	{
+		return std::wstring();
+	}
+	int srcSize = numeric_cast<int>(str.size());
+	int needSize = MultiByteToWideChar(
 		CP_ACP,
 		0,
-		str.data(), static_cast<int>(str.size()),
-		NULL, 0 );
+		str.data(), srcSize,
+		nullptr, 0);
+	if (needSize <= 0)
+	{
+		throw std::runtime_error("WideCharToMultiByte error");
+	}
 
-	LPWSTR pwstr = (LPWSTR)calloc( size, sizeof (wchar_t) );
-
-	MultiByteToWideChar(
+	std::wstring ret(needSize, L'\0');
+	int res = MultiByteToWideChar(
 		CP_ACP,
 		0,
-		str.data(), static_cast<int>(str.size()),
-		pwstr, size );
+		str.data(), srcSize,
+		&ret[0], needSize);
+	if (res <= 0)
+	{
+		throw std::runtime_error("WideCharToMultiByte error");
+	}
 
-	std::wstring wstr( pwstr, size );
-
-	free( pwstr );
-
-	return wstr;
+	return ret;
 }
 
 bool Jenga::Common::IsIdentifierTopChar( char c )
 {
-	return ( isalpha( c ) || c == '_' );
+	return ('A' <= c && c <= 'Z')
+		|| ('a' <= c && c <= 'z')
+		|| c == '_' ;
 }
 
 bool Jenga::Common::IsIdentifierChar( char c )
 {
-	return ( IsIdentifierTopChar( c ) || isdigit( c ) );
+	return IsIdentifierTopChar(c)
+		|| ('0' <= c && c <= '9');
 }
