Initial support for maps
This commit is contained in:
@@ -193,6 +193,8 @@ namespace chaiscript
|
|||||||
Eval_Engine ss;
|
Eval_Engine ss;
|
||||||
dispatchkit::Bootstrap::bootstrap(ss);
|
dispatchkit::Bootstrap::bootstrap(ss);
|
||||||
dispatchkit::bootstrap_vector<std::vector<dispatchkit::Boxed_Value> >(ss, "Vector");
|
dispatchkit::bootstrap_vector<std::vector<dispatchkit::Boxed_Value> >(ss, "Vector");
|
||||||
|
dispatchkit::bootstrap_map<std::map<std::string, dispatchkit::Boxed_Value> >(ss, "Map");
|
||||||
|
|
||||||
|
|
||||||
ss.register_function(boost::shared_ptr<dispatchkit::Proxy_Function>(
|
ss.register_function(boost::shared_ptr<dispatchkit::Proxy_Function>(
|
||||||
new dispatchkit::Dynamic_Proxy_Function(boost::bind(&ChaiScript_System<Eval_Engine>::eval, boost::ref(*this), _1), 1)), "eval");
|
new dispatchkit::Dynamic_Proxy_Function(boost::bind(&ChaiScript_System<Eval_Engine>::eval, boost::ref(*this), _1), 1)), "eval");
|
||||||
|
|||||||
@@ -130,6 +130,41 @@ namespace dispatchkit
|
|||||||
bootstrap_random_access_container<VectorType>(system, type);
|
bootstrap_random_access_container<VectorType>(system, type);
|
||||||
bootstrap_back_insertion_sequence<VectorType>(system, type);
|
bootstrap_back_insertion_sequence<VectorType>(system, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename ContainerType>
|
||||||
|
void bootstrap_associative_container(Dispatch_Engine &system, const std::string &type)
|
||||||
|
{
|
||||||
|
bootstrap_forward_container<ContainerType>(system, type);
|
||||||
|
bootstrap_default_constructible<ContainerType>(system, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ContainerType>
|
||||||
|
void bootstrap_unique_associative_container(Dispatch_Engine &system, const std::string &type)
|
||||||
|
{
|
||||||
|
bootstrap_associative_container<ContainerType>(system, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ContainerType>
|
||||||
|
void bootstrap_sorted_associative_container(Dispatch_Engine &system, const std::string &type)
|
||||||
|
{
|
||||||
|
bootstrap_reversible_container<ContainerType>(system, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ContainerType>
|
||||||
|
void bootstrap_unique_sorted_associative_container(Dispatch_Engine &system, const std::string &type)
|
||||||
|
{
|
||||||
|
bootstrap_sorted_associative_container<ContainerType>(system, type);
|
||||||
|
bootstrap_unique_associative_container<ContainerType>(system, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename MapType>
|
||||||
|
void bootstrap_map(Dispatch_Engine &system, const std::string &type)
|
||||||
|
{
|
||||||
|
system.register_type<MapType>(type);
|
||||||
|
register_function(system, &MapType::operator[], "[]");
|
||||||
|
bootstrap_unique_sorted_associative_container<MapType>(system, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user