Index: trunk/ab5.0/abdev/ab_common/ab_common.vcproj
===================================================================
--- trunk/ab5.0/abdev/ab_common/ab_common.vcproj	(revision 484)
+++ trunk/ab5.0/abdev/ab_common/ab_common.vcproj	(revision 505)
@@ -41,5 +41,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
 				MinimalRebuild="true"
@@ -104,5 +104,5 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
 				RuntimeLibrary="0"
@@ -165,5 +165,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
 				MinimalRebuild="true"
@@ -228,5 +228,5 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
 				RuntimeLibrary="0"
@@ -313,4 +313,12 @@
 				</FileConfiguration>
 			</File>
+			<Filter
+				Name="Lexical"
+				>
+				<File
+					RelativePath=".\include\Namespace.h"
+					>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
@@ -327,4 +335,12 @@
 				>
 			</File>
+			<Filter
+				Name="Lexical"
+				>
+				<File
+					RelativePath=".\src\Namespace.cpp"
+					>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
Index: trunk/ab5.0/abdev/ab_common/include/Namespace.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Namespace.h	(revision 505)
+++ trunk/ab5.0/abdev/ab_common/include/Namespace.h	(revision 505)
@@ -0,0 +1,127 @@
+#pragma once
+
+#include <vector>
+#include <string>
+#include <boost/foreach.hpp>
+
+
+namespace ActiveBasic{ namespace Common{ namespace Lexical{
+
+
+class NamespaceScopes : public std::vector<std::string>
+{
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		ar & boost::serialization::make_nvp("vector_string", boost::serialization::base_object<vector<string>>(*this));
+	}
+
+
+public:
+	NamespaceScopes(){}
+	NamespaceScopes( const std::string &namespaceStr );
+	~NamespaceScopes(){}
+
+	std::string ToString() const
+	{
+		std::string namespaceStr;
+		const std::vector<std::string> &me = *this;
+
+		bool isFirst = true;
+		BOOST_FOREACH( const std::string &itemStr, me ){
+			if( isFirst ){
+				isFirst = false;
+			}
+			else{
+				namespaceStr += ".";
+			}
+
+			namespaceStr += itemStr;
+		}
+		return namespaceStr;
+	}
+
+	// 等しいかをチェック
+	bool IsEqual( const std::string &name ) const
+	{
+		if( ToString() == name ){
+			return true;
+		}
+		return false;
+	}
+
+	// 等しいかをチェック
+	bool IsEqual( const NamespaceScopes &namespaceScopes ) const
+	{
+		if( ToString() == namespaceScopes.ToString() ){
+			return true;
+		}
+		return false;
+	}
+
+	// 所属しているかをチェック
+	// 例:
+	// baseNamespaceScopes =  "Discoversoft"
+	// entryNamespaceScopes = "Discoversoft.ActiveBasic"
+	// この場合、entryNamespaceScopes は baseNamespaceScopes に所属している。
+	static bool IsBelong( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes )
+	{
+		if( baseNamespaceScopes.size() > entryNamespaceScopes.size() ){
+			return false;
+		}
+
+		for( int i=0; i<(int)baseNamespaceScopes.size(); i++ ){
+			if( baseNamespaceScopes[i] != entryNamespaceScopes[i] ){
+				return false;
+			}
+		}
+		return true;
+	}
+};
+
+class NamespaceScopesCollection : public std::vector<NamespaceScopes>
+{
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		ar & boost::serialization::make_nvp("vector_NamespaceScopes", boost::serialization::base_object<vector<NamespaceScopes>>(*this));
+	}
+
+public:
+	bool IsExist( const NamespaceScopes &namespaceScopes ) const
+	{
+		const NamespaceScopesCollection &namespaceScopesCollection = *this;
+		BOOST_FOREACH( const NamespaceScopes &tempNamespaceScopes, namespaceScopesCollection ){
+			if( tempNamespaceScopes.IsEqual( namespaceScopes ) ){
+				return true;
+			}
+		}
+		return false;
+	}
+	bool IsExist( const std::string &namespaceStr ) const
+	{
+		return IsExist( NamespaceScopes( namespaceStr ) );
+	}
+
+	bool IsImported( const NamespaceScopes &namespaceScopes ) const
+	{
+		const NamespaceScopesCollection &namespaceScopesCollection = *this;
+		BOOST_FOREACH( const NamespaceScopes &tempNamespaceScopes, namespaceScopesCollection )
+		{
+			if( namespaceScopes.IsEqual( tempNamespaceScopes ) )
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+
+	void SplitNamespace( const char *fullName, char *namespaceStr, char *simpleName ) const;
+};
+
+
+}}}
Index: trunk/ab5.0/abdev/ab_common/src/Namespace.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Namespace.cpp	(revision 505)
+++ trunk/ab5.0/abdev/ab_common/src/Namespace.cpp	(revision 505)
@@ -0,0 +1,57 @@
+#include "stdafx.h"
+
+#include <Namespace.h>
+
+
+using namespace ActiveBasic::Common::Lexical;
+
+
+NamespaceScopes::NamespaceScopes( const std::string &namespaceStr ){
+	if( namespaceStr.size() == 0 ){
+		return;
+	}
+
+	std::string::size_type i = 0;
+	while( true ){
+		std::string::size_type i2 = namespaceStr.find( '.', i );
+
+		std::string tempName = namespaceStr.substr( i, i2-i );
+
+		push_back( tempName );
+
+		if( i2 == std::string::npos ){
+			break;
+		}
+
+		i = i2 + 1;
+	}
+}
+
+void NamespaceScopesCollection::SplitNamespace( const char *fullName, char *namespaceStr, char *simpleName ) const
+{
+	NamespaceScopes namespaceScopes( fullName );
+	bool hasSimpleName = false;
+	while( namespaceScopes.size() > 0 ){
+		if( IsExist( namespaceScopes ) ){
+			break;
+		}
+		namespaceScopes.pop_back();
+
+		hasSimpleName = true;
+	}
+
+	lstrcpy( namespaceStr, namespaceScopes.ToString().c_str() );
+
+	bool hasNamespace = false;
+	if( namespaceStr[0] ){
+		hasNamespace = true;
+	}
+
+	int dotLength = 0;
+	if( hasSimpleName && hasNamespace ){
+		dotLength = 1;
+	}
+
+	lstrcpy( simpleName, fullName + lstrlen( namespaceStr ) + dotLength );
+}
+
Index: trunk/ab5.0/abdev/ab_common/stdafx.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/stdafx.h	(revision 484)
+++ trunk/ab5.0/abdev/ab_common/stdafx.h	(revision 505)
@@ -21,4 +21,7 @@
 //boost libraries
 #include <boost/foreach.hpp>
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/export.hpp>
 
 #include <jenga/include/common/CmdLine.h>
@@ -29,2 +32,4 @@
 
 #include "Environment.h"
+
+#include <Namespace.h>
