Initial support for maps

This commit is contained in:
Jason Turner 2009-06-17 00:47:46 +00:00
parent a952bcd066
commit 146bdf8ea1
2 changed files with 37 additions and 0 deletions

View File

@ -193,6 +193,8 @@ namespace chaiscript
Eval_Engine ss;
dispatchkit::Bootstrap::bootstrap(ss);
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>(
new dispatchkit::Dynamic_Proxy_Function(boost::bind(&ChaiScript_System<Eval_Engine>::eval, boost::ref(*this), _1), 1)), "eval");

View File

@ -130,6 +130,41 @@ namespace dispatchkit
bootstrap_random_access_container<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