remove some useless trait classes

This commit is contained in:
Jinhao 2016-01-06 00:23:27 +08:00
parent b46bd24978
commit 70ecce5962
9 changed files with 11 additions and 518 deletions

View File

@ -119,7 +119,6 @@
<Unit filename="../../source/system/shared_wrapper.cpp" /> <Unit filename="../../source/system/shared_wrapper.cpp" />
<Unit filename="../../source/system/timepiece.cpp" /> <Unit filename="../../source/system/timepiece.cpp" />
<Unit filename="../../source/threads/pool.cpp" /> <Unit filename="../../source/threads/pool.cpp" />
<Unit filename="../../source/traits.cpp" />
<Unit filename="../../source/unicode_bidi.cpp" /> <Unit filename="../../source/unicode_bidi.cpp" />
<Extensions> <Extensions>
<code_completion /> <code_completion />

View File

@ -256,7 +256,6 @@
<ClCompile Include="..\..\source\system\shared_wrapper.cpp" /> <ClCompile Include="..\..\source\system\shared_wrapper.cpp" />
<ClCompile Include="..\..\source\system\timepiece.cpp" /> <ClCompile Include="..\..\source\system\timepiece.cpp" />
<ClCompile Include="..\..\source\threads\pool.cpp" /> <ClCompile Include="..\..\source\threads\pool.cpp" />
<ClCompile Include="..\..\source\traits.cpp" />
<ClCompile Include="..\..\source\unicode_bidi.cpp" /> <ClCompile Include="..\..\source\unicode_bidi.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -291,9 +291,6 @@
<ClCompile Include="..\..\source\deploy.cpp"> <ClCompile Include="..\..\source\deploy.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files\nana</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\unicode_bidi.cpp"> <ClCompile Include="..\..\source\unicode_bidi.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files\nana</Filter>
</ClCompile> </ClCompile>

View File

@ -249,7 +249,6 @@
<ClCompile Include="..\..\source\system\platform.cpp" /> <ClCompile Include="..\..\source\system\platform.cpp" />
<ClCompile Include="..\..\source\system\timepiece.cpp" /> <ClCompile Include="..\..\source\system\timepiece.cpp" />
<ClCompile Include="..\..\source\threads\pool.cpp" /> <ClCompile Include="..\..\source\threads\pool.cpp" />
<ClCompile Include="..\..\source\traits.cpp" />
<ClCompile Include="..\..\source\unicode_bidi.cpp" /> <ClCompile Include="..\..\source\unicode_bidi.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -69,9 +69,6 @@
<ClCompile Include="..\..\source\internationalization.cpp"> <ClCompile Include="..\..\source\internationalization.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\unicode_bidi.cpp"> <ClCompile Include="..\..\source\unicode_bidi.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -1,7 +1,7 @@
/* /*
* A ISO C++ filesystem Implementation * A ISO C++ filesystem Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,6 +1,6 @@
/* /*
* Traits Implementation * Traits Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* *
* @file: nana/traits.hpp * @file: nana/traits.hpp
*/ */
@ -13,502 +13,24 @@ namespace nana
{ {
class null_type{}; class null_type{};
//The class noncopyable and nonmovable will be deprecated while the compiler /// Prevent a class to be copyable
//supports the deleted functions class noncopyable
struct noncopyable
{ {
noncopyable(const noncopyable&) = delete; noncopyable(const noncopyable&) = delete;
noncopyable& operator=(const noncopyable&) = delete; noncopyable& operator=(const noncopyable&) = delete;
noncopyable(); protected:
noncopyable() = default;
}; };
struct nonmovable /// Prevent a class to be movable
class nonmovable
{ {
nonmovable(nonmovable&&) = delete; nonmovable(nonmovable&&) = delete;
nonmovable& operator=(nonmovable&&) = delete; nonmovable& operator=(nonmovable&&) = delete;
nonmovable(); protected:
nonmovable() = default;
}; };
namespace traits
{
//traits types for const-volatile specifier
struct no_specifier{};
struct const_specifier{};
struct volatile_specifier{};
struct const_volatile_specifier{};
template<typename T>
struct cv_specifier
{
typedef no_specifier value_type;
};
template<typename T>
struct cv_specifier<const T>
{
typedef const_specifier value_type;
};
template<typename T>
struct cv_specifier<volatile T>
{
typedef volatile_specifier value_type;
};
template<typename T>
struct cv_specifier<const volatile T>
{
typedef const_volatile_specifier value_type;
};
template<typename T>
struct is_function_pointer
: public std::integral_constant<bool, std::is_pointer<T>::value && std::is_function<typename std::remove_pointer<T>::type>::value>
{};
//The traits of pointer to member function
template<typename MF>
struct mfptr_traits
{
typedef void function();
typedef void return_type;
typedef void concept_type;
enum{parameter = 0};
};
template<typename R, typename Concept>
struct mfptr_traits<R(Concept::*)()>
{
typedef Concept concept_type;
typedef R return_type;
typedef return_type function();
enum{parameter = 0};
};
template<typename R, typename Concept>
struct mfptr_traits<R(Concept::*)() const>
{
typedef Concept concept_type;
typedef R return_type;
typedef return_type function();
enum{parameter = 0};
};
template<typename R, typename Concept>
struct mfptr_traits<R(Concept::*)() volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef return_type function();
enum{parameter = 0};
};
template<typename R, typename Concept>
struct mfptr_traits<R(Concept::*)() const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef return_type function();
enum{parameter = 0};
};
template<typename R, typename Concept, typename P>
struct mfptr_traits<R(Concept::*)(P)>
{
typedef Concept concept_type;
typedef R return_type;
typedef P param0_type;
typedef return_type function(param0_type);
enum{parameter = 1};
};
template<typename R, typename Concept, typename P>
struct mfptr_traits<R(Concept::*)(P) const>
{
typedef Concept concept_type;
typedef R return_type;
typedef P param0_type;
typedef return_type function(param0_type);
enum{parameter = 1};
};
template<typename R, typename Concept, typename P>
struct mfptr_traits<R(Concept::*)(P) const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P param0_type;
typedef return_type function(param0_type);
enum{parameter = 1};
};
template<typename R, typename Concept, typename P0, typename P1>
struct mfptr_traits<R(Concept::*)(P0, P1)>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef return_type function(param0_type, param1_type);
enum{parameter = 2};
};
template<typename R, typename Concept, typename P0, typename P1>
struct mfptr_traits<R(Concept::*)(P0, P1) const>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef return_type function(param0_type, param1_type);
enum{parameter = 2};
};
template<typename R, typename Concept, typename P0, typename P1>
struct mfptr_traits<R(Concept::*)(P0, P1) const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef return_type function(param0_type, param1_type);
enum{parameter = 2};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2>
struct mfptr_traits<R(Concept::*)(P0, P1, P2)>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef return_type function(param0_type, param1_type, param2_type);
enum{parameter =3};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2>
struct mfptr_traits<R(Concept::*)(P0, P1, P2) const>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef return_type function(param0_type, param1_type, param2_type);
enum{parameter =3};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2>
struct mfptr_traits<R(Concept::*)(P0, P1, P2) volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef return_type function(param0_type, param1_type, param2_type);
enum{parameter =3};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2>
struct mfptr_traits<R(Concept::*)(P0, P1, P2) const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef return_type function(param0_type, param1_type, param2_type);
enum{parameter =3};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3)>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type);
enum{parameter = 4};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3) const>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type);
enum{parameter = 4};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3) volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type);
enum{parameter = 4};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3) const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type);
enum{parameter = 4};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3, typename P4>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3, P4)>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef P4 param4_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type, param4_type);
enum{parameter = 5};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3, typename P4>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3, P4) const>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef P4 param4_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type, param4_type);
enum{parameter = 5};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3, typename P4>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3, P4) volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef P4 param4_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type, param4_type);
enum{parameter = 5};
};
template<typename R, typename Concept, typename P0, typename P1, typename P2, typename P3, typename P4>
struct mfptr_traits<R(Concept::*)(P0, P1, P2, P3, P4) const volatile>
{
typedef Concept concept_type;
typedef R return_type;
typedef P0 param0_type;
typedef P1 param1_type;
typedef P2 param2_type;
typedef P3 param3_type;
typedef P4 param4_type;
typedef return_type function(param0_type, param1_type, param2_type, param3_type, param4_type);
enum{parameter = 5};
};
template<typename Function, typename Concept, typename CVSpecifier>
struct make_mf
{
typedef int type;
};
template<typename R, typename Concept>
struct make_mf<R(), Concept, no_specifier>
{
typedef R(Concept::*type)();
};
template<typename R, typename Concept>
struct make_mf<R(), Concept, const_specifier>
{
typedef R(Concept::*type)() const;
};
template<typename R, typename Concept>
struct make_mf<R(), Concept, volatile_specifier>
{
typedef R(Concept::*type)() volatile;
};
template<typename R, typename Concept>
struct make_mf<R(), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)() const volatile;
};
template<typename R, typename P0, typename Concept>
struct make_mf<R(P0), Concept, no_specifier>
{
typedef R(Concept::*type)(P0);
};
template<typename R, typename P0, typename Concept>
struct make_mf<R(P0), Concept, const_specifier>
{
typedef R(Concept::*type)(P0) const;
};
template<typename R, typename P0, typename Concept>
struct make_mf<R(P0), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0) volatile;
};
template<typename R, typename P0, typename Concept>
struct make_mf<R(P0), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0) const volatile;
};
template<typename R, typename P0, typename P1, typename Concept>
struct make_mf<R(P0, P1), Concept, no_specifier>
{
typedef R(Concept::*type)(P0, P1);
};
template<typename R, typename P0, typename P1, typename Concept>
struct make_mf<R(P0, P1), Concept, const_specifier>
{
typedef R(Concept::*type)(P0, P1) const;
};
template<typename R, typename P0, typename P1, typename Concept>
struct make_mf<R(P0, P1), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0, P1) volatile;
};
template<typename R, typename P0, typename P1, typename Concept>
struct make_mf<R(P0, P1), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0, P1) const volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename Concept>
struct make_mf<R(P0, P1, P2), Concept, no_specifier>
{
typedef R(Concept::*type)(P0, P1, P2);
};
template<typename R, typename P0, typename P1, typename P2, typename Concept>
struct make_mf<R(P0, P1, P2), Concept, const_specifier>
{
typedef R(Concept::*type)(P0, P1, P2) const;
};
template<typename R, typename P0, typename P1, typename P2, typename Concept>
struct make_mf<R(P0, P1, P2), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2) volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename Concept>
struct make_mf<R(P0, P1, P2), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2) const volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename Concept>
struct make_mf<R(P0, P1, P2, P3), Concept, no_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3);
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename Concept>
struct make_mf<R(P0, P1, P2, P3), Concept, const_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3) const;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename Concept>
struct make_mf<R(P0, P1, P2, P3), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3) volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename Concept>
struct make_mf<R(P0, P1, P2, P3), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3) const volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4), Concept, no_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4);
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4), Concept, const_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4) const;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4) volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4) const volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4, P5), Concept, no_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4, P5);
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4, P5), Concept, const_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4, P5) const;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4, P5), Concept, volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4, P5) volatile;
};
template<typename R, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename Concept>
struct make_mf<R(P0, P1, P2, P3, P4, P5), Concept, const_volatile_specifier>
{
typedef R(Concept::*type)(P0, P1, P2, P3, P4, P5) const volatile;
};
}//end namespace traits
namespace meta namespace meta
{ {
template< typename Param0 = null_type, typename Param1 = null_type, template< typename Param0 = null_type, typename Param1 = null_type,

View File

@ -1,6 +1,6 @@
/* /*
* A ISO C++ FileSystem Implementation * A ISO C++ FileSystem Implementation
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,20 +0,0 @@
/*
* Traits Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
*
* @file: source/traits.cpp
*/
#include <nana/traits.hpp>
namespace nana
{
//class noncopyable
noncopyable::noncopyable(){}
//end class noncopyable
//class nonmovable
nonmovable::nonmovable(){}
//end class nonmovable
}//end namespace nana