Correct bug with bootstrapping of Map type on windows. Also, make it easier to specify the type of a function being added at the time it is being added.
This commit is contained in:
parent
cf94817869
commit
4a57efde25
@ -203,10 +203,10 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
assignable_type<ContainerType>(type, m);
|
assignable_type<ContainerType>(type, m);
|
||||||
|
|
||||||
m->add(fun(&ContainerType::size), "size");
|
m->add(fun<size_t (ContainerType::*)() const>(&ContainerType::size), "size");
|
||||||
m->add(fun(&ContainerType::max_size), "max_size");
|
m->add(fun<size_t (ContainerType::*)() const>(&ContainerType::max_size), "max_size");
|
||||||
m->add(fun(&ContainerType::empty), "empty");
|
m->add(fun<bool (ContainerType::*)() const>(&ContainerType::empty), "empty");
|
||||||
m->add(fun(&ContainerType::clear), "clear");
|
m->add(fun<void (ContainerType::*)()>(&ContainerType::clear), "clear");
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ namespace chaiscript
|
|||||||
ModulePtr unique_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
ModulePtr unique_associative_container_type(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||||
{
|
{
|
||||||
associative_container_type<ContainerType>(type, m);
|
associative_container_type<ContainerType>(type, m);
|
||||||
m->add(fun(&ContainerType::count), "count");
|
m->add(fun<size_t (ContainerType::*)(const ContainerType::key_type &) const>(&ContainerType::count), "count");
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,18 @@
|
|||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Proxy_Function fun(const boost::function<T> &f)
|
Proxy_Function fun(T t)
|
||||||
|
{
|
||||||
|
return fun_helper(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
Proxy_Function fun_helper(const boost::function<T> &f)
|
||||||
{
|
{
|
||||||
return Proxy_Function(new Proxy_Function_Impl<T>(f));
|
return Proxy_Function(new Proxy_Function_Impl<T>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -40,9 +47,9 @@ namespace chaiscript
|
|||||||
* for example, the case of std::pair<>::first and std::pair<>::second
|
* for example, the case of std::pair<>::first and std::pair<>::second
|
||||||
*/
|
*/
|
||||||
template<typename T, typename Class>
|
template<typename T, typename Class>
|
||||||
Proxy_Function fun(T Class::* m)
|
Proxy_Function fun_helper(T Class::* m)
|
||||||
{
|
{
|
||||||
return fun(boost::function<T& (Class *)>(boost::bind(&detail::get_member<T, Class>, m, _1)));
|
return fun_helper(boost::function<T& (Class *)>(boost::bind(&detail::get_member<T, Class>, m, _1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,27 +68,27 @@ namespace chaiscript
|
|||||||
* Register a global function of n parameters with name
|
* Register a global function of n parameters with name
|
||||||
*/
|
*/
|
||||||
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
||||||
Proxy_Function fun(Ret (*f)(BOOST_PP_ENUM_PARAMS(n, Param)))
|
Proxy_Function fun_helper(Ret (*f)(BOOST_PP_ENUM_PARAMS(n, Param)))
|
||||||
{
|
{
|
||||||
return fun(boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
return fun_helper(boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a class method of n parameters with name
|
* Register a class method of n parameters with name
|
||||||
*/
|
*/
|
||||||
template<typename Ret, typename Class BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
template<typename Ret, typename Class BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
||||||
Proxy_Function fun(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)))
|
Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)))
|
||||||
{
|
{
|
||||||
return fun(boost::function<Ret (Class* BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
return fun_helper(boost::function<Ret (Class* BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a const class method of n parameters with name
|
* Register a const class method of n parameters with name
|
||||||
*/
|
*/
|
||||||
template<typename Ret, typename Class BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
template<typename Ret, typename Class BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
||||||
Proxy_Function fun(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))const)
|
Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))const)
|
||||||
{
|
{
|
||||||
return fun(boost::function<Ret (const Class* BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
return fun_helper(boost::function<Ret (const Class* BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param))>(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
AdditionalIncludeDirectories=""$(ProjectDir)\..\..\dispatchkit";"$(ProjectDir)\..\..\chaiscript""
|
AdditionalIncludeDirectories=""$(ProjectDir)\..\..\include""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
@ -229,6 +229,14 @@
|
|||||||
RelativePath="..\..\include\chaiscript\dispatchkit\function_call.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\function_call.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\chaiscript\dispatchkit\function_call_detail.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\chaiscript\dispatchkit\handle_return.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\chaiscript\dispatchkit\proxy_constructors.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\proxy_constructors.hpp"
|
||||||
>
|
>
|
||||||
@ -237,6 +245,10 @@
|
|||||||
RelativePath="..\..\include\chaiscript\dispatchkit\proxy_functions.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\proxy_functions.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\chaiscript\dispatchkit\proxy_functions_detail.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\chaiscript\dispatchkit\register_function.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\register_function.hpp"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user