Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp	(revision 728)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp	(revision 735)
@@ -1,4 +1,5 @@
 #include "stdafx.h"
-
+#include <algorithm>
+#include <boost/checked_delete.hpp>
 
 CClass::CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces )
@@ -74,27 +75,14 @@
 CClass::~CClass()
 {
+	using std::for_each;
+	using boost::checked_deleter;
 	// 動的メンバ
-	BOOST_FOREACH( Member *member, dynamicMembers )
-	{
-		delete member;
-	}
-
+	for_each( dynamicMembers.begin(), dynamicMembers.end(), checked_deleter<Member>() );
 	// 静的メンバ
-	BOOST_FOREACH( Member *member, staticMembers )
-	{
-		delete member;
-	}
-
+	for_each( staticMembers.begin(), staticMembers.end(), checked_deleter<Member>() );
 	// インターフェイス
-	BOOST_FOREACH( ::Interface *pInterface, interfaces )
-	{
-		delete pInterface;
-	}
-
+	for_each( interfaces.begin(), interfaces.end(), checked_deleter<::Interface>() );
 	// テンプレート展開済みのクラス
-	BOOST_FOREACH( ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses )
-	{
-		delete pExpandedTemplateClass;
-	}
+	for_each( expandedTemplateClasses.begin(), expandedTemplateClasses.end(), checked_deleter<ExpandedTemplateClass>() );
 }
 
@@ -233,5 +221,7 @@
 {
 	//メソッドをコピー
-	BOOST_FOREACH( const CMethod *pBaseMethod, inheritsClass.GetDynamicMethods() ){
+	const Methods& inheritsClassMethods = inheritsClass.GetDynamicMethods();
+	GetDynamicMethods().reserve( inheritsClassMethods.size() );
+	BOOST_FOREACH( const CMethod *pBaseMethod, inheritsClassMethods ){
 		CMethod *pMethod = new DynamicMethod( *pBaseMethod );
 
@@ -264,5 +254,7 @@
 
 	// インターフェイスを引き継ぐ
-	BOOST_FOREACH( ::Interface *pInterface, inheritsClass.GetInterfaces() )
+	const Interfaces& inheritsClassInterfaces = inheritsClass.GetInterfaces();
+	interfaces.reserve( inheritsClassInterfaces.size() );
+	BOOST_FOREACH( const ::Interface *pInterface, inheritsClassInterfaces )
 	{
 		interfaces.push_back( new ::Interface( *pInterface ) );
@@ -307,5 +299,5 @@
 	//メソッド
 	BOOST_FOREACH( const CMethod *pMethod, GetDynamicMethods() ){
-		if( lstrcmp( name, pMethod->GetUserProc().GetName().c_str() ) == 0 ){
+		if(  name == pMethod->GetUserProc().GetName() ){
 			return 1;
 		}
@@ -328,5 +320,5 @@
 
 	// 動的メンバ
-	BOOST_FOREACH( Member *pMember, dynamicMembers )
+	BOOST_FOREACH( const Member *pMember, dynamicMembers )
 	{
 		if( GetName() == pMember->GetName() )
@@ -438,9 +430,10 @@
 		if( this->HasSuperClass() )
 		{
+			const CClass& super = this->GetSuperClass();
 			// 基底クラスのサイズを追加
-			resultSize += this->GetSuperClass().GetSize();
+			resultSize += super.GetSize();
 
 			// 基底クラスのアラインメントを取得
-			alignment = this->GetSuperClass().GetAlignment();
+			alignment = super.GetAlignment();
 		}
 		else
@@ -455,13 +448,14 @@
 	BOOST_FOREACH( Member *pMember, dynamicMembers )
 	{
+		const Type& memberType = pMember->GetType();
 		// メンバサイズ
-		int tempMemberSize = pMember->GetType().GetSize();
+		int tempMemberSize = memberType.GetSize();
 
 		// 一時アラインメントを算出
 		int tempAlignment = tempMemberSize;
-		if( pMember->GetType().IsStruct() )
+		if( memberType.IsStruct() )
 		{
 			// メンバが構造体の場合は、メンバのアラインメントを取得
-			tempAlignment = pMember->GetType().GetClass().GetAlignment();
+			tempAlignment = memberType.GetClass().GetAlignment();
 		}
 
@@ -484,5 +478,5 @@
 			if( tempMemberSize == 0 )
 			{
-				if( !pMember->GetType().IsStruct() )
+				if( !memberType.IsStruct() )
 				{
 					throw;
@@ -847,8 +841,8 @@
 		if( result.size() )
 		{
-			result += ",";
-		}
-
-		result += "\"" + pMember->GetName() + "\"";
+			result += ',';
+		}
+
+		result += '\"' + pMember->GetName() + '\"';
 	}
 
@@ -863,5 +857,5 @@
 		if( result.size() )
 		{
-			result += ",";
+			result += ',';
 		}
 
@@ -869,5 +863,5 @@
 
 		char temporary[255];
-		itoa( offset, temporary, 16 );
+		_itoa( offset, temporary, 16 );
 
 		result += (std::string)"&H" + temporary;
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp	(revision 728)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp	(revision 735)
@@ -6,12 +6,12 @@
 
 class CDefine{
-	std::vector<std::string> names;
+	stdext::hash_set<std::string> names;
 public:
-	void Free();
+//	void Free();
 	void Init( bool isDebug, bool isDll, bool isUnicode, int majorVer );
 
-	BOOL add(char const *name);
-	BOOL undef(char const *name);
-	BOOL check(char const *name);
+	bool add(char const *name);
+	bool undef(char const *name);
+	bool check(char const *name);
 	void preprocessor_ifdef(char *buffer,bool isNot);
 	void DirectiveIfdef(char *buffer);
@@ -84,35 +84,13 @@
 	add(temporary);
 }
-BOOL CDefine::add(char const *name)
+bool CDefine::add(char const *name)
 {
-	//重複チェック
-	if(check(name)) return 0;
-
-	//追加
-	names.push_back( name );
-
-	return 1;
-}
-BOOL CDefine::undef(char const *name){
-	std::vector<std::string>::iterator i = names.begin();
-	BOOST_FOREACH( const std::string &temp, names ){
-		if( temp == name ){
-			names.erase( i );
-			return 1;
-		}
-		i++;
-	}
-
-	return 0;
-}
-BOOL CDefine::check(char const *name){
-
-	//重複チェック
-	BOOST_FOREACH( const std::string &temp, names ){
-		if( temp == name ){
-			return 1;
-		}
-	}
-	return 0;
+	return names.insert(name).second;
+}
+bool CDefine::undef(char const *name){
+	return names.erase(name) > 0;
+}
+bool CDefine::check(char const *name){
+	return names.find(name) != names.end();
 }
 
@@ -167,6 +145,5 @@
 
 	//#ifdefの行を消去
-	Text::SlideString(buffer+i,-i);
-	i=0;
+	memset(buffer,' ',static_cast<size_t>(i));
 
 	BOOL bElse=0;
@@ -304,14 +281,11 @@
 					temporary[i3]=buffer[i2];
 				}
-
 				add(temporary);
-
-				i2-=i;
-
 				//ディレクティブを消去
-				Text::SlideString(buffer+i+i2,-i2);
+				memset(buffer+i,' ',static_cast<size_t>(i2-i));
+				i=i2;
 			}
 			if(memicmp(buffer+i,"#undef",6)==0){
-				i2=i+7;
+				i2=i+6;
 				while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
 
@@ -323,11 +297,8 @@
 					temporary[i3]=buffer[i2];
 				}
-
 				undef(temporary);
-
-				i2-=i;
-
 				//ディレクティブを消去
-				Text::SlideString(buffer+i+i2,-i2);
+				memset(buffer+i,' ',static_cast<size_t>(i2-i));
+				i=i2;
 			}
 			else if(memicmp(buffer+i,"#ifdef",6)==0){
@@ -367,4 +338,16 @@
 
 	return true;
+}
+
+//改行コードのCRLFをLFに変換
+int ChangeReturnCodeImpl(char *buffer)
+{
+	int i;
+	for(i=0;buffer[i]!='\0';i++){
+		if(buffer[i]=='\r'&&buffer[i+1]=='\n'){
+			buffer[i]=' ';
+		}
+	}
+	return i;
 }
 
@@ -418,10 +401,5 @@
 #endif
 
-	//改行コードのCRLFをLFに変換
-	for(i=0,i2=0;;i++,i2++){
-		if(buffer[i]=='\r'&&buffer[i+1]=='\n') i++;
-		buffer[i2]=buffer[i];
-		if(buffer[i]=='\0') break;
-	}
+	ChangeReturnCodeImpl(buffer);
 
 	length = i;
@@ -471,5 +449,5 @@
 		if(buffer[i]=='\0') break;
 	}
-	strcpy(buffer,temporary);
+	std::swap(buffer,temporary);
 	free(temporary);
 }
@@ -683,5 +661,5 @@
 	//カッコ'('直下の改行
 	while(buffer[0]=='\n'){
-		Text::SlideString(buffer+1,-1);
+		buffer[0]=' ';
 		(*pRnum)++;
 	}
